phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
36.93k stars 7.08k forks source link

Setting loop=false to tween, results into infinite repeat #1443

Closed netgfx closed 9 years ago

netgfx commented 9 years ago

While this is correct: var tween = game.add.tween(item).to({width:100}, duration, Phaser.Easing.Linear.None, true, 0, 0);

When writing it like this: var tween = game.add.tween(item).to(obj, duration, Phaser.Easing.Linear.None, true, 0, false);

results in infinite looping.

photonstorm commented 9 years ago

You've missed out the repeat parameter. It comes before yoyo (or loop).

The second line of code is basically setting a boolean into what should be an integer.

netgfx commented 9 years ago

so it should be to(obj, duration, Phaser.Easing.Linear.None, true, 0, 0, false); So since I had it wrong instead of some error or warning it just kept on doing yoyo, is that intentional?

photonstorm commented 9 years ago

A repeat value of -1 means "repeat forever". Whatever you'd done, it thought you had passed that. Give it a number and it'll be fine.

photonstorm commented 4 years ago

@Firanolfind questions like this are best directed to the forum or Discord, especially as this closed issue is 5 years old! You're lucky I even saw your message. In Phaser 3, repeat is set on a tween property, where-as loop is for the entire tween. A Tween that was updating say 3 different properties could have a different repeat value per property, but the loop value would loop the entire tween over again, not a specific property. They work together.