new Scene(…tweenables)
The Scene
class provides a way to control groups of Tweenable
s. It is lightweight, minimalistic, and meant to provide
performant Tweenable
batch control that users of Shifty
might otherwise have to implement themselves. It is not a robust
timeline solution, and it does not provide utilities for sophisticated
animation sequencing or orchestration. If that is what you need for your
project, consider using a more robust tool such as
Rekapi (a timeline layer built
on top of Shifty).
Please be aware that Scene
does not perform any
automatic cleanup. If you want to remove a Tweenable
from a
Scene
, you must do so explicitly with either Scene#remove
or Scene#empty
.
See the Pen Shifty Scene Demo by Jeremy Kahn (@jeremyckahn) on CodePen.
- Source:
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tweenables |
Tweenable
|
<repeatable> |
Members
playingTweenables :Array.<Tweenable>
A list of Tweenable
s in the scene that have not yet ended (playing
or not).
Type:
-
Array.<Tweenable>
promises :Array.<Promise.<any>>
The external:Promise
s for all Tweenable
s in this
Scene
that have been configured with Tweenable#setConfig
. Note that each call of Scene#play
or Scene#pause
creates new external:Promise
s:
const scene = new Scene(new Tweenable());
scene.play();
Promise.all(scene.promises).then(() =>
// Plays the scene again upon completion, but a new promise is
// created so this line only runs once.
scene.play()
);
Type:
-
Array.<Promise.<any>>
Methods
empty() → {Array.<Tweenable>}
isPlaying() → {boolean}
Returns:
- Type:
-
boolean