[SOLVED] Help with shader from rainbow tutorial

Hi,

I need to do a hud effect like this for a game :

I have started with the “rainbow trail and mesh” tutorial (https://developer.playcanvas.com/en/tutorials/rainbow-trail-with-mesh-api/), and customize it : https://playcanvas.com/project/788043/overview/hudcompleteeffect

The problem i have is that the animation is around 5s, and i need to be around 2s.

For starting the project, open devtools, and call test() function.

Thanks by advance.

var SpinObject = pc.createScript('spinObject');

// update code called every frame
SpinObject.prototype.update = function(dt) {
    var duration = 2;
    var angle = (dt * 360) / duration;
    this.entity.rotateLocal(0, angle, 0);
};

You would then need to track the angle and stop rotation when it makes a complete turn.

1 Like

Thanks a lot !, i was focusing on ribbon.js code and miss the spin-object script.

1 Like

You could also use a sprite with some custom code for this: https://developer.playcanvas.com/en/tutorials/loading-circle-ui/

Thanks for that tip, i achieve very well with the previous tutorial :wink: