You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
12
14
13
15
## Installation
14
16
15
17
The `MojsPlayer` depends on `mojs >= 0.225.2` so make sure you link it first.
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
56
53
57
54
You can also set other player initial state:
58
55
59
56
```javascript
60
-
// ..
61
57
constmojsPlayer=newMojsPlayer({
62
-
add: mainTimeline,
63
-
// options
58
+
59
+
// required
60
+
add: mainTimeline,
61
+
62
+
// optionally
64
63
className:'', // class name to add to main HTMLElement
65
64
isSaveState:true, // determines if should preserve state on page reload
66
65
isPlaying:false, // playback state
@@ -73,7 +72,14 @@ const mojsPlayer = new MojsPlayer({
73
72
speed:1, // `speed` value
74
73
isHidden:false, // determines if the player should be hidden
75
74
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
+
}
77
83
});
78
84
```
79
85
@@ -99,32 +105,20 @@ const mojsPlayer = new MojsPlayer({
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.
0 commit comments