Computer Science Canada

Spiral Back & Forth

Author:  bigone150 [ Tue May 05, 2009 8:25 pm ]
Post subject:  Spiral Back & Forth

Quote:
var k, r, x, y : int
r := 200
loop
randint (k, 1, 255)
% randint (x, 0, maxx)
% randint (y, 0, maxy)
for i : 0 .. 320 by 40
drawarc (200, 200, r, r, i, i + 40, k)
r := r - 1
end for
delay (100)
exit when r < 5
end loop
r:=200
k:=0
loop
%randint (k, 1, 255)
for decreasing i : 340 .. 0 by 20
drawarc (200, 200, r, r, i, i + 40, k)
r := r + 1
end for
delay (100)
exit when r < 200
end loop



umm thats my coding its for a spiral.. but after it goes towards the centre i want it to come back out like a reverse...

Author:  Ultrahex [ Tue May 05, 2009 9:39 pm ]
Post subject:  Re: Spiral Back & Forth

just start the radius at 0 or a small number, and increment instead of decrement it in a for loop.

The only difference between moving into centre and away from centre is the starting point (in terms of radius), and the direction of increment.


: