fixed transition bug related to frame.timeDiff

This commit is contained in:
Eric Rowell 2012-03-19 19:39:41 -07:00
parent 70fe63b2b6
commit 588b65a849
4 changed files with 52 additions and 18 deletions

View File

@ -3,7 +3,7 @@
* http://www.kineticjs.com/
* Copyright 2012, Eric Rowell
* Licensed under the MIT or GPL Version 2 licenses.
* Date: Mar 18 2012
* Date: Mar 19 2012
*
* Copyright (C) 2011 - 2012 by Eric Rowell
*
@ -75,6 +75,8 @@ Kinetic.GlobalObject = {
}
}
}
this.frame.lastTime = 0;
return false;
},
_endTransition: function() {
@ -196,9 +198,6 @@ Kinetic.GlobalObject = {
if(this._isaCanvasAnimating()) {
that._animationLoop();
}
else {
this.frame.lastTime = 0;
}
}
};

File diff suppressed because one or more lines are too long

View File

@ -47,6 +47,8 @@ Kinetic.GlobalObject = {
}
}
}
this.frame.lastTime = 0;
return false;
},
_endTransition: function() {
@ -168,9 +170,6 @@ Kinetic.GlobalObject = {
if(this._isaCanvasAnimating()) {
that._animationLoop();
}
else {
this.frame.lastTime = 0;
}
}
};

View File

@ -76,11 +76,52 @@ Test.prototype.tests = {
});
stage.start();
setTimeout(function() {
stage.stop();
stage.stop();
}, 1000);
},
'TRANSITION - hover transition': function(containerId) {
var stage = new Kinetic.Stage(containerId, 578, 200);
var layer = new Kinetic.Layer();
var rect = new Kinetic.Rect({
x: stage.width / 2 - 50,
y: stage.height / 2 - 25,
width: 100,
height: 50,
fill: 'green',
stroke: 'black',
strokeWidth: 4,
centerOffset: {
x: 50,
y: 25
}
});
rect.on("mouseover", function() {
this.transitionTo({
scale: {
x: 1.3,
y: 1.3
},
duration: 0.3
});
});
rect.on("mouseout", function() {
this.transitionTo({
scale: {
x: 1,
y: 1
},
duration: 0.3
});
});
layer.add(rect);
stage.add(layer);
},
'EVENTS - mousedown mouseup mouseover mouseout click dblclick / touchstart touchend dbltap': function(containerId) {
var stage = new Kinetic.Stage(containerId, 578, 200);
var layer = new Kinetic.Layer();
@ -467,13 +508,10 @@ Test.prototype.tests = {
var layer = new Kinetic.Layer();
var group = new Kinetic.Group();
group.on('click', function() {
log('click group');
//console.log(this);
});
var redCircle = new Kinetic.Circle({
x: stage.width / 2,
y: stage.height / 2,
@ -509,7 +547,6 @@ Test.prototype.tests = {
log('mousemove group');
//console.log(this);
});
var redCircle = new Kinetic.Circle({
x: stage.width / 2,
y: stage.height / 2,
@ -538,17 +575,16 @@ Test.prototype.tests = {
var stage = new Kinetic.Stage(containerId, 578, 200);
var layer = new Kinetic.Layer();
var group = new Kinetic.Group({
name: 'group'
name: 'group'
});
group.on('mouseover', function() {
log('mouseover group');
});
group.on('mouseout', function() {
log('mouseout group');
});
var redCircle = new Kinetic.Circle({
x: stage.width / 2,
y: stage.height / 2,