got the unit tests and functional tests passing. Have a few things left to do, and a bit more testing before I merge the transitions rewrite back into the trunk

This commit is contained in:
Eric Rowell
2012-04-02 23:38:14 -07:00
parent d5834c8351
commit fc5825e61e
7 changed files with 23 additions and 54 deletions

View File

@@ -51,13 +51,12 @@ Kinetic.GlobalObject = {
var draws = {};
for(var n = 0; n < this.animations.length; n++) {
var anim = this.animations[n];
draws[anim.drawId] = anim.draw;
if(anim.drawId) {
draws[anim.drawId] = anim.draw;
}
anim.func(this.frame);
}
/*
* draw all necessary layers or stages
*/
for(var key in draws) {
draws[key].draw();
}

View File

@@ -622,7 +622,6 @@ Kinetic.Node.prototype = {
if(config[key][prop] !== undefined) {
var id = go.animIdCounter++;
var tween = new Kinetic.Transition(that, function(i) {
console.log(prop);
that[key][prop] = i;
}, Kinetic.Transitions[easing], that[key][prop], config[key][prop], config.duration);

View File

@@ -1,3 +1,6 @@
/*
* This class was ported from a Flash Tween library to JavaScript by Xaric.
*/
Kinetic.Transition = function(obj, propFunc, func, begin, finish, duration) {
this._listeners = [];
this.addListener(this);
@@ -6,32 +9,17 @@ Kinetic.Transition = function(obj, propFunc, func, begin, finish, duration) {
this.begin = begin;
this._pos = begin;
this.setDuration(duration);
this.isPlaying = false;
this._change = 0;
this.prevTime = 0;
this.prevPos = 0;
this.looping = false;
this._time = 0;
this._position = 0;
this._startTime = 0;
this._finish = 0;
this.name = '';
//set the tweening function
if(func !== null && func !== '') {
this.func = func;
}
else {
this.func = function(t, b, c, d) {
return c * t / d + b;
};
}
this.func = func;
this.setFinish(finish);
};
@@ -334,5 +322,8 @@ Kinetic.Transitions = {
return c / 2 * t * t * t * t * t + b;
}
return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
}
},
'linear': function(t, b, c, d) {
return c * t / d + b;
},
};