[ReactNative] Fix a minor bug in AnimationUtils

This commit is contained in:
Martin Konicek 2015-03-27 13:02:44 -07:00
parent 89fce9aead
commit c430782e81
1 changed files with 9 additions and 3 deletions

View File

@ -211,21 +211,27 @@ var ticksPerSecond = 60;
var lastUsedTag = 0;
module.exports = {
/**
* Returns a new unique animation tag.
*/
allocateTag: function(): number {
return ++lastUsedTag;
},
/**
* Returns the values of the easing function at discrete ticks (60 per second).
*/
evaluateEasingFunction: function(duration: number, easing: string | EasingFunction): Array<number> {
if (typeof easing === 'string') {
easing = defaults[easing] || defaults.easeOutQuad;
}
var tickCount = Math.round(duration * ticksPerSecond / 1000);
var sample = [];
var samples = [];
for (var i = 0; i <= tickCount; i++) {
sample.push(easing(i / tickCount));
samples.push(easing.call(defaults, i / tickCount));
}
return sample;
return samples;
},
};