rewrote Animation API to improve flexibility. Animations are no longer tied to the stage. You can now instantiate as many individual animations as you like, and manage them however you like

This commit is contained in:
Eric Rowell
2012-08-04 00:23:56 -07:00
parent 9ad9121259
commit b6db65301c
7 changed files with 155 additions and 190 deletions

View File

@@ -52,17 +52,23 @@ Test.prototype.tests = {
// in ms
var centerX = stage.getWidth() / 2 - 100 / 2;
stage.onFrame(function(frame) {
rect.attrs.x = amplitude * Math.sin(frame.time * 2 * Math.PI / period) + centerX;
layer.draw();
//console.log(frame.timeDiff)
var anim = new Kinetic.Animation({
func: function(frame) {
rect.attrs.x = amplitude * Math.sin(frame.time * 2 * Math.PI / period) + centerX;
layer.draw();
//console.log(frame.timeDiff)
}
});
stage.start();
anim.start();
setTimeout(function() {
//stage.stop();
}, 1000)
anim.stop();
}, 2000);
setTimeout(function() {
anim.start();
}, 4000);
},
'DRAWING - draw rect vs image from image data': function(containerId) {
var stage = new Kinetic.Stage({
@@ -220,7 +226,7 @@ Test.prototype.tests = {
}
});
},
'*PATH - add map path': function(containerId) {
'PATH - add map path': function(containerId) {
startTimer();
var stage = new Kinetic.Stage({
container: containerId,
@@ -262,10 +268,10 @@ Test.prototype.tests = {
stage.add(mapLayer);
endTimer('time build and to draw map');
mapLayer.beforeDraw(startTimer);
mapLayer.afterDraw(function() {
endTimer('redraw layer');
endTimer('redraw layer');
});
}
};