mirror of
https://github.com/konvajs/konva.git
synced 2026-01-09 11:34:38 +08:00
greatly improved sprite animation performance by hooking into the global animation object
This commit is contained in:
@@ -26,12 +26,22 @@ Kinetic.Animation = {
|
||||
},
|
||||
_runFrames: function() {
|
||||
var nodes = {};
|
||||
/*
|
||||
* loop through all animations and execute animation
|
||||
* function. if the animation object has specified node,
|
||||
* we can add the node to the nodes hash to eliminate
|
||||
* drawing the same node multiple times. The node property
|
||||
* can be the stage itself or a layer
|
||||
*/
|
||||
for(var n = 0; n < this.animations.length; n++) {
|
||||
var anim = this.animations[n];
|
||||
if(anim.node && anim.node._id !== undefined) {
|
||||
nodes[anim.node._id] = anim.node;
|
||||
}
|
||||
anim.func(this.frame);
|
||||
// if animation object has a function, execute it
|
||||
if(anim.func) {
|
||||
anim.func(this.frame);
|
||||
}
|
||||
}
|
||||
|
||||
for(var key in nodes) {
|
||||
|
||||
Reference in New Issue
Block a user