Page 1 of 1

Slinky

Posted: Sat Feb 21, 2015 12:25 am
by DrChip
rem Slinky
rem having fun

randomize

setup:
graphics
sw=screen_width()
sh=screen_height()
s=5
springs=70
timer=150
delay = .04

loop:
'refresh off
graphics clear 0,0,0
gosub spring
'refresh on
goto loop

spring:
if s>15 then s=5
mm=mm+0.5
r=100*sin(mm)
g=100*sin(mm/2)
b=100*sin(mm/3)
if r<20 and g<20 and b<20 then r=100
timer=timer-1
if timer=0 then
s=s+5
timer=150
end if
l=200*sin(b/8)
m=200*cos(b/7)
for a=1 to springs
x=sw/2+l*sin((b+a)/s)
y=sh/2+m*sin((b+a)/20)
draw color r/255,g/255,b/255
draw circle x,y size 50
pause delay
next a
b=b+.05

return