Fragment shader played in reverse

Hey!

I have this fragment shader that I found on shadertoy.com, and now I’m going to implement it via three.js. My issue is that I would really want to be able to go control the “time” of the shader. So that I can let it “play” and then “reverse” the effect to get it back to the starting point. It will also be interactive so it’s not a question of an animation.

What would be the best way to do this?

Here’s the shadertoy effect:
https://www.shadertoy.com/view/ldcGDX

Would really appreciate an answer, thank you!

A starting point could be this three.js example: https://threejs.org/examples/#webgl_shader

The time value in the shader is actually passed in from the JavaScript application as an uniform. Check the corresponding .render() function to see how the value is animated. You can change of course the animation of the value as you like.

1 Like