Draw spokes on a wheel

Mark Talluto userev at canelasoftware.com
Fri Mar 17 17:24:48 EST 2006


Wow!  Thanks for the quick help on this.  Man...my math is really  
lacking.  I'll be dissecting all the solutions below for some time.   
For the time being, I decided to bring all the solutions together for  
others to use and manipulate for your needs.  One things is for sure,  
I owe each of you a drink of your choice at the RevCon in Monterey  
this year.  I'll be the crazy guy walking around asking for each of you.


Malte, your solution worked great!

on mouseUp
   put item 1 of the loc of this cd into centerX
   put item 2 of the loc of this cd into centerY
   put 40 into isRadius
   put 60 into spokeLength
   repeat with isAngle=0 to 360 step 15
     put centerX+cos(isAngle*pi/180)*isRadius into isNewX1
     put centerY+sin(isAngle*pi/180)*isRadius into isNewY1
     put centerX+cos(isAngle*pi/180)*(isRadius+spokeLength) into isNewX2
     put centerY+sin(isAngle*pi/180)*(isRadius+spokeLength) into isNewY2
     put round(isNewX1),round(isNewY1)&cr after pointlist
     put round(isNewX2),round(isNewY2)&cr&cr after pointlist
   end repeat
   set the points of grc "wheel" to pointlist
end mouseUp

+++++

Dick Kriesel, your solution worked extra perfectly as it even set up  
for the inner diameter, outer circumference, and the line size.   
Thanks to you as well.  I decided to use this solution for my project.

on drawAstig pInnerDiameter,pOuterDiameter,pLineSize
   repeat with i = 0 to 345 step 15
     create graphic
     set the style of it to "oval"
     set the height of it to pOuterDiameter
     set the width of it to pOuterDiameter
     set the angle of it to i
     set the arcangle of it to 15
     set the opaque of it to "true"
     set the lineSize of it to pLineSize
   end repeat
   create graphic
   set the style of it to "oval"
   set the height of it to pInnerDiameter
   set the width of it to pInnerDiameter
   set the opaque of it to "true"
   set the foregroundColor of it to "white"
   create graphic
   set the style of it to "oval"
   set the height of it to pOuterDiameter+5
   set the width of it to pOuterDiameter+5
   set the foregroundColor of it to "white"
   set the lineSize of it to pLineSize + 4
end drawAstig

+++++

Jim Hurley, ahh yes...turtle graphics!  This is now in my bag of  
tricks as well!  Thanks!

on mouseUp
   startTurtle
   put 12 into tNumSpokes
   put 100 into tLengthSpokes
   repeat 360/tNumSpokes
     forward tLengthSpokes
     back tLengthSpokes
     left 360/tNumSpokes
   end repeat
   stopTurtle
end mouseUp


Paste this handler into a button in the stack:

go url "http://home.infostations.net/jhurley/StopTurtles.rev"

Or if you want something like the clock in your graphic;

go url "http://home.infostations.net/jhurley/Build_a_clock.rev"


+++++

Jim Ault, your solution worked as well. Thanks for your help!

Could you take a single line png, make copies, and
rotate.positionAboutTheCenter them?
Jim Hurly and Scott Rossi are far ahead of me in doing this sort of work
(ballClock, windowShape, bezier curves, circles, polygon offsets)   
More than
shaking my head,  I'm rattling my brain and rolling my eyes... shake  
rattle
and roll :-)

See you all in Monterey!



Mark Talluto
-- 
CANELA Software
http://www.canelasoftware.com




More information about the use-livecode mailing list