Use these functions to create actions.
Framework
- Sprite
Kit
Overview
Most actions implement specific predefined animations that are done for you by SpriteKit. If your animation needs fall outside of the suite provided here, then you should:
Consider using Creating Custom Actions (never subclass
SKAction
)Consider the advice in Drive Game Logic
Choose an Initializer for the Property You Want to Alter
Most actions allow you to change a node’s properties and some actions specifically apply to specific nodes, like SKSprite
's actions for animating its color or texture.
Here are the most common animated properties:
Changing a node’s
size
or scaling propertiesChanging a node’s visibility or making it translucent
Changing a sprite node’s contents so that it animates through a series of textures
Colorizing a sprite node
Playing sounds
Removing a node from the node tree
Calling a block
Invoking a selector on an object
See Action Initializers for a full list of action types.
Chaining Actions
Actions can be chained together in multiple ways:
A sequence action has multiple child actions. Each action in the sequence begins after the previous action ends.
A group action has multiple child actions. All actions stored in the group begin executing at the same time.
A repeating action stores a single child action. When the child action completes, it is restarted.
To delay a subsequent action in the chain, insert a wait
action in the sequence, and remember that groups, sequences, and repeating actions may be nested.