Skip to content

Instantly share code, notes, and snippets.

@munrocket
Last active May 14, 2025 04:14
Show Gist options
  • Save munrocket/d4fc18abfb9c98f0cfce6eda772dcb45 to your computer and use it in GitHub Desktop.
Save munrocket/d4fc18abfb9c98f0cfce6eda772dcb45 to your computer and use it in GitHub Desktop.
How to record cycled video from shadertoy
// copy paste this in console
function shader_exporter(duration, width, heigth, paused) {
document.getElementById('demogl').style.width = width + 'px';
document.getElementById('demogl').style.height = heigth + 'px';
document.getElementById('myResetButton').click();
document.getElementById('myRecord').click();
if (paused) document.getElementById('myPauseButton').click();
let t0 = performance.now();
function loop(){
if (performance.now() - t0 > duration * 1000) {
document.getElementById('myRecord').click();
if (paused) document.getElementById('myPauseButton').click();
} else {
requestAnimFrame(loop)
}
};
requestAnimFrame(loop);
}
shader_exporter(6.28318530, 512, 512, false);
@Masynchin
Copy link

@munrocket Sorry, I was running this script in Safari which does not support Webm. Works fine in Chrome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment