Playground.js is a framework for your javascript based games. It gives you out-of-box access to essentials like mouse, keyboard, sound and well designed architecture that you can expand to your needs.
Creates a new instance of a tween. You can have multiple concurent tweens. So how to stop a tween before running another one?
Method 1
Save reference to a tween and stop it before calling another one.
var current = app.tween(turtle).to({ x: 100, y: 200 }).loop();
/* later in the code you want to call another tween */
current.stop();
app.tween(turtle).to(...);
Method 2
Use .discard() to kill all other tweens attached to the object.
app.tween(turtle).to({ x: 100, y: 200}).loop();
/* later in the code */
app.tween(turtle).discard().to({ x: 200, y: 300}).loop();
/* discard() killed all previous tweens */
First of all
app.tween(object)
Creates a new instance of a tween. You can have multiple concurent tweens. So how to stop a tween before running another one?
Method 1
Save reference to a tween and stop it before calling another one.
Method 2
Use
.discard()
to kill all other tweens attached to the object.