mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
Clamp the progress between 0 and 1
This commit is contained in:
parent
1ace8967cb
commit
3d9ac51338
1 changed files with 7 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
var BaseTweenData = require('./BaseTweenData');
|
||||
var Clamp = require('../../math/Clamp');
|
||||
var Class = require('../../utils/Class');
|
||||
var Events = require('../events');
|
||||
|
||||
|
@ -214,6 +215,7 @@ var TweenData = new Class({
|
|||
if (this.repeat === -1)
|
||||
{
|
||||
this.totalDuration += (t2 * 999999999999);
|
||||
tween.isInfinite = true;
|
||||
}
|
||||
else if (this.repeat > 0)
|
||||
{
|
||||
|
@ -347,8 +349,12 @@ var TweenData = new Class({
|
|||
elapsed = duration;
|
||||
complete = true;
|
||||
}
|
||||
else if (elapsed < 0)
|
||||
{
|
||||
elapsed = 0;
|
||||
}
|
||||
|
||||
var progress = elapsed / duration;
|
||||
var progress = Clamp(elapsed / duration, 0, 1);
|
||||
|
||||
this.elapsed = elapsed;
|
||||
this.progress = progress;
|
||||
|
|
Loading…
Reference in a new issue