Grab an graphic along a circular path
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 184
- Joined: Wed Apr 10, 2013 5:09 pm
Grab an graphic along a circular path
Hi,
I have an small circular graphic that sits on the border of a larger circular graphic. I would like to be able to move the smaller graphic around by the mouse, but only move it along the points of the larger graphic. Does anyone know how to do this?
Thanks,
Andrew
I have an small circular graphic that sits on the border of a larger circular graphic. I would like to be able to move the smaller graphic around by the mouse, but only move it along the points of the larger graphic. Does anyone know how to do this?
Thanks,
Andrew
Re: Grab an graphic along a circular path
Hi Andrew,
look here
http://forums.livecode.com/phpBB2/viewt ... pse#p23350
it is a stack from Jim Hurley that I modified a bit. It lets you make a circle with two circle on top and restricts to movement of the top circles to the points of the underlying circle.
See if this works for you.
Kind regards
Bernd
look here
http://forums.livecode.com/phpBB2/viewt ... pse#p23350
it is a stack from Jim Hurley that I modified a bit. It lets you make a circle with two circle on top and restricts to movement of the top circles to the points of the underlying circle.
See if this works for you.
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 184
- Joined: Wed Apr 10, 2013 5:09 pm
Re: Grab an graphic along a circular path
Hi Bernd,
Thanks for the stack, it is almost what I am looking for. However, I tried to resize to elipse to a circle and the smaller graphic did not adjust to the new path.
Any ideas?
Thanks,
Andrew
Thanks for the stack, it is almost what I am looking for. However, I tried to resize to elipse to a circle and the smaller graphic did not adjust to the new path.
Any ideas?
Thanks,
Andrew
Re: Grab an graphic along a circular path
Hi Andrew,
change the parameters here in the script of button "Draw ellipse":
then click on button "Draw Ellipse"
then move the red dot, the red dot and the blue dot should follow the newly drawn ellipse. The blue dot always opposite to the red dot.
Axi
Kind regards
Bernd
change the parameters here in the script of button "Draw ellipse":
Code: Select all
put the loc of grc 1 into tLoc
put item 1 of tLoc into x0
put item 2 of tLoc into y0
put 70 into semiMajorAxis -- change diameter here
put 70 into semiMinorAxis -- change diameter here
put 66 into tiltAngle -- change axis here, only needed if ellipse
then move the red dot, the red dot and the blue dot should follow the newly drawn ellipse. The blue dot always opposite to the red dot.
Axi
Kind regards
Bernd
Re: Grab an graphic along a circular path
Hate to blow my own horn, but *toot toot*...
If you like, you can take a look at animationEngine, which has quite a few methods for constrained dragging.
All the best,
Malte
If you like, you can take a look at animationEngine, which has quite a few methods for constrained dragging.
All the best,
Malte
Re: Grab an graphic along a circular path
I'll blow the horn for Malte. Animation Engine will make this task a breeze and lots more besides. A highly valuable library of extremely well written and documented code with great demos. Really, take a look. (No association with Malte beyond being a fan)
Re: Grab an graphic along a circular path
I would like to chime in 
Toot, toot
Malte does a wonderful job making animation easy.
Kind regards
Bernd

Toot, toot
Malte does a wonderful job making animation easy.
Kind regards
Bernd