An animation that can be played by an entity.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- Xcode 11.0+
Framework
- Reality
Kit
Declaration
class AnimationResource
Overview
You find animation resources in an entity’s available
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 play
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 Animation
instance that lets you manage playback of the resource.
If you want to loop an animation, call the resource’s repeat(count:)
method to create a new resource that plays a given number of times in a row, or call the 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.