forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimation.js
More file actions
111 lines (77 loc) · 2.96 KB
/
Copy pathAnimation.js
File metadata and controls
111 lines (77 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
var Class = require('../../utils/Class');
var Components = require('./animation/');
// Game Object Animation Controller
// Phaser.GameObjects.Components.Animation
var Animation = new Class({
initialize:
function Animation (parent)
{
// Sprite / Game Object
this.parent = parent;
this.animationManager = parent.scene.sys.anims;
this.animationManager.once('remove', this.remove, this);
this.isPlaying = false;
// Reference to the Phaser.Animation object
this.currentAnim = null;
// Reference to the Phaser.AnimationFrame object
this.currentFrame = null;
// Animation specific values
// -------------------------
// Scale the time (make it go faster / slower)
// Factor that's used to scale time where 1 = normal speed (the default), 0.5 = half speed, 2 = double speed, etc.
this._timeScale = 1;
// The frame rate of playback in frames per second (default 24 if duration is null)
this.frameRate = 0;
// How long the animation should play for. If frameRate is set it overrides this value
// otherwise frameRate is derived from duration
this.duration = 0;
// ms per frame (without including frame specific modifiers)
this.msPerFrame = 0;
// Skip frames if the time lags, or always advanced anyway?
this.skipMissedFrames = true;
// Delay before starting playback (in seconds)
this._delay = 0;
// Number of times to repeat the animation (-1 for infinity)
this._repeat = 0;
// Delay before the repeat starts (in seconds)
this._repeatDelay = 0;
// Should the animation yoyo? (reverse back down to the start) before repeating?
this._yoyo = false;
// Playhead values
// ---------------
// Move the playhead forward (true) or in reverse (false)
this.forward = true;
this.accumulator = 0;
this.nextTick = 0;
this.repeatCounter = 0;
this.pendingRepeat = false;
this._paused = false;
this._wasPlaying = false;
this._callbackArgs = [ parent, null ];
this._updateParams = [];
},
destroy: function ()
{
},
delay: Components.Delay,
delayedPlay: Components.DelayedPlay,
getCurrentKey: Components.GetCurrentKey,
load: Components.Load,
pause: Components.Pause,
paused: Components.Paused,
play: Components.Play,
progress: Components.Progress,
remove: Components.Remove,
repeat: Components.Repeat,
repeatDelay: Components.RepeatDelay,
restart: Components.Restart,
resume: Components.Resume,
stop: Components.Stop,
timeScale: Components.TimeScale,
totalFrames: Components.TotalFrames,
totalProgress: Components.TotalProgress,
update: Components.Update,
updateFrame: Components.UpdateFrame,
yoyo: Components.Yoyo
});
module.exports = Animation;