AppleSCNAction - UBogun/Xojo-iosLib GitHub Wiki

Inherits from AppleObject
Memory leak check: not yet done.
Status: completed.

An SCNAction object is an action that is executed by a node (SCNNode). You use actions most often to change the structure and content of the node to which they are attached, but you can also use actions make other changes to the scene. In SceneKit, actions provide an easy way to implement animated behaviors that frequently change in response to user input.

Please note that AppleSCNAction has only constructors as class (shared) methods. The way to invoke a SCNAction is to use one of the AppleSCNNode’s RunAction methods, like
myNode.RunAction AppleSCNAction.ScaleBy (0.3, 5.0)

Constructors

There is no usual constructor. All constructors are built as class methods. Duration is always a Double meaning the time in seconds:

CustomAction (Block as AppleBlock, duration as double): Creates an action that executes a block periodically over a specified duration. See the CustomActionBlockTemplate method for the block structure.

FadeBy (Opacity as double, Duration as Double): Creates an action that adjusts the opacity of a node by a relative value.

FadeIn (Duration as Double): Creates an action that changes the opacity of the node to 1.0.

FadeOut (Duration as Double): Creates an action that changes the opacity of the node to 0.0.

FadeTo (Opacity as double, Duration as Double): Creates an action that adjusts the opacity of a node to a new value.

Group (GroupArray As AppleArray / ParamArray of AppleSCNAction): Creates an action that runs a collection of actions in parallel.

Hide(): Creates an action that hides a node. Available in iOS 9.0 and later.

JavaScriptAction (JavaScript As Text, Duration As Double): Creates an action that executes a JavaScript script periodically over a specified duration.

MoveBy (Delta as SCNVector3, Duration as Double): Creates an action that moves a node relative to its current position.

MoveBy (DeltaX as Double, DeltaY as Double, DeltaZ aS Double, Duration as Double): Creates an action that moves a node relative to its current position.

MoveTo (Location as SCNVector3, Duration as Double): Creates an action that moves a node to a new position.

PlayAudioSource (AudioSource as AppleSCNAudioSource, WaitForCompletion As Boolean = false): Creates an action that plays an audio source and returns either immediately or after the sound has finished.

RemoveFromParentNode(): Creates an action that removes the node from its parent.

Repeat (Action as AppleSCNAction, count as UInteger): Creates an action that repeats another action a specified number of times.

RepeatForever (Action as AppleSCNAction): Creates an action that repeats another action forever.

RotateBy (Angle as Double, AroundAxis As SCNVector3, Duration as Double): Creates an action that rotates the node by an angle around a specified axis.

RotateBy (DeltaX as Double, DeltaY as Double, DeltaZ aS Double, Duration as Double): Creates an action that rotates the node in each of the three principal axes by angles relative to its current orientation.

RotateTo (AxisAngle as SCNVector4, Duration as Double): Creates an action that rotates the node to an absolute angle around a specified axis.

RotateTo (X as Double, Y as Double, Z aS Double, Duration as Double, shortestUnitArc as Boolean = false): Creates an action that rotates the node to absolute angles in each of the three principal axes.
If shortestUnitArc is False (the default), the animation interpolates each component of the node’s rotation between its current value and the new value. If True, the animation makes the most direct rotation possible from the node’s current orientation to the new orientation.

RunBlock (Block As AppleBlock, .opt. dispatch_queue_t as Ptr): Creates an action that executes a block, optionally on a specific dispatch queue. See the RunBlockTemplate method for the block structure.
Please note GCD is not really set-up in iOSLib, therefore just a ptr for the queue is expected.

ScaleBy (ScaleFactor as Double, Duration as Double): Creates an action that uniformly changes the scale factor of a node by a relative value.

ScaleTo (ScaleFactor as Double, Duration as Double): Creates an action that uniformly changes the scale factor of a node to an absolute value.

Sequence (ActionArray As AppleArray / ParamArray of AppleSCNAction): Creates an action that runs a collection of actions sequentially.

Unhide(): Creates an action that ensures a node is not hidden. Available in iOS 9.0 and later.

Wait (Duration as Double, opt. DurationRange as double): Creates an action that idles for a period of time. Randomizes this delay if you define DurationRange.

Properties

Duration As Double: The duration in seconds required to complete the action.

Speed As Double: A speed factor that modifies how fast an action runs. 2.0 means twice as fast.

TimingMode As SCNActionTimingMode: The timing mode used to execute an action. See UIView basics for an explanation.

Methods

ReversedAction() As AppleSCNAction: Creates an action that reverses the behavior of the current action if possible.

SetTimingFunctionBlock (Block As AppleBlock): Gives a way to add a block that SceneKit calls to determine the action’s animation timing. See the TimingFunctionBlockTemplate method for its structure.