Using tween to animate opacity of image element



Been struggling with this for awhile now. Does anyone has a working code for tweening opacity of an image element ?

I tried the following code and attached them to my image element entity but it does not seem to work.

Any help would be appreciated thanks!

var opacity = 0;
var opacity = 0;, 1, pc.SineOut)
.on('update', (function (opacity) {
    this.entity.element.opacity = opacity;   


Tried with vec3 instead of number and it is working. Still looking for a proper solution to tween number type.

 var opacity = new pc.Vec3(0,0,0);
 this.entity.tween(opacity).to(new pc.Vec3(1,0,0), 1, pc.SineOut)
.on('update', (function () {
    this.entity.element.opacity = opacity.x;   


IIRC, you can only do it with object types. You would have to wrap the tweened opacity into an object unfortunately.