Skip to content

Animate Node transform/How to create Node Animations #534

@ThomasGorisse

Description

@ThomasGorisse

Discussed in #482

Originally posted by paricleu April 4, 2024
I've ran into a problem animating Node transforms.
Transforms without animations work well e.g. node.transform(position, rotation, scale) and even smooth transformation are fine e.g.

node.transform(position, rotation, scale, true, 1.0)

Even tho it is nowhere documented what the "smoothSpeed" is referencing to. Is is seconds? It does not seem to be.

What I am trying to achieve is animating a node and also be able to stop the animation if it is not finished yet.
I came across

    fun animatePositions(vararg positions: Position): ObjectAnimator =
        NodeAnimator.ofPosition(this, *positions)

    fun animateQuaternions(vararg quaternions: Quaternion): ObjectAnimator =
        NodeAnimator.ofQuaternion(this, *quaternions)

    fun animateRotations(vararg rotations: Rotation): ObjectAnimator =
        NodeAnimator.ofRotation(this, *rotations)

    fun animateScales(vararg scales: Scale): ObjectAnimator =
        NodeAnimator.ofScale(this, *scales)

    fun animateTransforms(vararg transforms: Transform): AnimatorSet =
        NodeAnimator.ofTransform(this, *transforms)

in Node.kt but I have no clue how to use it.
node.animateRotations(rotation).start() does nothing.

How can I create a node animation so it is cancelable?

Metadata

Metadata

Assignees

Labels

StalebugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions