From 4314fb095f147150122dbe09817db6d5cffeb7e9 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Wed, 5 Apr 2017 17:04:43 +0100 Subject: [PATCH] Added Frame progress slice. --- v3/src/animation/frame/GetFrames.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/v3/src/animation/frame/GetFrames.js b/v3/src/animation/frame/GetFrames.js index 9209c8324..4ca6d8e1e 100644 --- a/v3/src/animation/frame/GetFrames.js +++ b/v3/src/animation/frame/GetFrames.js @@ -15,8 +15,9 @@ var GetFrames = function (textureManager, frames) var prev; var animationFrame; var index = 1; + var i; - for (var i = 0; i < frames.length; i++) + for (i = 0; i < frames.length; i++) { var item = frames[i]; @@ -59,6 +60,15 @@ var GetFrames = function (textureManager, frames) out[0].prevFrame = animationFrame; + // Generate the progress data + + var slice = 1 / (out.length - 1); + + for (i = 0; i < out.length; i++) + { + out[i].progress = i * slice; + } + return out; };