12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- "use strict";
- var BABYLON = BABYLON || {};
- (function () {
- BABYLON._Animatable = function (target, from, to, loop, speedRatio, onAnimationEnd) {
- this.target = target;
- this.fromFrame = from;
- this.toFrame = to;
- this.loopAnimation = loop;
- this.speedRatio = speedRatio ? speedRatio : 1.0;
- this.onAnimationEnd = onAnimationEnd;
- };
-
- // Members
- BABYLON._Animatable.prototype.target = null;
- BABYLON._Animatable.prototype.animationStarted = false;
- BABYLON._Animatable.prototype.loopAnimation = false;
- BABYLON._Animatable.prototype.fromFrame = 0;
- BABYLON._Animatable.prototype.toFrame = 100;
- BABYLON._Animatable.prototype.speedRatio = 1.0;
-
- // Methods
- BABYLON._Animatable.prototype._animate = function (delay) {
- if (!this._localDelayOffset) {
- this._localDelayOffset = delay;
- }
- // Animating
- var running = false;
- var animations = this.target.animations;
- for (var index = 0; index < animations.length; index++) {
- var isRunning = animations[index].animate(this.target, delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
- running = running || isRunning;
- }
- if (!running && this.onAnimationEnd) {
- this.onAnimationEnd();
- }
- return running;
- };
- })();
|