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()
);
Type:
- 
            
Array.<external:Promise> 
(readonly) tweenables :Array.<shifty.Tweenable>
A copy of the internal shifty.Tweenables array.
Type:
- 
            
Array.<shifty.Tweenable> 
Methods
add(tweenable) → {shifty.Tweenable}
Add a shifty.Tweenable to be controlled by this shifty.Scene.
Parameters:
| Name | Type | Description | 
|---|---|---|
tweenable | 
            
            
            
                
shifty.Tweenable
            
             | 
            
            
            
empty() → {Array.<shifty.Tweenable>}
Remove all shifty.Tweenables in this shifty.Scene.
isPlaying() → {boolean}
Is true if any shifty.Tweenable in this shifty.Scene is
playing.
Returns:
- Type:
 - 
        
boolean 
pause() → {shifty.Scene}
shifty.Tweenable#pause all shifty.Tweenables in this
shifty.Scene.
Returns:
- Type:
 - 
        
shifty.Scene 
play() → {shifty.Scene}
Play all shifty.Tweenables from their beginning.
Returns:
- Type:
 - 
        
shifty.Scene 
remove(tweenable) → {shifty.Tweenable}
Remove a shifty.Tweenable that is controlled by this shifty.Scene.
Parameters:
| Name | Type | Description | 
|---|---|---|
tweenable | 
            
            
            
                
shifty.Tweenable
            
             | 
            
            
            
resume() → {shifty.Scene}
shifty.Tweenable#resume all paused shifty.Tweenables.
Returns:
- Type:
 - 
        
shifty.Scene 
stop(gotoEndopt) → {shifty.Scene}
shifty.Tweenable#stop all shifty.Tweenables in this shifty.Scene.
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
gotoEnd | 
            
            
            
                
boolean
            
             | 
            
                
                
                    <optional> | 
            
            
            
Returns:
- Type:
 - 
        
shifty.Scene