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
* Add Hover element to build script
* Update inline documentation for Player
* Add generic timeline class
This class is for reference, and is not yet used by any generated files from Flow
* Update filename
Co-authored-by: Travis <[email protected]>
Copy file name to clipboardExpand all lines: Sources/FlowCommonWebFiles/player.js
+27-16
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/**
2
-
* Class used for driving animations.
2
+
* The Player is a generic class for handling the loading, unloading, and playback of a `Timeline` to be associated with a DOM element. A player must be able to construct a timer – using an existing DOM element or ID – which handles timing and the execution of a callback on completion.
3
3
*/
4
4
classPlayer{
5
5
/**
@@ -9,13 +9,13 @@ class Player {
9
9
* Animation played when the transition is triggered.
10
10
*
11
11
* @param {String} timer
12
-
* The HTML Element or the HTML Element ID for the Timer.
12
+
* The HTML Element or the HTML Element ID to be used for handling the timer (i.e. timing animation) of `self`.
13
13
*
14
14
* @param {Boolean} loop
15
-
* True if the animation should restart upon completion false otherwise.
15
+
* This property specifies that the animation should repeat upon completion.
16
16
*
17
17
* @param {Boolean} delay
18
-
* The time in milliseconds before the animation starts.
18
+
* The number of milliseconds to delay the start of playback.
19
19
*
20
20
* @param {function: () -> Void} callback
21
21
* A callback function passed to the player that runs upon animation completion.
@@ -36,45 +36,51 @@ class Player {
36
36
37
37
/**
38
38
* @return {Timeline}
39
-
* Returns the value of timeline for `self`.
39
+
* Returns the current timeline for `self`.
40
40
*/
41
41
gettimeline(){
42
42
returnthis._timeline;
43
43
}
44
44
45
45
/**
46
46
* @set
47
-
* Sets the timeline of self to timeline, pauses the playback and sets the current time to zero.
47
+
* Sets the timeline of `self` to `timeline`. When this variable is set, the player pauses playback then sets the new value. If the new value is `null` the current timing animation is removed, and default values are set in anticipation of a new timeline. If the new value is not `null` the timeline is prepped for playback.
48
48
*
49
49
* @param {Timeline} timeline
50
-
* Animation to be played.
50
+
* The timeline to be controlled by `self`.
51
51
*
52
52
*/
53
53
settimeline(timeline){
54
54
// Work around for Safari bug. More detail provided in the
55
-
// comment above the cancelAnimations function in this file.
55
+
// comment above the `cancelAnimations` function in this file.
56
56
this.cancelAnimations();
57
57
58
+
// Pause the current timeline, if it exists
58
59
if(this._timeline!=null){
59
60
this.pause();
60
61
}
62
+
61
63
this._timeline=timeline;
62
-
this._timeline.loadFillImages();
63
64
65
+
// Prepare `self` to receive a new timeline, or initiate playback.
64
66
if(this._timeline===null){
65
67
this.timingAnimation=null;
66
68
this.currentTime=0;
67
69
this.shouldPlay=false;
68
70
}else{
71
+
//Set up the timing animation, which is used to track the current playback time
Copy file name to clipboardExpand all lines: package.json
+1-1
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
"name": "flowcommonweb",
3
3
"version": "1.0.0",
4
4
"description": "**When you export a Flow project to HTML, React, or anything Web-related, Flow includes a set of helper classes and extensions that help manage and control your animations. This page provides and overview and a link to each of these files.**",
5
-
"main": "player.js",
5
+
"main": "Player.js",
6
6
"scripts": {
7
7
"test": "echo \"Error: no test specified\" && exit 1"
0 commit comments