Move to the points of an oval?

Jacques Hausser jacques.hausser at unil.ch
Sat Dec 19 08:38:51 EST 2009


Le 19 déc. 2009 à 07:19, Mark Swindell a écrit :

> Is it possible to move an object along the points of an oval?
> 
> If not, is it possible to copy an exact oval with the curve tool (and move along that)?
> 

Hi Mark

a suggestion:

command Orbite theObject ax,bx,centerX,centerY
   --  theObject: long name of the object to be rotated (so you can use any kind of object)
   --  ax,bx: half length  of the horizontal and the vertical axes of the orbite (if equal, the move will be circular)
   --  centerX,centerY: center of rotation
   repeat forever
      if the mouse is down then exit repeat -- or any other exit test
      repeat with i = 0 to 90
         put round(ax*sin(4*i*pi/180))+centerx, round(bx*cos(4*i*pi/180)) + centery into laloc
         set the loc of theobject to laloc
         wait 5 millisecond -- can be tuned for speed and softness of the move
      end repeat
   end repeat
end Orbite

Could be improved, for example with the definition of a starting point. If left as it is, the starting point 
will always be the bottom point of the orbit.

Jacques

******************************************
Prof. Jacques Hausser
Department of Ecology and Evolution
Biophore / Sorge
University of Lausanne
CH 1015 Lausanne
please use my private address:
6 route de Burtigny
CH-1269 Bassins
tel/fax: 	++ 41 22 366 19 40
mobile:	++ 41 79 757 05 24
E-Mail:	jacques.hausser at unil.ch
*******************************************




More information about the use-livecode mailing list