Action
public final class Action
The Action class provides various animation types to be applied to nodes.
Any action applied to a Node will also be applied to any of it’s child nodes.
-
Undocumented
Declaration
Swift
public final class Action -
Undocumented
Declaration
Swift
public final class Action -
Undocumented
Declaration
Swift
public final class Action
-
Declaration
Swift
public static func moveTo(x: Float, y: Float, duration: Double, completion: ActionCompletion? = nil) -> ActionParameters
xThe x coordinate to move to.
yThe y coordinate to move to.
durationHow long it should take to move the node.
completionThe closure to be run when the action is over.
Return Value
A new instance of
Actionthat moves a node to a point. -
Declaration
Swift
public static func moveTo(to: CGPoint, duration: Double, completion: ActionCompletion? = nil) -> ActionParameters
toThe point to move to.
durationHow long it should take to move the node.
completionThe closure to be run when the action is over.
Return Value
A new instance of
Actionthat moves a node to a point. -
Move a
Nodeby a relative amount from it’s current position.This will update the
positionproperty of aNode.Declaration
Swift
public static func moveBy(x: Float, y: Float, duration: Double, completion: ActionCompletion? = nil) -> ActionParameters
xThe amount in the x direction to move by.
yThe amount in the y direction to move by.
durationHow long it should take to move the node.
completionThe closure to be run when the action is over.
Return Value
A new instance of
Actionthat moves a node by a given amount. -
Rotate a
Nodeby given amount relative to it’s current rotation.This will update the
rotationproperty of aNode.Declaration
Swift
public static func rotateBy(degrees: Float, duration: Double, completion: ActionCompletion? = nil) -> ActionParameters
degreesThe amount to rotate in degrees.
durationHow long it should take to rotate by the given amount.
completionA closure to be run when the action is over.
Return Value
A new instance of
Actionthat rotates a node by a given amount. -
Scale a
Nodeto a certain size along the x and y axes.This will update the
scaleproperty of aNode.Declaration
Swift
public static func scaleTo(x: Float, y: Float, duration: Double, completion: ActionCompletion? = nil) -> ActionParameters
xThe amount to scale in the x direction.
yThe amount to scale in the y direction.
durationHow long it should take to scale.
completionA closure to be run when the action is over.
Return Value
A new instance of
Actionthat scales a node to a given amount. -
Uniformly scale a
Nodeby a given amount relative to it’s current scale.This will update the
scaleproperty of aNode.Declaration
Swift
public static func scaleBy(scale: Float, duration: Double, completion: ActionCompletion? = nil) -> ActionParameters
scaleThe amount to scale by.
durationHow long it should take to scale.
completionA closure to be run when the action is over.
Return Value
A new instance of
Actionthat scales a node by a given amount. -
Scale a
Nodein the x and y direction by a given amount relative to it’s current scale.This will update the
scaleproperty of aNode.Declaration
Swift
public static func scaleBy(x: Float, y: Float, duration: Double, completion: ActionCompletion? = nil) -> ActionParameters
xThe amount to scale in the x direction.
yThe amount to scale in the y direction.
durationHow long it should take to scale.
completionA closure to be run when the action is over.
Return Value
A new instance of
Actionthat scales a node by a given amount. -
Construct an
Actionthat is a series of other actions that run when the previous action has finished, ie, in a sequence.Declaration
Swift
public static func sequence(sequence: Actions, completion: ActionCompletion? = nil) -> ActionParameters
sequenceThe actions to be performed in the given order.
completionA closure to be run when ALL of the actions are completed.
-
A group of
Actions are actions that will run in parallel.Declaration
Swift
public static func group(group: Actions, completion: ActionCompletion? = nil) -> ActionParameters
groupThe
Actions to be run at the same time.completionThe closure to be run when the last action has completed.
-
Repeat the same action forever.
Declaration
Swift
public static func repeatForever(action: Action) -> ActionParameters
actionThe
Actionto be repeated forever.Return Value
A new instance of
Actionthat will run forever.
Action Class Reference