Skip to content

Commit

Permalink
Merge pull request #90 from seleb/bug/tween
Browse files Browse the repository at this point in the history
fix: tweens with `time: 0` treated as `time: 1000`
  • Loading branch information
lunafromthemoon authored Apr 6, 2022
2 parents 718b1ff + c5afdf5 commit 3f2755d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/managers/TweenManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ export default class TweenManager implements TweenManagerInterface {
this.game = game
}


tween(sprite: any, tweenables: {[key: string]: any}, callback: () => void, time: number | undefined, start: boolean, delay = 0, unskippable = false): RJSTween {
// if the tween has no duration, apply the changes immediately and abort
if (time <= 0) {
Object.entries(tweenables).forEach(([key, value]) => {
sprite[key] = value;
});
if (callback) {
callback.call(this);
}
return undefined;
}
const tween: RJSTween = this.game.add.tween(sprite);
tween.to(tweenables, time, Phaser.Easing.Linear.None,false, delay);
if (callback) {
Expand Down

0 comments on commit 3f2755d

Please sign in to comment.