mirror of
https://github.com/konvajs/konva.git
synced 2025-04-29 23:37:24 +08:00
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:
parent
d5834c8351
commit
fc5825e61e
30
dist/kinetic-core.js
vendored
30
dist/kinetic-core.js
vendored
@ -79,13 +79,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();
|
||||
}
|
||||
@ -757,7 +756,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);
|
||||
|
||||
@ -2860,32 +2858,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);
|
||||
};
|
||||
|
||||
@ -3188,6 +3171,9 @@ 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;
|
||||
},
|
||||
};
|
||||
|
||||
|
4
dist/kinetic-core.min.js
vendored
4
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
},
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ function log(message) {
|
||||
* Test constructor
|
||||
*/
|
||||
function Test() {
|
||||
this.testOnly = 'TRANSITION - transition position and rotation';
|
||||
this.testOnly = '';
|
||||
this.counter = 0;
|
||||
}
|
||||
/**
|
||||
|
@ -1809,17 +1809,11 @@ Test.prototype.tests = {
|
||||
rect.x = amplitude * Math.sin(frame.time * 2 * Math.PI / period) + centerX;
|
||||
layer.draw();
|
||||
});
|
||||
test(stage.isAnimating === false, 'stage should not be animating');
|
||||
test(Kinetic.GlobalObject._isaCanvasAnimating() === false, 'global object should not be animating');
|
||||
// TODO: need to re-add support for stop
|
||||
|
||||
stage.start();
|
||||
|
||||
test(stage.isAnimating === true, 'stage should be animating');
|
||||
test(Kinetic.GlobalObject._isaCanvasAnimating() === true, 'global object should be animating');
|
||||
|
||||
stage.stop();
|
||||
|
||||
test(stage.isAnimating === false, 'stage should not be animating');
|
||||
test(Kinetic.GlobalObject._isaCanvasAnimating() === false, 'global object should not be animating');
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user