03-01 Sinusoids

Overview:

  • plotting sinusoids
  • sinusoidal motion
  • Lissajous curves
  • controlling other properties
  • lerp, map, constrain
  • Perlin noise

Plotting Sinusoids:

  • Math:       y = a + b sin (cx + d)
  • Code:        y = a + b * sin (c * x + d);

Where:

  • The stuff inside parentheses is in radians
  • x = input to the function (often, a horizontal coordinate)
  • y = output of the function (often, the vertical coordinate of the plotted function)
  • a = offset (the vertical location of the wave)
  • b = amplitude (the peak-to-peak height of the wave)
  • c = frequency (how many cycles there are)
  • d = phase offset (where the cycle starts)

Live demo:

Sinusoidal movement:

Live demo

Coding Train video:

Lissajous Curves

Controlling Other Properties with Sinusoids

You can use a sinusoid to control position, size, color, rotation, etc. etc. etc.

 

Lerp, Map, Constrain

 

Other Topics

  • Perlin Noise

Perlin Noise Loop: