Type Method

moveBy:duration:

Creates an action that moves a node relative to its current position.

Declaration

+ (SKAction *)moveBy:(CGVector)delta duration:(NSTimeInterval)duration;

Parameters

delta

A vector that describes the change to apply to the node’s position.

sec

The duration of the animation.

Return Value

A new action object.

Discussion

When the action executes, the node’s position property animates from its current position to its new position.

This action is reversible; the reverse is created as if the following code is executed:

CGVector negDelta = CGVectorMake(-delta.dx,-delta.dy);
[SKAction moveBy: negDelta duration: sec];

See Also

Animating a Node's Position in a Linear Path

+ moveByX:y:duration:

Creates an action that moves a node relative to its current position.

+ moveTo:duration:

Creates an action that moves a node to a new position.

+ moveToX:duration:

Creates an action that moves a node horizontally.

+ moveToY:duration:

Creates an action that moves a node vertically.