Shader Learn

03 Time, interaction and repetition

sin, cos: things that repeat

Frequency sets how dense, amplitude how tall.

0.28
0.020.45
ExerciseTune values0%

Draw this wave with three periods

Runs once per pixelDrag numbers, or edit the code

sin and cos take radians and return −1…1; multiply by 0.5 and add 0.5 to get 0…1.

Try it

  • Set the frequency to 1: exactly one period
  • Change sin to cos: how far does the wave shift?