Rain

Post Reply
DrChip
Posts: 167
Joined: Wed Oct 22, 2014 3:26 pm
My devices: iPhone 4 to 6+,iPad mini to iPad air 2

Rain

Post 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
Attachments
image.jpg
image.jpg (153.97 KiB) Viewed 1504 times
image.jpg
image.jpg (77.79 KiB) Viewed 1504 times
image.jpg
image.jpg (77.84 KiB) Viewed 1504 times
image.jpg
image.jpg (76.67 KiB) Viewed 1504 times
Last edited by DrChip on Fri Sep 04, 2015 2:31 am, edited 1 time in total.

DrChip
Posts: 167
Joined: Wed Oct 22, 2014 3:26 pm
My devices: iPhone 4 to 6+,iPad mini to iPad air 2

Re: Rain

Post by DrChip »

Change draw to fill for a different effect!

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Rain

Post by Mr. Kibernetik »

Very nice!

Post Reply