An action that animates the blend factor of an entity's billboard component.
This action animates the ``BillboardComponent/blendFactor`` value of an
entity's ``BillboardComponent``.
Over its duration, the action updates the `blendFactor` property to `1.0`.
If you provide a ``BillboardAction/transitionIn`` configuration,
the action interpolates the value of the component's current value for
``BillboardComponent/blendFactor`` towards `1.0`.
If you provide a ``BillboardAction/transitionOut`` configuration,
the action interpolates the component's ``BillboardComponent/blendFactor`` value from `1.0` to its
original value for that component.
The example below creates a three-part animation that:
- Interpolates ``BillboardComponent/blendFactor`` from `0.0` to `1.0`
- Pauses for one second
- Interpolates ``BillboardComponent/blendFactor`` from `1.0` back to `0.0`
```swift
// Load a robot model from a resource file.
let robotModel = try await ModelEntity(named: "vintage_robot")
// A billboard component for the robot model entity.
var billboardComponent = BillboardComponent()
// Disable the billboard at the beginning by setting its blend factor to zero.
billboardComponent.blendFactor = 0.0
// Add the component to the entity.
await robotModel.components.set(billboardComponent)
// A transition that lasts one second.
let billboardTransition = BillboardAction.Transition(
duration: 1.0,
timingFunction: .easeInOut
)
// An action that starts and ends with a one second transition.
let billboardAction = BillboardAction(transitionIn: billboardTransition,
transitionOut: billboardTransition)
// A three second animation that adjusts the blend factor twice.
//
// This animation includes a one second pause between both of the action's
// one second transitions in and out by setting the duration one second
// longer than action's total time.
let billboardAnimation = try AnimationResource
.makeActionAnimation(for: billboardAction,
duration: 3.0,
bindTarget: .billboardBlendFactor)
// Play the three second billboard animation that adjusts the blend factor.
robotModel.playAnimation(billboardAnimation)
```
@Video(
source: billboardaction-simple-loop,
alt: "A screen recording of a vintage-style robot toy in a living room scene. At the start, the robot isn't looking at the camera, then its body moves in place to look at the camera, stays still for one second, and its body moves back to its original orientation.",
poster: billboardaction-simple-loop-poster
)
- Note: If an entity doesn't have a ``BillboardComponent``, the default
initializer creates one for you so that it can restore the entity
back to a state without the billboard.
- Important: This action directly animates the ``BindTarget/billboardBlendFactor`` on the bound entity.
Ensure a correct bind target is supplied when creating the animation.
Ensure the action can transition back to a non-billboard state by adding
the component to the entity and check the
``BillboardComponent/blendFactor``
property has a value that you expect.
Creates a new billboard action.
- Parameters:
- transitionIn: The rate of change at the beginning of the action.
- transitionOut: The rate of change at the end of the action.
get · iOS 18.0+
transitionIn
TypeScript
get transitionIn(): BillboardAction_Transition
Swift declaration
var transitionIn: BillboardAction.Transition
The rate of change at the beginning of the action.
set · iOS 18.0+
transitionIn
TypeScript
set transitionIn(value: BillboardAction_Transition)
Swift declaration
var transitionIn: BillboardAction.Transition
The rate of change at the beginning of the action.
get · iOS 18.0+
transitionOut
TypeScript
get transitionOut(): BillboardAction_Transition
Swift declaration
var transitionOut: BillboardAction.Transition
The rate of change at the end of the action.
set · iOS 18.0+
transitionOut
TypeScript
set transitionOut(value: BillboardAction_Transition)
Swift declaration
var transitionOut: BillboardAction.Transition
The rate of change at the end of the action.
Skipped declarations
1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.