One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

SpinAction

struct · iOS 18.0+ · SDK 27.1

struct SpinAction

An action which animates the transform of an entity to rotate around a specified local axis. This action rotates an entity around itself from a specified ``SpinAction/localAxis`` gradually adjusting its local transform. The ``SpinAction/localAxis`` specifies which cartesian axis around which to rotate in local space. The full spin completes after the action has ended. The example below creates an animation that spins an entity around the x-axis two times for five seconds with a linear transition. ```swift // Create an action that performs a spin around the specified local axis // with a linear transition. let spinAction = SpinAction(revolutions: 2, localAxis: [1, 0, 0], timingFunction: .linear, isAdditive: false) // A five second animation that plays an animation causing the entity to // spin around a specified local axis. let spinAnimation = try AnimationResource .makeActionAnimation(for: spinAction, duration: 5.0, bindTarget: .transform) // Play the five second spin animation. entity.playAnimation(spinAnimation) ``` - Note: Use the ``SpinAction/localAxis`` to determine whether the entity spins clockwise or counterclockwise. - Important: This action directly animates the ``BindTarget/transform`` on the bound entity. Ensure a correct bind target is supplied when creating the animation.

Members (9)

get · iOS 18.0+

isAdditive

TypeScript
get isAdditive(): boolean
Swift declaration
var isAdditive: Bool

A Boolean value that indicates whether the animation system additively blends the action's output with the base value.

set · iOS 18.0+

isAdditive

TypeScript
set isAdditive(value: boolean)
Swift declaration
var isAdditive: Bool

A Boolean value that indicates whether the animation system additively blends the action's output with the base value.

init · iOS 18.0+

init

TypeScript
static init(revolutions: number, localAxis?: SDKHandle, timingFunction?: AnimationTimingFunction, isAdditive?: boolean): SpinAction
Swift declaration
init(revolutions: Float, localAxis: SIMD3<Float> = [0, 1, 0], timingFunction: AnimationTimingFunction = .default, isAdditive: Bool = false)

Creates a new spin action. - Parameters: - revolutions: The number of rotations to complete before stopping. - localAxis: A vector that describes the axis of rotation (in local space). - timingFunction: A timing function that controls the progress of the animation. - isAdditive: A Boolean value that indicates whether the animation system additively blends the action's output with the base value.

get · iOS 18.0+

revolutions

TypeScript
get revolutions(): number
Swift declaration
var revolutions: Float

The number of rotations to complete before stopping.

set · iOS 18.0+

revolutions

TypeScript
set revolutions(value: number)
Swift declaration
var revolutions: Float

The number of rotations to complete before stopping.

get · iOS 18.0+

timingFunction

TypeScript
get timingFunction(): AnimationTimingFunction
Swift declaration
var timingFunction: AnimationTimingFunction

A timing function that controls the progress of the animation. The default value of this property is ``AnimationTimingFunction/default``. This produces an ease transition.

set · iOS 18.0+

timingFunction

TypeScript
set timingFunction(value: AnimationTimingFunction)
Swift declaration
var timingFunction: AnimationTimingFunction

A timing function that controls the progress of the animation. The default value of this property is ``AnimationTimingFunction/default``. This produces an ease transition.

get · iOS 18.0+

localAxis

TypeScript
get localAxis(): SDKHandle
Swift declaration
var localAxis: SIMD3<Float>

A vector that describes the axis of rotation (in local space). The default value of this property is `[0, 1, 0]`, meaning the rotation occurs around the y-axis.

set · iOS 18.0+

localAxis

TypeScript
set localAxis(value: SDKHandle)
Swift declaration
var localAxis: SIMD3<Float>

A vector that describes the axis of rotation (in local space). The default value of this property is `[0, 1, 0]`, meaning the rotation occurs around the y-axis.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

SpinAction.animatedValueType

Passing a Swift type itself is not supported.

All RealityFoundation types →