Type Method

customActionWithDuration:actionBlock:

Creates an action that executes a block periodically over a specified duration.

Declaration

+ (SCNAction *)customActionWithDuration:(NSTimeInterval)seconds actionBlock:(void (^)(SCNNode *node, CGFloat elapsedTime))block;

Parameters

seconds

The duration of the action, in seconds.

block

The block to run. The block takes the following parameters:

node

The node on which the action is running.

elapsedTime

The amount of time that has passed since the action began executing.

Return Value

A new action object.

Discussion

When the action executes, SceneKit calls the block repeatedly until the action’s duration expires. For each call, SceneKit computes the elapsed time and passes it to the block.

This action is not reversible; the reverse action executes the same block.

See Also

Creating Custom Actions

+ runBlock:

Creates an action that executes a block.

+ runBlock:queue:

Creates an action that executes a block on a specific dispatch queue.

+ javaScriptActionWithScript:duration:

Creates an action that executes a JavaScript script periodically over a specified duration.