# How do you reuse a tween that has finished playing with different end values

**URL:** <https://phaser.discourse.group/t/how-do-you-reuse-a-tween-that-has-finished-playing-with-different-end-values/1896>\
**Category:** Phaser 3\
**Created:** [March 29, 2019, 12:55pm UTC](https://phaser.discourse.group/t/how-do-you-reuse-a-tween-that-has-finished-playing-with-different-end-values/1896 "2019-03-29T12:55:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![glantucan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/glantucan/32/920_2.png) [@glantucan](https://phaser.discourse.group/u/glantucan)\
**Post date:** [March 29, 2019, 12:55pm UTC](https://phaser.discourse.group/t/how-do-you-reuse-a-tween-that-has-finished-playing-with-different-end-values/1896/1 "2019-03-29T12:55:23Z")

</div>

Hi,  
I’ve been testing the updatTo() function to reset a tween, but it doesn’t work if the tween already finished. How do you do it when that’s the case?

Here’s a simplified example of what I’m trying to do:

```javascript

var nextAngleChangeTime = 3000;
var curAngle = 0;

//...

function create(){
    //...
    direction = { angle: curAngle };
    directionTween = scn.tweens.add({
        targets: dirObj,
        angle: curAngle,
        duration: 2000,
        repeat: 0,
    });

}

function update(time, delta) {
    if (time > nextAngleChangeTime) {
        nextAngleChangeTime = time + 3000;
        curAngle += Math.PI/2 - Math.random()*Math.PI;

        directionTween.updateTo('angle', curAngle, true);
        directionTween.restart();
    }
    //...
}

```

The `currAngle` value changed every 3 seconds, but the `direction.angle` remained as at the end of the first 2 seconds tween. Don’t know whether this is a bug or I’m getting it wrong.

I tried something different as a workaround and for this simplified case it works:

```javascript
function update(time, delta) {
    if (time > nextAngleChangeTime) {
        nextAngleChangeTime = time + 3000;
        curAngle += Math.PI/2 - Math.random()*Math.PI;

        //directionTween.updateTo('angle', curAngle, true);
        directionTween.restart();
        console.log('New target Angle:', curAngle);
    }
    if(curAngle !== direction.angle) {
        directionTween.updateTo('angle', curAngle, true);
    }
    console.log('tweened angle:', direction.angle);
    //﻿...
}﻿﻿﻿﻿﻿﻿﻿

```

But the problem is that if the angle gets changed outside of this controlled situation (which I need for several reasons), managing the situation with this workaround gets really awkward.

Any idea on how could I reuse this tween in any way different?
