mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
Optimized TweenData.update
to achieve the same result with my less repetition. Also fixes an issue where a Tween that used a custom ease
callback would glitch when the final value was set, as it would be set outside of the ease callback. It's now passed through it, no matter what. Fix #6939
This commit is contained in:
parent
ec42bd5aba
commit
f9d1b4d5cf
1 changed files with 18 additions and 28 deletions
|
@ -305,36 +305,6 @@ var TweenData = new Class({
|
|||
this.progress = progress;
|
||||
this.previous = this.current;
|
||||
|
||||
if (complete)
|
||||
{
|
||||
if (forward)
|
||||
{
|
||||
this.current = this.end;
|
||||
|
||||
target[key] = this.end;
|
||||
|
||||
if (this.hold > 0)
|
||||
{
|
||||
this.elapsed = this.hold;
|
||||
|
||||
this.setHoldState();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setStateFromEnd(diff);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.current = this.start;
|
||||
|
||||
target[key] = this.start;
|
||||
|
||||
this.setStateFromStart(diff);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!forward)
|
||||
{
|
||||
progress = 1 - progress;
|
||||
|
@ -352,6 +322,26 @@ var TweenData = new Class({
|
|||
}
|
||||
|
||||
target[key] = this.current;
|
||||
|
||||
if (complete)
|
||||
{
|
||||
if (forward)
|
||||
{
|
||||
if (this.hold > 0)
|
||||
{
|
||||
this.elapsed = this.hold;
|
||||
|
||||
this.setHoldState();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setStateFromEnd(diff);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setStateFromStart(diff);
|
||||
}
|
||||
}
|
||||
|
||||
this.dispatchEvent(Events.TWEEN_UPDATE, 'onUpdate');
|
||||
|
|
Loading…
Reference in a new issue