spinning arc s
Author 
Message 
Hackster

Posted: Sun Mar 07, 2004 7:20 pm Post subject: spinning arc s 


Hey ... i'm not gunna post in two forums again, but will someone help me with a program that makes a bunch of arcs turn in a circular pattern, i just can't figure out howto make alll the arcs turn at the same time ... heres my code
var midx := maxx div 4
var midy := 60
drawfillarc (midx, midy, 40, 10, 325, 35 , blue)
drawfillarc (midx, midy, 30, 10, 40 , 110 , red)
drawfillarc (midx, midy, 30, 10, 115 , 185 , yellow)
drawfillarc (midx, midy, 30, 10, 190, 260 , black)
drawfillarc (midx, midy, 30, 10, 265, 320 , green)
drawfillarc (midx, midy, 30, 10, 324, 36 , pink)






Sponsor Sponsor



Mazer

Posted: Sun Mar 07, 2004 7:33 pm Post subject: (No subject) 


It's easier when you don't hardcode angles when you are using arcs. In this case, I would just have a variable for the angle, and then have all the other angles to be the angle variable plus some constant. Since there are 6 arcs and I like things to be even, I add 60.
code: 
var midx := maxx div 4
var midy := 60
var angle := 0
drawfillarc (midx, midy, 30, 10, angle, angle+60, blue)
drawfillarc (midx, midy, 30, 10, angle+60, angle+120, red)
drawfillarc (midx, midy, 30, 10, angle+120, angle+180, yellow)
drawfillarc (midx, midy, 30, 10, angle+180, angle+240, black)
drawfillarc (midx, midy, 30, 10, angle+240, angle+300, green)
drawfillarc (midx, midy, 30, 10, angle+300, angle+360, brown)

Now, if you want to animate it you can do:
code: 
var midx := maxx div 4
var midy := 60
for angle : 0 .. 1080 by 5
put "whee!" % comment this line out so it doesn't look weird, I just added it for fun...
drawfillarc (midx, midy, 30, 10, angle, angle + 60, blue)
drawfillarc (midx, midy, 30, 10, angle + 60, angle + 120, red)
drawfillarc (midx, midy, 30, 10, angle + 120, angle + 180, yellow)
drawfillarc (midx, midy, 30, 10, angle + 180, angle + 240, black)
drawfillarc (midx, midy, 30, 10, angle + 240, angle + 300, green)
drawfillarc (midx, midy, 30, 10, angle + 300, angle + 360, brown)
delay (40)
end for







omni

Posted: Sun Mar 07, 2004 7:38 pm Post subject: (No subject) 


wouldn't you just change the start and initial angles?
If you want to keep the sizes of the portions the same, then shift all the coordinates over
Here is a method: (probably inefficient but gets the job done, I think)
var midx := maxx div 4
var midy := 60
var coors : array 1 .. 6 of int
var coore : array 1 .. 6 of int
coors (1) := 325
coore (1) := 35
coors (2) := 40
coore (2) := 110
coors (3) := 115
coore (3) := 185
coors (4) := 190
coore (4) := 260
coors (5) := 265
coore (5) := 320
coors (6) := 324
coore (6) := 36
var leaves, leavee : int
proc draw
drawfillarc (midx, midy, 30, 10, coors (1), coore (1), blue)
drawfillarc (midx, midy, 30, 10, coors (2), coore (2), red)
drawfillarc (midx, midy, 30, 10, coors (3), coore (3), yellow)
drawfillarc (midx, midy, 30, 10, coors (4), coore (4), black)
drawfillarc (midx, midy, 30, 10, coors (5), coore (5), green)
drawfillarc (midx, midy, 30, 10, coors (6), coore (6), purple)
end draw
loop
leaves := coors (1)
leavee := coore (1)
for a : 1 .. upper (coors)  1
coors (a) := coors (a + 1)
coore (a) := coore (a + 1)
end for
delay (100)
coors (6) := leaves
coore (6) := leavee
draw
end loop






Hackster

Posted: Sun Mar 07, 2004 7:47 pm Post subject: (No subject) 


well, mazer, that prog , with the words actually makes it look really cool!!
Thanks , both those work perfectly, ill take both into account.






apomb

Posted: Sun Mar 07, 2004 8:20 pm Post subject: (No subject) 


You should look at my nicname program, it has exactly the thing you might be looking for!







