Command Palette

Search for a command to run...

Hectal
Phase 14: Under the Hood: Raw WebGL 2 and WebGPU
3D Web · Exercise 4 of 4 Previous
Advanced

A glow that respects motion

The overlay (already written) draws the rear light's glow every frame. Write its two rules from Topic 14.6.

glowBrightness(time, moving): a steady 0.8 when moving is false; otherwise a pulse between 0.3 and 1 at 1.5 per second. facingFade(dot): 0 at −0.5 or below, 1 at 0.3 or above, a smooth step between.

What Check tests

  1. Steady 0.8 when motion is off
  2. While moving it pulses between 0.3 and 1
  3. No more than 3 pulses per second (WCAG 2.3.1)
  4. facingFade: 0 from the front, 1 from behind, smooth between
  5. The overlay draws every frame

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.