Type Method

animateWithNormalTextures:timePerFrame:

Creates an action that animates changes to a sprite’s normal texture.

Declaration

+ (SKAction *)animateWithNormalTextures:(NSArray<SKTexture *> *)textures timePerFrame:(NSTimeInterval)sec;

Parameters

textures

An array of textures to use.

sec

The amount of time that each texture is displayed.

Return Value

A new action object.

Discussion

This action can only be executed by an SKSpriteNode object. When the action executes, the sprite’s normalTexture property animates through the array of textures. The sprite’s normalTexture property is changed to the next texture in the array. The action then pauses for the specified time before continuing. The action continues until it has finished animating through all of the textures in the array. The total duration of the action is the number of textures multiplied by the frame interval.

This action is reversible; the resulting action animates through the same textures from last to first.

See Also

Animating a Node's Texture

+ resizeByWidth:height:duration:

Creates an action that adjusts the size of a sprite.

+ resizeToHeight:duration:

Creates an action that changes the height of a sprite to a new absolute value.

+ resizeToWidth:duration:

Creates an action that changes the width of a sprite to a new absolute value.

+ resizeToWidth:height:duration:

Creates an action that changes the width and height of a sprite to a new absolute value.

+ setTexture:

Creates an action that changes a sprite’s texture.

+ setTexture:resize:

Creates an action that changes a sprite’s texture, possibly resizing the sprite.

+ animateWithTextures:timePerFrame:

Creates an action that animates changes to a sprite’s texture.

+ animateWithTextures:timePerFrame:resize:restore:

Creates an action that animates changes to a sprite’s texture, possibly resizing the sprite.

+ setNormalTexture:

Creates an action that changes a sprite’s normal texture.

+ setNormalTexture:resize:

Creates an action that changes a sprite’s normal texture, possibly resizing the sprite.

+ animateWithNormalTextures:timePerFrame:resize:restore:

Creates an action that animates changes to a sprite’s texture.

+ colorizeWithColor:colorBlendFactor:duration:

Creates an animation that animates a sprite’s color and blend factor.

+ colorizeWithColorBlendFactor:duration:

Creates an action that animates a sprite’s blend factor.