Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
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)

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!
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 5 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: