mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
fixed #460
This commit is contained in:
21
src/Tween.js
21
src/Tween.js
@@ -94,23 +94,36 @@
|
||||
tween = tweens[n];
|
||||
}
|
||||
},
|
||||
_isLastTween: function(tween) {
|
||||
var tweens = this.tweens,
|
||||
len = tweens.length,
|
||||
n;
|
||||
|
||||
return tweens[len - 1].prop === tween.prop;
|
||||
},
|
||||
_addListeners: function(tween) {
|
||||
var that = this;
|
||||
|
||||
// start listeners
|
||||
tween.onPlay = function() {
|
||||
that.anim.start();
|
||||
if (that._isLastTween(tween)) {
|
||||
that.anim.start();
|
||||
}
|
||||
};
|
||||
tween.onReverse = function() {
|
||||
that.anim.start();
|
||||
if (that._isLastTween(tween)) {
|
||||
that.anim.start();
|
||||
}
|
||||
};
|
||||
|
||||
// stop listeners
|
||||
tween.onPause = function() {
|
||||
that.anim.stop();
|
||||
if (that._isLastTween(tween)) {
|
||||
that.anim.stop();
|
||||
}
|
||||
};
|
||||
tween.onFinish = function() {
|
||||
if (that.onFinish) {
|
||||
if (that._isLastTween(tween) && that.onFinish) {
|
||||
that.onFinish();
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user