Easy Game effectsAnimated

Shine sweep on a button

A gold rounded button with a soft diagonal band of light that sweeps across it again and again.

The target picture for the shader challenge "Shine sweep on a button"
Recreate this picture. You pass at a 99% match, then try to write it in fewer characters than the par.

How this challenge works

You write a fragment shader that draws the picture above, live in your browser. A match bar shows how close you are, and the score combines accuracy, code size (the par is 502 characters in Unity (Built-in)) and GPU speed. Work in HLSL, GLSL, WGSL, Metal or Godot and export the result when you are done.

The numbers you need

Space
p = (uv - 0.5) * float2(aspect, 1.0)
Button
rounded box: q = abs(p) - float2(0.29, 0.06); d = length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - 0.06; edge 0.0 → 0.004
Slanted coordinate
s = p.x + p.y * 0.5
Band position
lerp(-0.7, 0.7, frac(time * 0.5))
Band
1.0 - smoothstep(0.0, 0.1, abs(s - position))
Colors
background float3(0.08, 0.08, 0.12), button float3(0.95, 0.65, 0.15), shine float3(1.0, 1.0, 1.0) * 0.6 * band

Solve it in your language

Unity (Built-in), Unity (URP), Unreal, Shadertoy / WebGL, OpenGL (LWJGL, raylib), three.js, GameMaker, LÖVE (Lua), Godot, Apple (iOS, macOS), WebGPU / Bevy.

Start coding