mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
hooked node transitions and sprite animation into new animation API
This commit is contained in:
33
dist/kinetic-core.js
vendored
33
dist/kinetic-core.js
vendored
@@ -3,7 +3,7 @@
|
||||
* http://www.kineticjs.com/
|
||||
* Copyright 2012, Eric Rowell
|
||||
* Licensed under the MIT or GPL Version 2 licenses.
|
||||
* Date: Aug 04 2012
|
||||
* Date: Aug 08 2012
|
||||
*
|
||||
* Copyright (C) 2011 - 2012 by Eric Rowell
|
||||
*
|
||||
@@ -1886,14 +1886,6 @@ Kinetic.Node = Kinetic.Class.extend({
|
||||
* transition completes
|
||||
*/
|
||||
transitionTo: function(config) {
|
||||
var a = Kinetic.Animation;
|
||||
|
||||
/*
|
||||
* clear transition if one is currently running for this
|
||||
* node
|
||||
*/
|
||||
a._removeAnimation(this.transAnim);
|
||||
|
||||
/*
|
||||
* create new transition
|
||||
*/
|
||||
@@ -1905,16 +1897,11 @@ Kinetic.Node = Kinetic.Class.extend({
|
||||
trans._onEnterFrame();
|
||||
};
|
||||
this.transAnim.node = node;
|
||||
/*
|
||||
* adding the animation with the addAnimation
|
||||
* method auto generates an id
|
||||
*/
|
||||
a._addAnimation(this.transAnim);
|
||||
|
||||
// subscribe to onFinished for first tween
|
||||
trans.onFinished = function() {
|
||||
// remove animation
|
||||
a._removeAnimation(that.transAnim);
|
||||
that.transAnim.stop();
|
||||
that.transAnim.node.draw();
|
||||
|
||||
// callback
|
||||
@@ -1924,7 +1911,7 @@ Kinetic.Node = Kinetic.Class.extend({
|
||||
};
|
||||
// auto start
|
||||
trans.start();
|
||||
a._handleAnimation();
|
||||
this.transAnim.start();
|
||||
return trans;
|
||||
},
|
||||
/**
|
||||
@@ -5419,10 +5406,6 @@ Kinetic.Sprite = Kinetic.Shape.extend({
|
||||
start: function() {
|
||||
var that = this;
|
||||
var layer = this.getLayer();
|
||||
var ka = Kinetic.Animation;
|
||||
|
||||
// if sprite already has an animation, remove it
|
||||
ka._removeAnimation(this.anim);
|
||||
|
||||
/*
|
||||
* animation object has no executable function because
|
||||
@@ -5432,12 +5415,6 @@ Kinetic.Sprite = Kinetic.Shape.extend({
|
||||
*/
|
||||
this.anim.node = layer;
|
||||
|
||||
/*
|
||||
* adding the animation with the addAnimation
|
||||
* method auto generates an id
|
||||
*/
|
||||
ka._addAnimation(this.anim);
|
||||
|
||||
this.interval = setInterval(function() {
|
||||
var index = that.attrs.index;
|
||||
that._updateIndex();
|
||||
@@ -5446,7 +5423,7 @@ Kinetic.Sprite = Kinetic.Shape.extend({
|
||||
}
|
||||
}, 1000 / this.attrs.frameRate);
|
||||
|
||||
ka._handleAnimation();
|
||||
this.anim.start();
|
||||
},
|
||||
/**
|
||||
* stop sprite animation
|
||||
@@ -5454,7 +5431,7 @@ Kinetic.Sprite = Kinetic.Shape.extend({
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
*/
|
||||
stop: function() {
|
||||
Kinetic.Animation._removeAnimation(this.anim);
|
||||
this.anim.stop();
|
||||
clearInterval(this.interval);
|
||||
},
|
||||
/**
|
||||
|
6
dist/kinetic-core.min.js
vendored
6
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
17
src/Node.js
17
src/Node.js
@@ -671,14 +671,6 @@ Kinetic.Node = Kinetic.Class.extend({
|
||||
* transition completes
|
||||
*/
|
||||
transitionTo: function(config) {
|
||||
var a = Kinetic.Animation;
|
||||
|
||||
/*
|
||||
* clear transition if one is currently running for this
|
||||
* node
|
||||
*/
|
||||
a._removeAnimation(this.transAnim);
|
||||
|
||||
/*
|
||||
* create new transition
|
||||
*/
|
||||
@@ -690,16 +682,11 @@ Kinetic.Node = Kinetic.Class.extend({
|
||||
trans._onEnterFrame();
|
||||
};
|
||||
this.transAnim.node = node;
|
||||
/*
|
||||
* adding the animation with the addAnimation
|
||||
* method auto generates an id
|
||||
*/
|
||||
a._addAnimation(this.transAnim);
|
||||
|
||||
// subscribe to onFinished for first tween
|
||||
trans.onFinished = function() {
|
||||
// remove animation
|
||||
a._removeAnimation(that.transAnim);
|
||||
that.transAnim.stop();
|
||||
that.transAnim.node.draw();
|
||||
|
||||
// callback
|
||||
@@ -709,7 +696,7 @@ Kinetic.Node = Kinetic.Class.extend({
|
||||
};
|
||||
// auto start
|
||||
trans.start();
|
||||
a._handleAnimation();
|
||||
this.transAnim.start();
|
||||
return trans;
|
||||
},
|
||||
/**
|
||||
|
@@ -45,10 +45,6 @@ Kinetic.Sprite = Kinetic.Shape.extend({
|
||||
start: function() {
|
||||
var that = this;
|
||||
var layer = this.getLayer();
|
||||
var ka = Kinetic.Animation;
|
||||
|
||||
// if sprite already has an animation, remove it
|
||||
ka._removeAnimation(this.anim);
|
||||
|
||||
/*
|
||||
* animation object has no executable function because
|
||||
@@ -58,12 +54,6 @@ Kinetic.Sprite = Kinetic.Shape.extend({
|
||||
*/
|
||||
this.anim.node = layer;
|
||||
|
||||
/*
|
||||
* adding the animation with the addAnimation
|
||||
* method auto generates an id
|
||||
*/
|
||||
ka._addAnimation(this.anim);
|
||||
|
||||
this.interval = setInterval(function() {
|
||||
var index = that.attrs.index;
|
||||
that._updateIndex();
|
||||
@@ -72,7 +62,7 @@ Kinetic.Sprite = Kinetic.Shape.extend({
|
||||
}
|
||||
}, 1000 / this.attrs.frameRate);
|
||||
|
||||
ka._handleAnimation();
|
||||
this.anim.start();
|
||||
},
|
||||
/**
|
||||
* stop sprite animation
|
||||
@@ -80,7 +70,7 @@ Kinetic.Sprite = Kinetic.Shape.extend({
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
*/
|
||||
stop: function() {
|
||||
Kinetic.Animation._removeAnimation(this.anim);
|
||||
this.anim.stop();
|
||||
clearInterval(this.interval);
|
||||
},
|
||||
/**
|
||||
|
Reference in New Issue
Block a user