Returns the cosine of this number.
This number is presumed to be a radian.
val = angle.cos()
The min and max describe the upper and lower bounds for a cosine wave. The cosine of this number is then multiplied against this range, to produce a value which is found within it.
This is for making it simpler to generate cosine waves.
Displays pretty colours, based on a cosine wave.
angle = 0.toRadians()
onEachFrame() do |delta|
angle = angle + delta/30
red = 130 + 60*angle.cos()
green = 120 + -60*angle.cos()
blue = 150 + 30*(angle*2).cos()
fill( red, green, blue )