Page 1 of 1

Rain

Posted: Fri Apr 03, 2015 6:42 am
by DrChip

Code: Select all

rem rain - a simple raindrop effect
rem iPhone 6 Plus / 8.3 b4
rem Enjoy...

graphics
sw=screen_width()
sh=screen_height()


md=10 ' number of rain drops
dropsize = 40 ' max size of rain drops
dim dropx(md+1)
dim dropy(md+1)
dim dropr(md+1)

for a=1 to md
 dropx(a)=rnd(sw)
 dropy(a)=rnd(sh)
 dropr(a)=rnd(dropsize)
next a

loop:
refresh off
 graphics clear 0,0,50/255
 for a=1 to md
  bri=250-dropr(a)*5
  draw color 0,0,bri/255
  draw circle dropx(a),dropy(a) size dropr(a)
  dropr(a)=dropr(a)+1
  if dropr(a)>dropsize then
   dropx(a)=rnd(sw)
   dropy(a)=rnd(sh)
   dropr(a)=0
  end if
 next a
refresh on
goto loop

Re: Rain

Posted: Fri Apr 03, 2015 6:45 am
by DrChip
Change draw to fill for a different effect!

Re: Rain

Posted: Fri Apr 03, 2015 7:20 am
by Mr. Kibernetik
Very nice!