updated Transition docs

This commit is contained in:
Eric Rowell
2012-06-03 10:36:50 -07:00
parent e842cdf8ac
commit 8b22fb0690
5 changed files with 46 additions and 49 deletions

View File

@@ -706,7 +706,7 @@ Kinetic.Node.prototype = {
var trans = new Kinetic.Transition(this, config);
var anim = {
func: function() {
trans.onEnterFrame();
trans._onEnterFrame();
},
node: node
};

View File

@@ -6,8 +6,10 @@
*/
/**
* Transition constructor. KineticJS transitions contain
* multiple Tweens
* Transition constructor used by KineticJS. The transitionTo() Node method
* returns a reference to the transition object which you can use
* to stop, resume, or restart the transition
* @constructor
*/
Kinetic.Transition = function(node, config) {
this.node = node;
@@ -21,17 +23,16 @@ Kinetic.Transition = function(node, config) {
if(key !== 'duration' && key !== 'easing' && key !== 'callback') {
// if val is an object then traverse
if(Kinetic.GlobalObject._isObject(c[key])) {
addTween(c[key], attrs[key]);
addTween(c[key], attrs[key]);
}
else {
that.add(that._getTween(attrs, key, c[key]));
that._add(that._getTween(attrs, key, c[key]));
}
}
}
}
addTween(config, node.attrs);
var finishedTweens = 0;
var that = this;
for(var n = 0; n < this.tweens.length; n++) {
@@ -48,13 +49,6 @@ Kinetic.Transition = function(node, config) {
* Transition methods
*/
Kinetic.Transition.prototype = {
/**
* add tween to tweens array
* @param {Kinetic.Tween} tween
*/
add: function(tween) {
this.tweens.push(tween);
},
/**
* start transition
*/
@@ -63,14 +57,6 @@ Kinetic.Transition.prototype = {
this.tweens[n].start();
}
},
/**
* onEnterFrame
*/
onEnterFrame: function() {
for(var n = 0; n < this.tweens.length; n++) {
this.tweens[n].onEnterFrame();
}
},
/**
* stop transition
*/
@@ -87,6 +73,14 @@ Kinetic.Transition.prototype = {
this.tweens[n].resume();
}
},
_onEnterFrame: function() {
for(var n = 0; n < this.tweens.length; n++) {
this.tweens[n].onEnterFrame();
}
},
_add: function(tween) {
this.tweens.push(tween);
},
_getTween: function(key, prop, val) {
var config = this.config;
var node = this.node;