Skip to content

Instantly share code, notes, and snippets.

@SabinT
Created June 21, 2021 08:34
Show Gist options
  • Save SabinT/e355bb4646b1c967c69843c3f97934d9 to your computer and use it in GitHub Desktop.
Save SabinT/e355bb4646b1c967c69843c3f97934d9 to your computer and use it in GitHub Desktop.
GLSL Time loop tricks
float loopWithPause(float scale) {
// sinusoidal, with a short pause at start/end
float overshoot = 1.5;
// iTime is a variable available in shadertoy.com
// Replace with your own variable as needed
float t = iTime * scale; // scale time here
float a = clamp((mod(t, 2.0) - 1.0) * overshoot, -1.0, 1.0);
return sin(a * PI);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment