One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

AnimationPlaybackController

class · iOS 13.0+ · SDK 27.1

@MainActor @preconcurrency class AnimationPlaybackController

A controller that manages animation playback. This class controls the playback of an entity animation by providing its pause, resume, or stop functions. The animation starts immediately after you call ``Entity/playAnimation(_:transitionDuration:startsPaused:)``, or ``Entity/move(to:relativeTo:duration:timingFunction:)-905k``, which both return an instance of this class. A controller invalidates after its associated animation completes or stops. To play another animation, perform an action that generates another controller. While an animation plays, you can receive notification of particular playback states by subscribing to an event. For more information, see ``AnimationEvents``.

Members (19)

get · iOS 13.0+

isComplete

TypeScript
get isComplete(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency var isComplete: Bool { get }

A Boolean that indicates whether the animation has finished running. After an animation completes, the playback controller becomes invalid. To play the animation again, create a new controller with the same resource.

get · iOS 15.0+

blendFactor

TypeScript
get blendFactor(): Promise<number>
Swift declaration
@MainActor @preconcurrency var blendFactor: Float { get set }

The level of influence the controller gives to its animation. You can run multiple animations on the same property, for example, walking and jumping animations that affect the same joint transforms. When multiple animations adjust the same property at runtime, the framework applies this blend factor on the animations' respective controllers to calculate a middle ground value that displays at runtime.

set · iOS 15.0+

blendFactor

TypeScript
setBlendFactor(value: number): Promise<void>
Swift declaration
@MainActor @preconcurrency var blendFactor: Float { get set }

The level of influence the controller gives to its animation. You can run multiple animations on the same property, for example, walking and jumping animations that affect the same joint transforms. When multiple animations adjust the same property at runtime, the framework applies this blend factor on the animations' respective controllers to calculate a middle ground value that displays at runtime.

method · iOS 18.0+

stop

TypeScript
stopBlendOutDuration(blendOutDuration: number): Promise<void>
Swift declaration
@MainActor @preconcurrency func stop(blendOutDuration: TimeInterval)

Stops an animation with a fade-out time. - Parameters: - blendOutDuration: Time (in seconds) to fade out the animation before it stops. This method has no effect if the animation is complete. After you stop the animation, the playback controller becomes invalid. Create a new one with the same resource to play the animation again.

method · iOS 13.0+

stop

TypeScript
stop(): Promise<void>
Swift declaration
@MainActor @preconcurrency func stop()

Stops an animation. This method has no effect if the animation is complete. After you stop the animation, the playback controller becomes invalid. Create a new one with the same resource to play the animation again.

get · iOS 15.0+

time

TypeScript
get time(): Promise<number>
Swift declaration
@MainActor @preconcurrency var time: TimeInterval { get set }

The animation's location within the timeline.

set · iOS 15.0+

time

TypeScript
setTime(value: number): Promise<void>
Swift declaration
@MainActor @preconcurrency var time: TimeInterval { get set }

The animation's location within the timeline.

get · iOS 15.0+

clock

TypeScript
get clock(): Promise<unknown>
Swift declaration
@MainActor @preconcurrency var clock: CMClockOrTimebase { get set }

A reference clock to synchronize the animation with other events.

set · iOS 15.0+

clock

TypeScript
setClock(value: unknown): Promise<void>
Swift declaration
@MainActor @preconcurrency var clock: CMClockOrTimebase { get set }

A reference clock to synchronize the animation with other events.

method · iOS 13.0+

pause

TypeScript
pause(): Promise<void>
Swift declaration
@MainActor @preconcurrency func pause()

Pauses the animation. Resume a paused animation by calling the ``AnimationPlaybackController/resume()`` method. This method has no effect if the animation is already paused or complete.

get · iOS 15.0+

speed

TypeScript
get speed(): Promise<number>
Swift declaration
@MainActor @preconcurrency var speed: Float { get set }

The animation's rate of playback. The animation applies the value of this property as an irrational factor of the unaltered speed. For example, a value of `2` plays the animation twice as fast, a value of `0.5` plays the animation at half speed, and a value of `1` plays the animation at the unaltered rate.

set · iOS 15.0+

speed

TypeScript
setSpeed(value: number): Promise<void>
Swift declaration
@MainActor @preconcurrency var speed: Float { get set }

The animation's rate of playback. The animation applies the value of this property as an irrational factor of the unaltered speed. For example, a value of `2` plays the animation twice as fast, a value of `0.5` plays the animation at half speed, and a value of `1` plays the animation at the unaltered rate.

get · iOS 13.0+

entity

TypeScript
get entity(): Promise<(Entity) | null>
Swift declaration
@MainActor @preconcurrency weak var entity: Entity? { get }

The entity to which the animation applies.

method · iOS 13.0+

resume

TypeScript
resume(): Promise<void>
Swift declaration
@MainActor @preconcurrency func resume()

Resumes a paused animation. Call this method to resume an animation that you paused with the ``AnimationPlaybackController/pause()`` method. You can’t resume an animation that has finished naturally, or that you stopped by calling the ``AnimationPlaybackController/stop()`` method. This method has no effect on an animation that isn’t paused.

get · iOS 15.0+

isValid

TypeScript
get isValid(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency var isValid: Bool { get }

A Boolean value that indicates whether the animation controller is functional. This function returns `false` for stopped animations.

get · iOS 15.0+

duration

TypeScript
get duration(): Promise<number>
Swift declaration
@MainActor @preconcurrency var duration: TimeInterval { get }

The length of time the animation spans, in seconds.

get · iOS 13.0+

isPaused

TypeScript
get isPaused(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency var isPaused: Bool { get }

A Boolean that indicates whether the animation is paused.

get · iOS 15.0+

isPlaying

TypeScript
get isPlaying(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency var isPlaying: Bool { get }

A Boolean value that indicates whether the animation plays.

get · iOS 15.0+

isStopped

TypeScript
get isStopped(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency var isStopped: Bool { get }

A Boolean value that indicates whether the animation stopped. This function returns `true` for stopped animations.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →