bindTarget
TypeScriptget bindTarget(): BindTargetSwift declarationvar bindTarget: BindTarget { get set }A textual name that identifies the particular property that animates.
struct · iOS 15.0+ · SDK 27.1
struct OrbitAnimationAn animation that revolves an entity around its origin. This class moves an entity in a circular path by gradually adjusting its local transform. The animation sets the entity's initial position with ``OrbitAnimation/startTransform`` and rotates it around the point `(0,` `0,` `0)`. The ``OrbitAnimation/axis`` specifies which cartesian axis around which to rotate. The full orbit completes after ``OrbitAnimation/duration`` lapses. If the target entity contains child entities, the target entity orbits the children. ### Revolve an entity around its origin The following code creates an animation that orbits an entity around the y-axis 3 times over `6` seconds. ```swift let yAxis: SIMD3<Float> = [0, 1, 0] let startingPosition: SIMD3<Float> = [0.25, 0, 0] let orbit = OrbitAnimation( name: "orbit", duration: 6, axis: yAxis, startTransform: Transform(translation: startingPosition), spinClockwise: false, orientToPath: true, rotationCount: 3, bindTarget: .transform ) ``` The newly created animation can be trimmed after creation, to last only 4 seconds. ```swift // Create an animation clip that skips the first two seconds. let trimmed = orbit.trimmed(start: 2) ``` Use ``AnimationResource/generate(with:)`` to convert `OrbitAnimation` to an ``AnimationResource`` that can be applied to your entity with ``Entity/playAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:)``. @Video( source: orbitanimation-red-box, alt: "A screen recording of a red cube in a living room scene. The cube is slightly offset from the center, and rotates around the y-axis twice at a rate of 1 rotation every 2 seconds.", poster: orbitanimation-red-box-poster )
get bindTarget(): BindTargetSwift declarationvar bindTarget: BindTarget { get set }A textual name that identifies the particular property that animates.
set bindTarget(value: BindTarget)Swift declarationvar bindTarget: BindTarget { get set }A textual name that identifies the particular property that animates.
get blendLayer(): numberSwift declarationvar blendLayer: Int32 { get set }The order in which the framework composites the animation. The framework applies multiple animations on the same target in ascending order of this property’s value. Animations in a lower layer run before animations in a higher layer. Animations that share the same value apply in the order that they execute.
set blendLayer(value: number)Swift declarationvar blendLayer: Int32 { get set }The order in which the framework composites the animation. The framework applies multiple animations on the same target in ascending order of this property’s value. Animations in a lower layer run before animations in a higher layer. Animations that share the same value apply in the order that they execute.
get repeatMode(): AnimationRepeatModeSwift declarationvar repeatMode: AnimationRepeatMode { get set }An option that determines how the animation repeats. If you call ``OrbitAnimation/trimmed(start:end:duration:)`` with a `start` or `end` that lies outside of the timeline defined by ``OrbitAnimation/duration``, the animation fills the additional playback by applying this property.
set repeatMode(value: AnimationRepeatMode)Swift declarationvar repeatMode: AnimationRepeatMode { get set }An option that determines how the animation repeats. If you call ``OrbitAnimation/trimmed(start:end:duration:)`` with a `start` or `end` that lies outside of the timeline defined by ``OrbitAnimation/duration``, the animation fills the additional playback by applying this property.
get orientToPath(): booleanSwift declarationvar orientToPath: Bool { get set }A Boolean value that indicates whether the orbiting object updates its orientation during the animation to orient itself along the rotation path. The default value of this property is `false`.
set orientToPath(value: boolean)Swift declarationvar orientToPath: Bool { get set }A Boolean value that indicates whether the orbiting object updates its orientation during the animation to orient itself along the rotation path. The default value of this property is `false`.
get trimDuration(): (number) | nullSwift declarationvar trimDuration: TimeInterval? { get set }An optional duration that overrides the calculated duration. The framework calculates ``OrbitAnimation/duration``, but you can set this property to override it. This property is `nil` by default, which indicates that the animation stops after one play that spans ``OrbitAnimation/duration``. If you set a non-zero value for this property and both ``OrbitAnimation/trimStart`` and ``OrbitAnimation/trimEnd`` are `nil`, the animation observes this property as an edited duration. When you set ``OrbitAnimation/repeatMode`` to make the animation repeat: - If this property is `nil`, the animation repeats forever. - If set to a value greater than ``OrbitAnimation/duration``, the animation repeats for the specified duration.
set trimDuration(value: (number) | null)Swift declarationvar trimDuration: TimeInterval? { get set }An optional duration that overrides the calculated duration. The framework calculates ``OrbitAnimation/duration``, but you can set this property to override it. This property is `nil` by default, which indicates that the animation stops after one play that spans ``OrbitAnimation/duration``. If you set a non-zero value for this property and both ``OrbitAnimation/trimStart`` and ``OrbitAnimation/trimEnd`` are `nil`, the animation observes this property as an edited duration. When you set ``OrbitAnimation/repeatMode`` to make the animation repeat: - If this property is `nil`, the animation repeats forever. - If set to a value greater than ``OrbitAnimation/duration``, the animation repeats for the specified duration.
get rotationCount(): numberSwift declarationvar rotationCount: Float { get set }The number of times to rotate the target entity before stopping.
set rotationCount(value: number)Swift declarationvar rotationCount: Float { get set }The number of times to rotate the target entity before stopping.
get spinClockwise(): booleanSwift declarationvar spinClockwise: Bool { get set }A Boolean value that indicates whether the object orbits the center point in the clockwise direction. The default value is `true`, which indicates that the rotation occurs in the clockwise direction. Set the value to `false` to cause the object to orbit the center point counterclockwise.
set spinClockwise(value: boolean)Swift declarationvar spinClockwise: Bool { get set }A Boolean value that indicates whether the object orbits the center point in the clockwise direction. The default value is `true`, which indicates that the rotation occurs in the clockwise direction. Set the value to `false` to cause the object to orbit the center point counterclockwise.
get startTransform(): TransformSwift declarationvar startTransform: Transform { get set }The pose of the orbiting object at the start of the animation.
set startTransform(value: Transform)Swift declarationvar startTransform: Transform { get set }The pose of the orbiting object at the start of the animation.
get axis(): SDKHandleSwift declarationvar axis: SIMD3<Float> { get set }A 3D vector that points in the direction of the axis around which to rotate. You can rotate an object around any axis. For example, if you set a `1` in the vector's x-coordinate, rotation occurs around the x-axis, as in the following code. ```swift orbitAnimation.axis = SIMD3<Float>(x: 1.0, y: 0.0, z: 0.0) ```
set axis(value: SDKHandle)Swift declarationvar axis: SIMD3<Float> { get set }A 3D vector that points in the direction of the axis around which to rotate. You can rotate an object around any axis. For example, if you set a `1` in the vector's x-coordinate, rotation occurs around the x-axis, as in the following code. ```swift orbitAnimation.axis = SIMD3<Float>(x: 1.0, y: 0.0, z: 0.0) ```
static init(name?: string, duration?: number, axis?: SDKHandle, startTransform?: Transform, spinClockwise?: boolean, orientToPath?: boolean, rotationCount?: number, bindTarget?: (BindTarget) | null, blendLayer?: number, repeatMode?: AnimationRepeatMode, fillMode?: AnimationFillMode, isAdditive?: boolean, trimStart?: (number) | null, trimEnd?: (number) | null, trimDuration?: (number) | null, offset?: number, delay?: number, speed?: number): OrbitAnimationSwift declarationinit(name: String = "", duration: TimeInterval = 1.0, axis: SIMD3<Float> = .init(x: 0.0, y: 1.0, z: 0.0), startTransform: Transform = .identity, spinClockwise: Bool = true, orientToPath: Bool = false, rotationCount: Float = 1.0, bindTarget: BindTarget? = nil, blendLayer: Int32 = 0, repeatMode: AnimationRepeatMode = .none, fillMode: AnimationFillMode = [], isAdditive: Bool = false, trimStart: TimeInterval? = nil, trimEnd: TimeInterval? = nil, trimDuration: TimeInterval? = nil, offset: TimeInterval = 0, delay: TimeInterval = 0, speed: Float = 1)Creates an animation that revolves an entity around its origin. - Parameters: - name: A textual name for the animation. - duration: The elapsed time for one complete rotation. - axis: A 3D vector that points in the direction of the axis around which to rotate. - startTransform: The orbiting entity's beginning position. - spinClockwise: A Boolean value that indicates whether the object orbits the center point in the clockwise direction. - orientToPath: A Boolean value that indicates whether the orbiting object updates its orientation during the animation to orient itself along the rotation path. - rotationCount: The number of times to rotate the target entity before stopping. - bindTarget: A textual name that identifies the particular property that animates. - blendLayer: The order in which the framework composites the animation into the view. - repeatMode: An option that determines how the animation repeats. - fillMode: The playback behavior outside of the normal duration. - isAdditive: A Boolean value that indicates whether the animation builds on the current state of the target entity or resets the state before running. - trimStart: The optional time, in seconds, at which the animation plays. - trimEnd: The optional time, in seconds, at which the animation stops. - trimDuration: An optional duration that overrides the calculated duration. - offset: The time, in seconds, at which the animation begins within the duration. - delay: An amount of time that lapses before the animation plays. - speed: A factor that changes the animation’s rate of playback.
get name(): stringSwift declarationvar name: String { get set }A textual name for the animation.
set name(value: string)Swift declarationvar name: String { get set }A textual name for the animation.
get delay(): numberSwift declarationvar delay: TimeInterval { get set }An amount of time that lapses before the animation plays. The default value is `0`, which indicates that the animation plays with no delay. If you set a value for this property, the animation plays from its start time after the specified delay lapses. During the delayed time, the animation doesn't update. However, to fill the delayed time with some portion of animation, set a negative ``OrbitAnimation/trimStart`` instead and choose a ``OrbitAnimation/fillMode`` that displays the desired portion of animation.
set delay(value: number)Swift declarationvar delay: TimeInterval { get set }An amount of time that lapses before the animation plays. The default value is `0`, which indicates that the animation plays with no delay. If you set a value for this property, the animation plays from its start time after the specified delay lapses. During the delayed time, the animation doesn't update. However, to fill the delayed time with some portion of animation, set a negative ``OrbitAnimation/trimStart`` instead and choose a ``OrbitAnimation/fillMode`` that displays the desired portion of animation.
get speed(): numberSwift declarationvar speed: Float { get set }A factor that changes the animation’s rate of playback. The default value is `1.0`, which doesn’t alter the animation’s duration. A value of `2.0` indicates that the duration is half the normal rate. A value of `0.5` indicates that the duration is twice the normal rate. Negative values play the animation in reverse. This property doesn’t affect the animation’s ``FromToByAnimation/delay``.
set speed(value: number)Swift declarationvar speed: Float { get set }A factor that changes the animation’s rate of playback. The default value is `1.0`, which doesn’t alter the animation’s duration. A value of `2.0` indicates that the duration is half the normal rate. A value of `0.5` indicates that the duration is twice the normal rate. Negative values play the animation in reverse. This property doesn’t affect the animation’s ``FromToByAnimation/delay``.
get offset(): numberSwift declarationvar offset: TimeInterval { get set }The time, in seconds, at which the animation begins within the duration. The default value is `0`, which indicates that the animation plays with no offset. Setting a value for this property moves the animation data along the timeline and doesn't change timing. If you set a ``OrbitAnimation/fillMode`` other than ``AnimationFillMode/none``, the animation fills the vacant area created by the offset according to the characteristics of the specified fill mode.
set offset(value: number)Swift declarationvar offset: TimeInterval { get set }The time, in seconds, at which the animation begins within the duration. The default value is `0`, which indicates that the animation plays with no offset. Setting a value for this property moves the animation data along the timeline and doesn't change timing. If you set a ``OrbitAnimation/fillMode`` other than ``AnimationFillMode/none``, the animation fills the vacant area created by the offset according to the characteristics of the specified fill mode.
get trimEnd(): (number) | nullSwift declarationvar trimEnd: TimeInterval? { get set }The optional time, in seconds, at which the animation stops. This property is `nil` by default, which plays the animation until `time` = ``AnimationGroup/duration``. If you set a value, the animation edits the duration according to the specified ending time.
set trimEnd(value: (number) | null)Swift declarationvar trimEnd: TimeInterval? { get set }The optional time, in seconds, at which the animation stops. This property is `nil` by default, which plays the animation until `time` = ``AnimationGroup/duration``. If you set a value, the animation edits the duration according to the specified ending time.
get additive(): booleanSwift declarationvar additive: Bool { get set }A Boolean value that indicates whether the animation builds on the current state of the target entity or resets the state before running.
set additive(value: boolean)Swift declarationvar additive: Bool { get set }A Boolean value that indicates whether the animation builds on the current state of the target entity or resets the state before running.
get duration(): numberSwift declarationvar duration: TimeInterval { get set }The elapsed time for one complete rotation. The framework sets a value for this property depending on the underlying animation data and the specified ``OrbitAnimation/speed``. You can override the default duration by defining ``OrbitAnimation/trimStart``, ``OrbitAnimation/trimEnd``, or ``OrbitAnimation/trimDuration``.
set duration(value: number)Swift declarationvar duration: TimeInterval { get set }The elapsed time for one complete rotation. The framework sets a value for this property depending on the underlying animation data and the specified ``OrbitAnimation/speed``. You can override the default duration by defining ``OrbitAnimation/trimStart``, ``OrbitAnimation/trimEnd``, or ``OrbitAnimation/trimDuration``.
get fillMode(): AnimationFillModeSwift declarationvar fillMode: AnimationFillMode { get set }An option that determines which data displays outside of the normal duration. This property determines what to display when the framework samples the animation outside of the range defined by its underlying duration. The animation applies this property when: - Playback progresses toward, but hasn't yet reached, a nonzero ``AnimationDefinition/offset``. - A range determined by ``AnimationDefinition/trimStart``, ``AnimationDefinition/trimEnd``, or ``AnimationDefinition/trimDuration`` exceeds the animation's underlying duration.
set fillMode(value: AnimationFillMode)Swift declarationvar fillMode: AnimationFillMode { get set }An option that determines which data displays outside of the normal duration. This property determines what to display when the framework samples the animation outside of the range defined by its underlying duration. The animation applies this property when: - Playback progresses toward, but hasn't yet reached, a nonzero ``AnimationDefinition/offset``. - A range determined by ``AnimationDefinition/trimStart``, ``AnimationDefinition/trimEnd``, or ``AnimationDefinition/trimDuration`` exceeds the animation's underlying duration.
get trimStart(): (number) | nullSwift declarationvar trimStart: TimeInterval? { get set }The optional time, in seconds, at which the animation plays. This property is `nil` by default, which plays the animation with `time` = `0`. If you set a value, the animation edits the duration according to the specified beginning time. If you set a negative value for this property, the duration increases and the additional animation data fills in based on the ``AnimationView/fillMode`` you choose.
set trimStart(value: (number) | null)Swift declarationvar trimStart: TimeInterval? { get set }The optional time, in seconds, at which the animation plays. This property is `nil` by default, which plays the animation with `time` = `0`. If you set a value, the animation edits the duration according to the specified beginning time. If you set a negative value for this property, the duration increases and the additional animation data fills in based on the ``AnimationView/fillMode`` you choose.
No declarations were skipped in this snapshot.