How to tween primitive values using playcanvas-tween?

i am struggling on something i’d think would be pretty simple. i want to do something like:

SomeEntity.prototype.speed = 0;
SomeEntity.prototype.tween = null;

SomeEntity.prototype.setSpeed(speed, duration){
    if(this.tween != null){
        this.tween.stop();
    }
    this.tween = this.entity.tween(this.speed).to(speed, duration, pc.SineOut).start();
}

i am using playcanvas-tween and can’t figure out how to do this without boxing the values in an object as described on the manual page. please advise :slight_smile:

Hi,

The tween library only supports tweening via an object.

You could do this:

this.entity.tween(SomeEntity.prototype).to({speed:10},...)

Otherwise, feel free to post an issue on the github repo as a suggestion.

Thanks!