Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added setAttrs() method back in because I realized that it wasn't hur…

…ting performance that much
  • Loading branch information...
commit d0ebbc939a20c10201a6c6c8125837901c1b88d6 1 parent fb90709
@ericdrowell authored
View
2  dist/kinetic-Transition-current.min.js
@@ -1 +1 @@
-Kinetic.Transition=function(a,b){function d(a,b,e){for(var f in a)f!=="duration"&&f!=="easing"&&f!=="callback"&&(Kinetic.Type._isObject(a[f])?(e[f]={},d(a[f],b[f],e[f])):c._add(c._getTween(b,f,a[f],e)))}this.node=a,this.config=b,this.tweens=[];var c=this,e={};d(b,a.attrs,e);var f=0;for(var g=0;g<this.tweens.length;g++){var h=this.tweens[g];h.onFinished=function(){f++,f>=c.tweens.length&&c.onFinished()}}},Kinetic.Transition.prototype={start:function(){for(var a=0;a<this.tweens.length;a++)this.tweens[a].start()},stop:function(){for(var a=0;a<this.tweens.length;a++)this.tweens[a].stop()},resume:function(){for(var a=0;a<this.tweens.length;a++)this.tweens[a].resume()},_onEnterFrame:function(){for(var a=0;a<this.tweens.length;a++)this.tweens[a].onEnterFrame()},_add:function(a){this.tweens.push(a)},_getTween:function(a,b,c,d){var e=this.config,f=this.node,g=e.easing;g===undefined&&(g="linear");var h=new Kinetic.Tween(f,function(a){d[b]=a,f.attrs[b]=a},Kinetic.Tweens[g],a[b],c,e.duration);return h}},Kinetic.Node.prototype.transitionTo=function(a){this.transAnim||(this.transAnim=new Kinetic.Animation);var b=this.nodeType==="Stage"?this:this.getLayer(),c=this,d=new Kinetic.Transition(this,a);return this.transAnim.func=function(){d._onEnterFrame()},this.transAnim.node=b,d.onFinished=function(){c.transAnim.stop(),a.callback&&a.callback()},d.start(),this.transAnim.start(),d};
+Kinetic.Transition=function(a,b){function d(a,b,e,f){for(var g in a)g!=="duration"&&g!=="easing"&&g!=="callback"&&(Kinetic.Type._isObject(a[g])?(e[g]={},d(a[g],b[g],e[g],f)):c._add(c._getTween(b,g,a[g],e,f)))}this.node=a,this.config=b,this.tweens=[];var c=this,e={};d(b,a.attrs,e,e);var f=0;for(var g=0;g<this.tweens.length;g++){var h=this.tweens[g];h.onFinished=function(){f++,f>=c.tweens.length&&c.onFinished()}}},Kinetic.Transition.prototype={start:function(){for(var a=0;a<this.tweens.length;a++)this.tweens[a].start()},stop:function(){for(var a=0;a<this.tweens.length;a++)this.tweens[a].stop()},resume:function(){for(var a=0;a<this.tweens.length;a++)this.tweens[a].resume()},_onEnterFrame:function(){for(var a=0;a<this.tweens.length;a++)this.tweens[a].onEnterFrame()},_add:function(a){this.tweens.push(a)},_getTween:function(a,b,c,d,e){var f=this.config,g=this.node,h=f.easing;h===undefined&&(h="linear");var i=new Kinetic.Tween(g,function(a){d[b]=a,g.setAttrs(e)},Kinetic.Tweens[h],a[b],c,f.duration);return i}},Kinetic.Node.prototype.transitionTo=function(a){this.transAnim||(this.transAnim=new Kinetic.Animation);var b=this.nodeType==="Stage"?this:this.getLayer(),c=this,d=new Kinetic.Transition(this,a);return this.transAnim.func=function(){d._onEnterFrame()},this.transAnim.node=b,d.onFinished=function(){c.transAnim.stop(),a.callback&&a.callback()},d.start(),this.transAnim.start(),d};
View
14 dist/kinetic-current.js
@@ -2412,22 +2412,22 @@ Kinetic.Transition = function(node, config) {
var that = this;
// add tween for each property
- function addTween(c, attrs, obj) {
+ function addTween(c, attrs, obj, rootObj) {
for(var key in c) {
if(key !== 'duration' && key !== 'easing' && key !== 'callback') {
// if val is an object then traverse
if(Kinetic.Type._isObject(c[key])) {
obj[key] = {};
- addTween(c[key], attrs[key], obj[key]);
+ addTween(c[key], attrs[key], obj[key], rootObj);
}
else {
- that._add(that._getTween(attrs, key, c[key], obj));
+ that._add(that._getTween(attrs, key, c[key], obj, rootObj));
}
}
}
}
var obj = {};
- addTween(config, node.attrs, obj);
+ addTween(config, node.attrs, obj, obj);
var finishedTweens = 0;
for(var n = 0; n < this.tweens.length; n++) {
@@ -2482,7 +2482,7 @@ Kinetic.Transition.prototype = {
_add: function(tween) {
this.tweens.push(tween);
},
- _getTween: function(attrs, prop, val, obj) {
+ _getTween: function(attrs, prop, val, obj, rootObj) {
var config = this.config;
var node = this.node;
var easing = config.easing;
@@ -2492,7 +2492,7 @@ Kinetic.Transition.prototype = {
var tween = new Kinetic.Tween(node, function(i) {
obj[prop] = i;
- node.attrs[prop] = i;
+ node.setAttrs(rootObj);
}, Kinetic.Tweens[easing], attrs[prop], val, config.duration);
return tween;
@@ -2535,7 +2535,7 @@ Kinetic.Node.prototype.transitionTo = function(config) {
trans.onFinished = function() {
// remove animation
that.transAnim.stop();
-
+
// callback
if(config.callback) {
config.callback();
View
6 dist/kinetic-current.min.js
3 additions, 3 deletions not shown
View
14 src/Transition.js
@@ -11,22 +11,22 @@ Kinetic.Transition = function(node, config) {
var that = this;
// add tween for each property
- function addTween(c, attrs, obj) {
+ function addTween(c, attrs, obj, rootObj) {
for(var key in c) {
if(key !== 'duration' && key !== 'easing' && key !== 'callback') {
// if val is an object then traverse
if(Kinetic.Type._isObject(c[key])) {
obj[key] = {};
- addTween(c[key], attrs[key], obj[key]);
+ addTween(c[key], attrs[key], obj[key], rootObj);
}
else {
- that._add(that._getTween(attrs, key, c[key], obj));
+ that._add(that._getTween(attrs, key, c[key], obj, rootObj));
}
}
}
}
var obj = {};
- addTween(config, node.attrs, obj);
+ addTween(config, node.attrs, obj, obj);
var finishedTweens = 0;
for(var n = 0; n < this.tweens.length; n++) {
@@ -81,7 +81,7 @@ Kinetic.Transition.prototype = {
_add: function(tween) {
this.tweens.push(tween);
},
- _getTween: function(attrs, prop, val, obj) {
+ _getTween: function(attrs, prop, val, obj, rootObj) {
var config = this.config;
var node = this.node;
var easing = config.easing;
@@ -91,7 +91,7 @@ Kinetic.Transition.prototype = {
var tween = new Kinetic.Tween(node, function(i) {
obj[prop] = i;
- node.attrs[prop] = i;
+ node.setAttrs(rootObj);
}, Kinetic.Tweens[easing], attrs[prop], val, config.duration);
return tween;
@@ -134,7 +134,7 @@ Kinetic.Node.prototype.transitionTo = function(config) {
trans.onFinished = function() {
// remove animation
that.transAnim.stop();
-
+
// callback
if(config.callback) {
config.callback();
Please sign in to comment.
Something went wrong with that request. Please try again.