mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
added new animation stop logic
This commit is contained in:
14
src/Stage.js
14
src/Stage.js
@@ -54,6 +54,8 @@ Kinetic.Stage = function(config) {
|
||||
this._listen();
|
||||
this._prepareDrag();
|
||||
|
||||
this.anim = undefined;
|
||||
|
||||
// add stage to global object
|
||||
Kinetic.GlobalObject.stages.push(this);
|
||||
|
||||
@@ -71,22 +73,26 @@ Kinetic.Stage.prototype = {
|
||||
*/
|
||||
onFrame: function(func) {
|
||||
var go = Kinetic.GlobalObject;
|
||||
go.addAnimation({
|
||||
this.anim = {
|
||||
id: go.animIdCounter++,
|
||||
func: func
|
||||
});
|
||||
};
|
||||
},
|
||||
/**
|
||||
* start animation
|
||||
*/
|
||||
start: function() {
|
||||
Kinetic.GlobalObject._handleAnimation();
|
||||
var go = Kinetic.GlobalObject;
|
||||
go.addAnimation(this.anim);
|
||||
go._handleAnimation();
|
||||
},
|
||||
/**
|
||||
* stop animation
|
||||
*/
|
||||
stop: function() {
|
||||
Kinetic.GlobalObject._handleAnimation();
|
||||
var go = Kinetic.GlobalObject;
|
||||
go.removeAnimation(this.anim.id);
|
||||
go._handleAnimation();
|
||||
},
|
||||
/**
|
||||
* draw children
|
||||
|
Reference in New Issue
Block a user