mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 00:14:29 +08:00
added new animation stop logic
This commit is contained in:
parent
fc5825e61e
commit
a6b526ee76
19
dist/kinetic-core.js
vendored
19
dist/kinetic-core.js
vendored
@ -3,7 +3,7 @@
|
|||||||
* http://www.kineticjs.com/
|
* http://www.kineticjs.com/
|
||||||
* Copyright 2012, Eric Rowell
|
* Copyright 2012, Eric Rowell
|
||||||
* Licensed under the MIT or GPL Version 2 licenses.
|
* Licensed under the MIT or GPL Version 2 licenses.
|
||||||
* Date: Apr 02 2012
|
* Date: Apr 03 2012
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 - 2012 by Eric Rowell
|
* Copyright (C) 2011 - 2012 by Eric Rowell
|
||||||
*
|
*
|
||||||
@ -1015,6 +1015,8 @@ Kinetic.Stage = function(config) {
|
|||||||
this._listen();
|
this._listen();
|
||||||
this._prepareDrag();
|
this._prepareDrag();
|
||||||
|
|
||||||
|
this.anim = undefined;
|
||||||
|
|
||||||
// add stage to global object
|
// add stage to global object
|
||||||
Kinetic.GlobalObject.stages.push(this);
|
Kinetic.GlobalObject.stages.push(this);
|
||||||
|
|
||||||
@ -1032,22 +1034,26 @@ Kinetic.Stage.prototype = {
|
|||||||
*/
|
*/
|
||||||
onFrame: function(func) {
|
onFrame: function(func) {
|
||||||
var go = Kinetic.GlobalObject;
|
var go = Kinetic.GlobalObject;
|
||||||
go.addAnimation({
|
this.anim = {
|
||||||
id: go.animIdCounter++,
|
id: go.animIdCounter++,
|
||||||
func: func
|
func: func
|
||||||
});
|
};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* start animation
|
* start animation
|
||||||
*/
|
*/
|
||||||
start: function() {
|
start: function() {
|
||||||
Kinetic.GlobalObject._handleAnimation();
|
var go = Kinetic.GlobalObject;
|
||||||
|
go.addAnimation(this.anim);
|
||||||
|
go._handleAnimation();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* stop animation
|
* stop animation
|
||||||
*/
|
*/
|
||||||
stop: function() {
|
stop: function() {
|
||||||
Kinetic.GlobalObject._handleAnimation();
|
var go = Kinetic.GlobalObject;
|
||||||
|
go.removeAnimation(this.anim.id);
|
||||||
|
go._handleAnimation();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* draw children
|
* draw children
|
||||||
@ -2850,6 +2856,9 @@ Kinetic.Transform.prototype = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This class was ported from a Flash Tween library to JavaScript by Xaric.
|
||||||
|
*/
|
||||||
Kinetic.Transition = function(obj, propFunc, func, begin, finish, duration) {
|
Kinetic.Transition = function(obj, propFunc, func, begin, finish, duration) {
|
||||||
this._listeners = [];
|
this._listeners = [];
|
||||||
this.addListener(this);
|
this.addListener(this);
|
||||||
|
14
src/Stage.js
14
src/Stage.js
@ -54,6 +54,8 @@ Kinetic.Stage = function(config) {
|
|||||||
this._listen();
|
this._listen();
|
||||||
this._prepareDrag();
|
this._prepareDrag();
|
||||||
|
|
||||||
|
this.anim = undefined;
|
||||||
|
|
||||||
// add stage to global object
|
// add stage to global object
|
||||||
Kinetic.GlobalObject.stages.push(this);
|
Kinetic.GlobalObject.stages.push(this);
|
||||||
|
|
||||||
@ -71,22 +73,26 @@ Kinetic.Stage.prototype = {
|
|||||||
*/
|
*/
|
||||||
onFrame: function(func) {
|
onFrame: function(func) {
|
||||||
var go = Kinetic.GlobalObject;
|
var go = Kinetic.GlobalObject;
|
||||||
go.addAnimation({
|
this.anim = {
|
||||||
id: go.animIdCounter++,
|
id: go.animIdCounter++,
|
||||||
func: func
|
func: func
|
||||||
});
|
};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* start animation
|
* start animation
|
||||||
*/
|
*/
|
||||||
start: function() {
|
start: function() {
|
||||||
Kinetic.GlobalObject._handleAnimation();
|
var go = Kinetic.GlobalObject;
|
||||||
|
go.addAnimation(this.anim);
|
||||||
|
go._handleAnimation();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* stop animation
|
* stop animation
|
||||||
*/
|
*/
|
||||||
stop: function() {
|
stop: function() {
|
||||||
Kinetic.GlobalObject._handleAnimation();
|
var go = Kinetic.GlobalObject;
|
||||||
|
go.removeAnimation(this.anim.id);
|
||||||
|
go._handleAnimation();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* draw children
|
* draw children
|
||||||
|
Loading…
Reference in New Issue
Block a user