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) -> Action
Parameters
x
The x coordinate to move to.
y
The y coordinate to move to.
duration
How long it should take to move the node.
completion
The closure to be run when the action is over.
Return Value
A new instance of
Action
that moves a node to a point. -
Declaration
Swift
public static func moveTo(to: CGPoint, duration: Double, completion: ActionCompletion? = nil) -> Action
Parameters
to
The point to move to.
duration
How long it should take to move the node.
completion
The closure to be run when the action is over.
Return Value
A new instance of
Action
that moves a node to a point. -
Move a
Node
by a relative amount from it’s current position.This will update the
position
property of aNode
.Declaration
Swift
public static func moveBy(x: Float, y: Float, duration: Double, completion: ActionCompletion? = nil) -> Action
Parameters
x
The amount in the x direction to move by.
y
The amount in the y direction to move by.
duration
How long it should take to move the node.
completion
The closure to be run when the action is over.
Return Value
A new instance of
Action
that moves a node by a given amount. -
Rotate a
Node
by given amount relative to it’s current rotation.This will update the
rotation
property of aNode
.Declaration
Swift
public static func rotateBy(degrees: Float, duration: Double, completion: ActionCompletion? = nil) -> Action
Parameters
degrees
The amount to rotate in degrees.
duration
How long it should take to rotate by the given amount.
completion
A closure to be run when the action is over.
Return Value
A new instance of
Action
that rotates a node by a given amount. -
Scale a
Node
to a certain size along the x and y axes.This will update the
scale
property of aNode
.Declaration
Swift
public static func scaleTo(x: Float, y: Float, duration: Double, completion: ActionCompletion? = nil) -> Action
Parameters
x
The amount to scale in the x direction.
y
The amount to scale in the y direction.
duration
How long it should take to scale.
completion
A closure to be run when the action is over.
Return Value
A new instance of
Action
that scales a node to a given amount. -
Uniformly scale a
Node
by a given amount relative to it’s current scale.This will update the
scale
property of aNode
.Declaration
Swift
public static func scaleBy(scale: Float, duration: Double, completion: ActionCompletion? = nil) -> Action
Parameters
scale
The amount to scale by.
duration
How long it should take to scale.
completion
A closure to be run when the action is over.
Return Value
A new instance of
Action
that scales a node by a given amount. -
Scale a
Node
in the x and y direction by a given amount relative to it’s current scale.This will update the
scale
property of aNode
.Declaration
Swift
public static func scaleBy(x: Float, y: Float, duration: Double, completion: ActionCompletion? = nil) -> Action
Parameters
x
The amount to scale in the x direction.
y
The amount to scale in the y direction.
duration
How long it should take to scale.
completion
A closure to be run when the action is over.
Return Value
A new instance of
Action
that scales a node by a given amount. -
Construct an
Action
that 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) -> Action
Parameters
sequence
The actions to be performed in the given order.
completion
A closure to be run when ALL of the actions are completed.
-
A group of
Action
s are actions that will run in parallel.Declaration
Swift
public static func group(group: Actions, completion: ActionCompletion? = nil) -> Action
Parameters
group
The
Action
s to be run at the same time.completion
The closure to be run when the last action has completed.
-
Repeat the same action forever.
Declaration
Swift
public static func repeatForever(action: Action) -> Action
Parameters
action
The
Action
to be repeated forever.Return Value
A new instance of
Action
that will run forever.