patriciogonzalezvivo/glslViewer

Loops with glslViewer

marioecg opened this issue · 0 comments

I love making sketches that loop, and that's a reason why I also like other creative tools like canvas-sketch and fragment. They help you set a duration for the sketch and provide a playhead variable that goes from 0 to 1 in its time span, so then you can use that value and multiply it by TWO_PI to make a complete phase of sine and cosine.

Typically inside the shader I could make something like:

float duration = 10.0;
float wrappedTime = mod(u_time, duration);
float playhead = (wrappedTime / duration) * TWO_PI;

// and then use it, for instance
float pulse = cos(playhead) * 0.5 + 0.5; 

Is there a way in glslViewer to create and export loops at a specific duration? I'm guessing that the defined duration should match with the command to export a sketch to mp4? I'll appreciate any insight 🙂