Time an action in a scene, by adding or modifying timing properties, or cancel an action.
By default, an action with a duration applies its changes linearly over the duration you specify. However, you can adjust the timing of actions.
Add or Change Properties to Adjust the Timing of an Action
These options are available:
Use an action’s
timingproperty to choose a nonlinear timing mode for an animation. For example, you can have the action start quickly and then slow down over the remainder of the run (see
Create a custom timing function if you want finer control over an action's timing. See
Speed up or slow down an animation from its default timing using an action’s
speedproperty, which changes the rate at which an animation plays. A
1is the normal rate, but if you set an action’s speed property to, for example,
2, SpriteKit plays the animation twice as fast. To pause the action, set the
0. If you adjust the speed of an action that contains other actions (such as a group, sequence, or repeating action), the rate is applied to the actions contained within. The contained actions are also affected by their own speed property.
Because there are multiple rates involved in an animation's speed, SpriteKit finds all the rates that apply to the action and multiplies them to determine the final rate.
Cancel Actions that Should Be Stopped
To cancel actions that a node is running, call its
remove method. All actions are removed from the node immediately. If a removed action had a duration, any changes it already made to the node remain intact, but further changes are not executed.