One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

AnimationResource

class · iOS 13.0+ · SDK 27.1

@MainActor @preconcurrency class AnimationResource

An animation for the properties of scenes or entities. You find animation resources in an entity’s ``Entity/availableAnimations`` array. Animation resources come bundled with an entity when you load the entity from a file. They describe an animation that’s specific to the entity to which they are attached. Use the entity’s ``Entity/playAnimation(_:transitionDuration:startsPaused:)`` method to play a particular item in its animation resource array, or the `playAnimation(named:transitionDuration:startsPaused:)` method to play all of the animations with a given name. From both methods, you receive an ``AnimationPlaybackController`` instance that lets you manage playback of the resource. If you want to loop an animation, call the resource’s ``AnimationResource/repeat(count:)`` method to create a new resource that plays a given number of times in a row, or call the ``AnimationResource/repeat(duration:)`` method to create a new resource that loops for the given duration. The latter loops indefinitely if you omit the duration parameter. You use the new animation resource that these methods return just as you would any other.

Members (8)

get · iOS 15.0+

definition

TypeScript
get definition(): Promise<SDKHandle>
Swift declaration
@MainActor @preconcurrency var definition: any AnimationDefinition { get }

The timeframe, target object, and visual semantics of the animation.

get · iOS 13.0+

name

TypeScript
get name(): Promise<(string) | null>
Swift declaration
@MainActor @preconcurrency final let name: String?

The name of the animation resource. You can get an ``AnimationPlaybackController`` instance ready to play a particular resource that you reference by its name using the `playAnimation(named:transitionDuration:startsPaused:)` method.

static · iOS 15.0+

group

TypeScript
static group(resources: Array<AnimationResource>): Promise<AnimationResource>
Swift declaration
@MainActor @preconcurrency static func group(with resources: [AnimationResource]) throws -> AnimationResource

Creates an animation resource that simultaneously plays back a collection of animations. - Parameters: - resources: The collection of animation resources to play back. - Returns: An animation resource that simultaneously plays back the argument collection of animations.

method · iOS 15.0+

store

TypeScript
store(in_: Entity): Promise<void>
Swift declaration
@MainActor @preconcurrency func store(in: Entity)

Adds the animation to an entity without playing it. - Parameters: - in: The entity to which to attach the animation.

method · iOS 13.0+

repeat

TypeScript
repeatCount(count: number): Promise<AnimationResource>
Swift declaration
@MainActor @preconcurrency func `repeat`(count: Int) -> AnimationResource

Creates an animation that repeats the specified number of times. - Parameters: - count: The number of animation repetitions. - Returns: A repeating copy of the calling animation resource.

method · iOS 13.0+

repeat

TypeScript
repeatDuration(duration?: number): Promise<AnimationResource>
Swift declaration
@MainActor @preconcurrency func `repeat`(duration: TimeInterval = .infinity) -> AnimationResource

Repeats an animation for the specified amount of time. - Parameters: - duration: The amount of time that the animation should play. If you omit this parameter, the animation loops indefinitely. - Returns: A new animation resource that you play on an entity by calling the entity’s ``Entity/playAnimation(_:transitionDuration:startsPaused:)`` method.

static · iOS 15.0+

generate

TypeScript
static generate(definition: SDKHandle): Promise<AnimationResource>
Swift declaration
@MainActor @preconcurrency static func generate(with definition: any AnimationDefinition) throws -> AnimationResource

Creates an animation resource from a definition. - Parameters: - definition: The configuration of a timeframe and visual semantics from which to generate an animation resource. - Returns: An animation resource that shares the configuration of the definition.

static · iOS 15.0+

sequence

TypeScript
static sequence(resources: Array<AnimationResource>): Promise<AnimationResource>
Swift declaration
@MainActor @preconcurrency static func sequence(with resources: [AnimationResource]) throws -> AnimationResource

Creates an animation resource that plays a collection of animations in a specified sequence. - Parameters: - resources: The collection of animation resources to play. - Returns: An animation resource that plays the given array of animations.

Skipped declarations

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

AnimationResource.makeActionAnimation(for:duration:name:bindTarget:blendLayer:repeatMode:fillMode:trimStart:trimEnd:trimDuration:offset:delay:speed:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

All RealityFoundation types →