Skip to content

Commit 6fbc1c9

Browse files
Merge branch 'master' into dev
2 parents 880ed81 + bcea2d8 commit 6fbc1c9

31 files changed

+8472
-310
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# top-most editorconfig file
2+
root = true
3+
4+
# editor configuration
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
indent_style = space
9+
indent_size = 2
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
# preserve markdown line break
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
node_modules/
1+
node_modules/

.npmignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
mockups/
2+
css/
3+
lib/
4+
js/
5+
.editorconfig
6+
index.html
7+
bower.json
8+
gulpfile.js
9+
webpack.config.js

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Oleg Solomka
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 44 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,65 @@
1-
# mojs-player
1+
# @mojs/player[![npm](https://img.shields.io/npm/v/@mojs/player.svg)](https://www.npmjs.com/package/@mojs/player)
22

3-
<img src="https://github.com/legomushroom/mojs-player/blob/master/mockups/[email protected]?raw=true" alt="mojs-player" />
3+
GUI player to control your animations.
4+
5+
![@mojs/player](logo.png "@mojs/player")
46

57
Player controls for [mojs](mojs.io). Intended to help you to craft `mojs` animation sequences. To be clear, this player is not needed to play `mojs` animations. It is just a debug tool that gives you the ability to:
6-
- control your sequences with `GUI` while working on them
7-
- it saves the current progress of your animation thus you don't loose the `focus`
8-
- it gives you `bounds` to constrain `focus point` of your animation
9-
- it gives you the control over the speed of animation
10-
- it gives you the ability to seek animations freely
11-
- it saves player's state and settings thus they not get lost when page reloaded
8+
- control your sequences with `GUI` while working on them
9+
- it saves the current progress of your animation thus you don't loose the `focus`
10+
- it gives you `bounds` to constrain `focus point` of your animation
11+
- it gives you the control over the speed of animation
12+
- it gives you the ability to seek animations freely
13+
- it saves player's state and settings thus they not get lost when page reloaded
1214

1315
## Installation
1416

1517
The `MojsPlayer` depends on `mojs >= 0.225.2` so make sure you link it first.
1618

17-
[CDN](https://www.jsdelivr.com/):
18-
19-
```
20-
<script src="//cdn.jsdelivr.net/mojs-player/latest/mojs-player.min.js"></script>
21-
```
22-
23-
[NPM](https://www.npmjs.com/):
24-
25-
```
26-
[sudo] npm install mojs-player
27-
```
28-
29-
[Bower](http://bower.io/):
19+
```console
20+
# cdn
21+
<script src="https://cdn.jsdelivr.net/npm/@mojs/player"></script>
3022

31-
```
32-
bower install mojs-player
23+
# npm
24+
npm i @mojs/player
3325
```
3426

35-
Import `MojsPlayer` constructor to your code (depends on your environment) :
27+
Import `MojsPlayer` constructor to your code, depending on your environment:
3628

3729
```javascript
3830
const MojsPlayer = require('mojs-player').default;
31+
3932
// or
40-
import MojsPlayer from 'mojs-player';
33+
import MojsPlayer from '@mojs/player';
4134
```
4235

43-
If you installed it with script link - you should have `MojsPlayer` global.
36+
> If you installed it with script link you should have `MojsPlayer` global
4437
4538
## Usage
4639

47-
Construct `MojsPlayer` and pass your main `Tween/Timeline` as the `add` option:
40+
Construct `MojsPlayer` and pass your main `Tween/Timeline` to the `add` option:
4841

4942
```javascript
50-
// const mainTimeline = new mojs.Timeline({});
51-
// .. some code regarding timeline ..
52-
const mojsPlayer = new MojsPlayer({ add: mainTimeline });
43+
// create the timeline
44+
const mainTimeline = new mojs.Timeline({});
45+
46+
// add the timeline to the player
47+
const mojsPlayer = new MojsPlayer({
48+
add: mainTimeline
49+
});
5350
```
5451

55-
The `add` option is the only required option to launch. Player's controls should appear at the bottom of the page.
52+
> The `add` option is the **only required option** to launch: player's controls should appear at the bottom of the page when ready
5653
5754
You can also set other player initial state:
5855

5956
```javascript
60-
// ..
6157
const mojsPlayer = new MojsPlayer({
62-
add: mainTimeline,
63-
// options
58+
59+
// required
60+
add: mainTimeline,
61+
62+
// optionally
6463
className: '', // class name to add to main HTMLElement
6564
isSaveState: true, // determines if should preserve state on page reload
6665
isPlaying: false, // playback state
@@ -73,7 +72,14 @@ const mojsPlayer = new MojsPlayer({
7372
speed: 1, // `speed` value
7473
isHidden: false, // determines if the player should be hidden
7574
precision: 0.1, // step size for player handle - for instance, after page reload - player should restore timeline progress - the whole timeline will be updated incrementally with the `precision` step size until the progress will be met.
76-
name: 'mojs-player' // name for the player - mainly used for localstorage identifier, use to distuguish between multiple local players
75+
name: 'mojs-player', // name for the player - mainly used for localstorage identifier, use to distinguish between multiple local players
76+
onToggleHide(isHidden) { // should be called after user taps on the hide-button (isHidden is a boolean, indicating the visibility state of the player)
77+
if (isHidden) {
78+
// do something when player is invisible
79+
} else {
80+
// do something when player is visible
81+
}
82+
}
7783
});
7884
```
7985

@@ -99,32 +105,20 @@ const mojsPlayer = new MojsPlayer({
99105

100106
Install [webpack](https://webpack.github.io/) globally:
101107

102-
```tiddlywiki
108+
```console
103109
[sudo] npm install webpack -g
104110
```
105111

106112
Install dependencies with [npm](https://www.npmjs.com/):
107113

108-
```
114+
```console
109115
[sudo] npm install
110116
```
111117

112118
Run [webpack](https://webpack.github.io/):
113119

114-
```
120+
```console
115121
webpack
116122
```
117123

118124
Please make sure you are on the `dev` branch before making changes.
119-
120-
## License
121-
122-
(The MIT License)
123-
124-
Copyright (c) Oleg Solomka [@LegoMushroom](https://twitter.com/legomushroom) [[email protected]](mailto:[email protected])
125-
126-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
127-
128-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
129-
130-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
"test",
3030
"tests"
3131
]
32-
}
32+
}

0 commit comments

Comments
 (0)