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

36
dist/kinetic-core.js vendored
View File

@@ -3,7 +3,7 @@
* http://www.kineticjs.com/ * http://www.kineticjs.com/
* Copyright 2012, Eric Rowell * Copyright 2012, Eric Rowell
* Licensed under the MIT or GPL Version 2 licenses. * Licensed under the MIT or GPL Version 2 licenses.
* Date: Jun 02 2012 * Date: Jun 03 2012
* *
* Copyright (C) 2011 - 2012 by Eric Rowell * Copyright (C) 2011 - 2012 by Eric Rowell
* *
@@ -1069,7 +1069,7 @@ Kinetic.Node.prototype = {
var trans = new Kinetic.Transition(this, config); var trans = new Kinetic.Transition(this, config);
var anim = { var anim = {
func: function() { func: function() {
trans.onEnterFrame(); trans._onEnterFrame();
}, },
node: node node: node
}; };
@@ -4568,8 +4568,10 @@ Kinetic.Transform.prototype = {
*/ */
/** /**
* Transition constructor. KineticJS transitions contain * Transition constructor used by KineticJS. The transitionTo() Node method
* multiple Tweens * returns a reference to the transition object which you can use
* to stop, resume, or restart the transition
* @constructor
*/ */
Kinetic.Transition = function(node, config) { Kinetic.Transition = function(node, config) {
this.node = node; this.node = node;
@@ -4586,12 +4588,11 @@ Kinetic.Transition = function(node, config) {
addTween(c[key], attrs[key]); addTween(c[key], attrs[key]);
} }
else { else {
that.add(that._getTween(attrs, key, c[key])); that._add(that._getTween(attrs, key, c[key]));
} }
} }
} }
} }
addTween(config, node.attrs); addTween(config, node.attrs);
var finishedTweens = 0; var finishedTweens = 0;
@@ -4610,13 +4611,6 @@ Kinetic.Transition = function(node, config) {
* Transition methods * Transition methods
*/ */
Kinetic.Transition.prototype = { Kinetic.Transition.prototype = {
/**
* add tween to tweens array
* @param {Kinetic.Tween} tween
*/
add: function(tween) {
this.tweens.push(tween);
},
/** /**
* start transition * start transition
*/ */
@@ -4625,14 +4619,6 @@ Kinetic.Transition.prototype = {
this.tweens[n].start(); this.tweens[n].start();
} }
}, },
/**
* onEnterFrame
*/
onEnterFrame: function() {
for(var n = 0; n < this.tweens.length; n++) {
this.tweens[n].onEnterFrame();
}
},
/** /**
* stop transition * stop transition
*/ */
@@ -4649,6 +4635,14 @@ Kinetic.Transition.prototype = {
this.tweens[n].resume(); 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) { _getTween: function(key, prop, val) {
var config = this.config; var config = this.config;
var node = this.node; var node = this.node;

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -6,8 +6,10 @@
*/ */
/** /**
* Transition constructor. KineticJS transitions contain * Transition constructor used by KineticJS. The transitionTo() Node method
* multiple Tweens * returns a reference to the transition object which you can use
* to stop, resume, or restart the transition
* @constructor
*/ */
Kinetic.Transition = function(node, config) { Kinetic.Transition = function(node, config) {
this.node = node; this.node = node;
@@ -24,12 +26,11 @@ Kinetic.Transition = function(node, config) {
addTween(c[key], attrs[key]); addTween(c[key], attrs[key]);
} }
else { else {
that.add(that._getTween(attrs, key, c[key])); that._add(that._getTween(attrs, key, c[key]));
} }
} }
} }
} }
addTween(config, node.attrs); addTween(config, node.attrs);
var finishedTweens = 0; var finishedTweens = 0;
@@ -48,13 +49,6 @@ Kinetic.Transition = function(node, config) {
* Transition methods * Transition methods
*/ */
Kinetic.Transition.prototype = { Kinetic.Transition.prototype = {
/**
* add tween to tweens array
* @param {Kinetic.Tween} tween
*/
add: function(tween) {
this.tweens.push(tween);
},
/** /**
* start transition * start transition
*/ */
@@ -63,14 +57,6 @@ Kinetic.Transition.prototype = {
this.tweens[n].start(); this.tweens[n].start();
} }
}, },
/**
* onEnterFrame
*/
onEnterFrame: function() {
for(var n = 0; n < this.tweens.length; n++) {
this.tweens[n].onEnterFrame();
}
},
/** /**
* stop transition * stop transition
*/ */
@@ -87,6 +73,14 @@ Kinetic.Transition.prototype = {
this.tweens[n].resume(); 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) { _getTween: function(key, prop, val) {
var config = this.config; var config = this.config;
var node = this.node; var node = this.node;

View File

@@ -1365,13 +1365,22 @@ Test.prototype.tests = {
radius: 70, radius: 70,
fill: 'red', fill: 'red',
stroke: 'black', stroke: 'black',
strokeWidth: 4 strokeWidth: 4,
//detectionType: 'pixel'
}); });
circle.draggable(true); circle.draggable(true);
/*
circle.on('dragend', function() {
circle.saveData();
});
*/
layer.add(circle); layer.add(circle);
stage.add(layer); stage.add(layer);
//circle.saveData();
}, },
'DRAG AND DROP - drag and drop stage': function(containerId) { 'DRAG AND DROP - drag and drop stage': function(containerId) {
var stage = new Kinetic.Stage({ var stage = new Kinetic.Stage({