Dynamically change tween animation

hello.
i have a tween animation to move camera from point A to point B smoothly.
point B position is calculated using player position.
all works fine till player does not move.
but now i need for tween to recalculate animation properties dynamically if player is moving when animation starts.

do you know how to do that?
thank you

undo
or maybe is possible to restart animation from itself but with another properties of start and finish of animation?

Hi @Dima_Romanchuk,

When you start a tween, you can keep a reference to it which you can use it at any point later to stop it.

const tween = entity.tween(entity.getLocalPosition()).to({x: 10, y: 0, z: 0}, 1, pc.SineOut).start();

// at any point later
tween.stop();

So you can define a new tween after that. But definitely check an alternate way of animating using lerping, it may suit better moving objects. For example:

https://developer.playcanvas.com/en/tutorials/point-and-click-movement/