Merge pull request #66 from 2youyouo2/master

fixed SampledAnimCurve _findFrameIndex error
This commit is contained in:
Jare Guo
2015-12-16 21:47:12 +08:00
+8 -2
View File
@@ -226,9 +226,15 @@ var SampledAnimCurve = cc.Class({
ratio = (ratio - start) / (end - start);
var eachLength = 1 / length;
var index = ratio / eachLength;
var floorIndex = index | 0;
var EPSILON = 1e-6;
var index = (ratio / eachLength) | 0;
return index;
if ((index - floorIndex) < EPSILON) {
return floorIndex;
}
return ~(floorIndex + 1);
}
});