Skip to content

Commit baf6982

Browse files
committed
Working through progress support.
1 parent 5dd08c7 commit baf6982

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

v3/src/animation/AnimationFrame.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
var AnimationFrame = function (frame, duration, onUpdate)
1+
var AnimationFrame = function (index, frame, duration, onUpdate)
22
{
3+
// The index of this frame within the Animation.frames array
4+
this.index = index;
5+
36
// Texture Frame
47
this.frame = frame;
58

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '75ff7070-19b1-11e7-8955-3fcd2f9423de'
2+
build: 'e7a99d10-1a09-11e7-9d35-b9c669b4e95e'
33
};
44
module.exports = CHECKSUM;

v3/src/components/Animation.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,40 @@ Animation.prototype = {
117117
this.isPlaying = false;
118118

119119
return this.parent;
120+
},
121+
122+
// How far through the current animation are we?
123+
// Value between 0 and 1
124+
// I.e. [a,b,c,d,e,f] if on frame c progress would be 0.5
125+
126+
// TODO: Add value argument
127+
progress: function ()
128+
{
129+
var p = this.currentFrame.index / this.currentAnim.frames.length;
130+
131+
if (!this.forward)
132+
{
133+
p = 1 - p;
134+
}
135+
136+
return p;
120137
}
121138

122139
};
123140

141+
Object.defineProperties(Animation.prototype, {
142+
143+
totalFrames: {
144+
145+
enumerable: true,
146+
147+
get: function ()
148+
{
149+
return this.currentAnim.frames.length;
150+
}
151+
152+
}
153+
154+
});
155+
124156
module.exports = Animation;

0 commit comments

Comments
 (0)