Tag Archives: wavelengths

BASIC256 Sine Wave generator

Generates a sine wave, also corresponding to the waves of light.

graphsize 600,600
color red
fastgraphics
t=0
while true
clg
color grey
rect 0,0,600,600
j = mousex
color red
if j>100 then color orange
if j>150 then color yellow
if j>200 then color green
if j>250 then color blue
if j>270 then color purple
for n = 1 to 600 step 0.1
r=(mousey/20)*sin(t+n*(mousex/200))
#r=(mousey/20)*cos(t+n*(mousex/100))
#r=(mousey/20)*tan(t+n*(mousex/100))
circle 10*n,r+300,3
next n
refresh
t+=0.1
end while