Skip to content

Animate Node transform/How to create Node Animations #458

@paricleu

Description

@paricleu

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions