setTexture(_:resize:)
Creates an action that changes a sprite’s texture, possibly resizing the sprite.
Declaration
class func setTexture(_ texture: SKTexture, resize: Bool) -> SKActionParameters
- texture:
The new texture to use on the sprite.
- resize:
If True, the sprite is resized to match the new texture. Otherwise, the size of the sprite is unchanged.
Return Value
A new action object.
Discussion
This action can only be executed by an SKSpriteNode object. When the action executes, the sprite’s texture property changes immediately to the new texture and the sprite is resized to match.
This action is not reversible; the reverse of this action does nothing.
See Also
Animating a Node’s Texture
resize(byWidth:height:duration:)resize(toHeight:duration:)resize(toWidth:duration:)resize(toWidth:height:duration:)setTexture(_:)animate(with:timePerFrame:)animate(with:timePerFrame:resize:restore:)setNormalTexture(_:)setNormalTexture(_:resize:)animate(withNormalTextures:timePerFrame:)animate(withNormalTextures:timePerFrame:resize:restore:)colorize(with:colorBlendFactor:duration:)colorize(withColorBlendFactor:duration:)