Contents

resize(toWidth:duration:)

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

Declaration

class func resize(toWidth width: CGFloat, duration: TimeInterval) -> SKAction

Parameters

  • width:

    The new width of the sprite.

  • duration:

    The duration of the animation.

Return Value

A new action object.

Discussion

This action can only be executed by an SKSpriteNode object. When the action executes, the sprite’s size property animates to its new value.

This action is not reversible; the reverse of this action has the same duration but does not change anything.

See Also

Animating a Node’s Texture