Computer Science Canada

How to make ripples shrink

Author:  rcmp1234 [ Sat Apr 05, 2008 5:44 pm ]
Post subject:  How to make ripples shrink

I am supposed to write a program showing the ripples shrinking once it reaches the top of the window
I tried using decreasing radius but it only shows one hollow circle shrinking and thats not what I want...I want the circles to disappear one by one

How do i do that?
Heres my program

const centerx := maxx div 2
const centery := maxy div 2
for radius : 1 .. centery by 10
delay (30)
drawoval (centerx, centery, radius, radius, magenta)
end for

for decreasing radius : centery .. 1 by 10

delay (30)
cls
drawoval (centerx, centery, radius, radius, magenta)

end for

Any help would be greatly appreciated

thanks

Author:  andrew. [ Sat Apr 05, 2008 6:26 pm ]
Post subject:  Re: How to make ripples shrink

Here you go.

I don't know why, but the decreasing moves the position by 2. It's weird but here.

Turing:
const centerx := maxx div 2
const centery := maxy div 2
for radius : 1 .. centery by 10
    delay (30)
    drawoval (centerx, centery, radius, radius, magenta)
end for

for decreasing radius : centery .. 1 by 10
    delay (30)
    drawoval (centerx, centery, radius+2, radius+2, white)
end for


P.S. Next time use the syntax="Turing" tags.

Author:  rcmp1234 [ Sat Apr 05, 2008 6:30 pm ]
Post subject:  RE:How to make ripples shrink

Thanks andrew!!

Author:  andrew. [ Sat Apr 05, 2008 9:03 pm ]
Post subject:  Re: How to make ripples shrink

No problem. Mr. Green

Author:  Mackie [ Sat Apr 05, 2008 10:13 pm ]
Post subject:  RE:How to make ripples shrink

andrew. don't do his work for him. He'll never learn anything that way, plus it is against the rules of the forum.


: