|
@@ -391,7 +391,7 @@
|
|
|
* @param loop defines if the current animation must loop
|
|
|
* @param speedRatio defines the current speed ratio
|
|
|
* @param weight defines the weight of the animation (default is -1 so no weight)
|
|
|
- * @returns a boolean indicating if the animation has ended
|
|
|
+ * @returns a boolean indicating if the animation is running
|
|
|
*/
|
|
|
public animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, weight = -1.0): boolean {
|
|
|
let targetPropertyPath = this._animation.targetPropertyPath
|
|
@@ -400,21 +400,20 @@
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- let keys = this._animation.getKeys();
|
|
|
-
|
|
|
- // Return immediately if there is only one key frame.
|
|
|
- if (keys.length === 1) {
|
|
|
- this.setValue(keys[0].value, weight);
|
|
|
- return !loop;
|
|
|
- }
|
|
|
-
|
|
|
var returnValue = true;
|
|
|
|
|
|
+ let keys = this._animation.getKeys();
|
|
|
+
|
|
|
// Adding a start key at frame 0 if missing
|
|
|
if (keys[0].frame !== 0) {
|
|
|
var newKey = { frame: 0, value: keys[0].value };
|
|
|
keys.splice(0, 0, newKey);
|
|
|
}
|
|
|
+ // Adding a duplicate key when there is only one key at frame zero
|
|
|
+ else if (keys.length === 1) {
|
|
|
+ var newKey = { frame: 0.001, value: keys[0].value };
|
|
|
+ keys.push(newKey);
|
|
|
+ }
|
|
|
|
|
|
// Check limits
|
|
|
if (from < keys[0].frame || from > keys[keys.length - 1].frame) {
|