Scene

shifty. Scene

new Scene(…tweenables)

The shifty.Scene class provides a way to control groups of shifty.Tweenables. It is lightweight, minimalistic, and meant to provide performant shifty.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 shifty.Scene does not perform any automatic cleanup. If you want to remove a shifty.Tweenable from a shifty.Scene, you must do so explicitly with either shifty.Scene#remove or shifty.Scene#empty.

See the Pen Shifty Scene Demo by Jeremy Kahn (@jeremyckahn) on CodePen.

Source:
See:
Parameters:
Name Type Attributes Description
tweenables shifty.Tweenable <repeatable>

Members

(readonly) promises :Array.<external:Promise>

The external:Promises for all shifty.Tweenables in this shifty.Scene that have been configured with shifty.Tweenable#setConfig. Note that each call of shifty.Scene#play or shifty.Scene#pause creates new external:Promises:

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()
);
Source:
Type:

(readonly) tweenables :Array.<shifty.Tweenable>

A copy of the internal shifty.Tweenables array.

Source:
Type:

Methods

add(tweenable) → {shifty.Tweenable}

Add a shifty.Tweenable to be controlled by this shifty.Scene.

Source:
Parameters:
Name Type Description
tweenable shifty.Tweenable
Returns:
Type:
shifty.Tweenable

The shifty.Tweenable that was added.

empty() → {Array.<shifty.Tweenable>}

Source:
Returns:
Type:
Array.<shifty.Tweenable>

The shifty.Tweenables that were removed.

isPlaying() → {boolean}

Is true if any shifty.Tweenable in this shifty.Scene is playing.

Source:
Returns:
Type:
boolean

pause() → {shifty.Scene}

Source:
Returns:
Type:
shifty.Scene

play() → {shifty.Scene}

Play all shifty.Tweenables from their beginning.

Source:
Returns:
Type:
shifty.Scene

remove(tweenable) → {shifty.Tweenable}

Remove a shifty.Tweenable that is controlled by this shifty.Scene.

Source:
Parameters:
Name Type Description
tweenable shifty.Tweenable
Returns:
Type:
shifty.Tweenable

The shifty.Tweenable that was removed.

resume() → {shifty.Scene}

Source:
Returns:
Type:
shifty.Scene

stop(gotoEndopt) → {shifty.Scene}

Source:
Parameters:
Name Type Attributes Description
gotoEnd boolean <optional>
Returns:
Type:
shifty.Scene