Class
Scale3DAnimationEffector
View sourceExtendsAnimationEffector
Writes three interpolated scale values from an AnimationTrack to
an entity’s Scale3D component.
Use the class itself as the track effector. Each keyframe contains the local
scale’s x, y, and z values. apply() receives the interpolated values,
target World, and EntityHandle. The target entity must
already have an Scale3D component.
Examples
import { World } from '@wimaengine/ecs'
import { AnimationTrack, Scale3DAnimationEffector } from '@wimaengine/animation'
import { Scale3D } from '@wimaengine/transform'
const world = new World()
const entity = world.spawn([new Scale3D()])
const track = new AnimationTrack(Scale3DAnimationEffector)
track.times = [0, 1]
track.keyframes = [1, 1, 1, 2, 0.5, 3]
Scale3DAnimationEffector.apply(world, entity, track.getCurrent(0.5))
// The component now contains the scale (1.5, 0.75, 2).Constructor
Properties
staticcomponentType: typeof Scale3D
View sourceComponent constructor used by Scale3DAnimationEffector.apply when
it reads the target from the world. A compatible subclass can replace this
value and the inherited apply method will use that constructor through
this.componentType.
Default: Scale3D
Methods
staticapply(world: World, entity: EntityHandle, results: number[]): void
View sourceWrites the interpolated x, y, and z values to the target scale.
The method calls world.get(entity, this.componentType), then passes
results[0], results[1], and results[2] to the returned component’s
set() method. It does not add a missing component or check the lookup
result. A stale handle, an unknown entity, or an entity without the
component therefore causes the subsequent set() call to fail.
staticelementSize(): number
View sourceReturns the number of values consumed from each keyframe.
AnimationTrack uses this width when validating and interpolating the
flattened keyframe array for this effector.
