Here is a Shadertoy shader that displays a red Archimedean spiral forming slowly at the cursor's position every 5 seconds.
🌪 Description:
- The spiral is drawn in red.
- It begins forming at the current cursor position (
iMouse.xy / iResolution.xy).
- Every 5 seconds, the spiral resets and grows again.
- The spiral grows smoothly over time within the 5-second cycle.
🔧 Code (GLSL for Shadertoy)
void mainImage(out vec4 fragColor, in vec2 fragCoord)
{
vec2 uv = fragCoord.xy / iResolution.xy;
// Normalize coordinates (-1 to 1)
vec2 pos = (fragCoord.xy / iResolution.xy) * 2.0 - 1.0;
pos.x *= iResolution.x / iResolution.y;
// Use mouse position normalized to screen coordinates
vec2 mouse = iMouse.xy / iResolution.xy;
mouse = mouse * 2.0 - 1.0;
mouse.x *= iResolution.x / iResolution.y;
// Reset every 5 seconds
float cycleTime = 5.0;
float t = mod(iTime, cycleTime) / cycleTime; // 0 to 1 within the cycle
// Spiral parameters
float rotations = 5.0; // number of turns
float maxRadius = 1.5; // maximum spiral radius
float a = 0.05; // spiral spacing factor
float spiralProgress = t; // grows from 0 to 1 over the cycle
// Convert pixel position to relative to mouse
vec2 relPos = pos - mouse;
float r = length(relPos);
float angle = atan(relPos.y, relPos.x);
// Make angle positive
if (angle < 0.0) angle += 6.28318;
// Target radius for given angle in spiral
float target_r = a * angle;
// Apply spiral progress (grow over time)
float current_max_angle = spiralProgress * (rotations * 6.28318); // spiralProgress * (2π * turns)
// Check if pixel is close to spiral curve and within progress
float spiralIntensity = 0.0;
if (angle <= current_max_angle)
{
float dist = abs(r - target_r);
float thickness = 0.005;
float fade = smoothstep(thickness, 0.0, dist);
spiralIntensity = fade;
}
vec3 color = vec3(0.0);
color += spiralIntensity * vec3(1.0, 0.0, 0.0); // Red spiral
fragColor = vec4(color, 1.0);
}
✅ How to Use:
- Go to https://shadertoy.com.
- Create a new shader or edit an existing one.
- Paste the code above.
- Move your mouse around — a red spiral grows at mouse position every 5 seconds.
💡 Notes:
- You can play with the parameters like
rotations, a, thickness to change the spiral behavior.
a controls spacing between spiral arms.
- Using
iMouse.z == 0.0 means the mouse hasn’t been clicked — you can adjust behavior accordingly.
Let me know if you want multiple spirals, color transitions, or interactive behavior! 🌈🌀