mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Merge pull request #66 from 2youyouo2/master
fixed SampledAnimCurve _findFrameIndex error
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user