Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

transformAroundPoint with origin changing

Recommended Posts

I'm using transformAroundPoint for some things, but I've run into an issue that I'm not sure how to solve. I have some objects that are rotating around the edge of a circle, but the problem is that I'm now scaling the circle and need to move the objects along with it, but I don't want the objects to scale AND I need the objects to rotate. Here's an image to illustrate what I need to do.




Any thoughts? Thanks in advance.

Link to comment
Share on other sites

There are may ways to do this. You could use the CirclePath2D class that I created. I've attached an example FLA below.


Alternatively, you could put each object (the ones that are tweening around the perimeter) into their own container Sprite. I'd use the radius of the circle to dictate where I place that object in the container sprite. So if the circle has a 100 pixel radius, my object's x position would be 100. Then I'd make sure the circle and the container sprite share the same x/y coordinates (registration points match). Go ahead and tween the rotation of that container Sprite and you'll see it move around the circle. Then when you tween the size/scale of the circle, you'd simple adjust the x-coordinate of the object in the container Sprite to match the new radius of the circle. Feel free to use an onUpdate to do that or create your own class with a "radius" getter/setter that automatically does the work for you (in the setter). So if your circle's radius becomes 200, you change your object's x coordinate to 200 and you're golden - it doesn't matter what the rotation is.


Just a few ideas. Hope that helps.

Link to comment
Share on other sites

Thanks! I'll check out the CirclePath2D class for sure, but putting each item in its own container is probably how I'll go (although I wouldn't need transformAroundPoint anymore). I'm actually kinda mad at myself for not thinking of that.


Thanks so much!

Link to comment
Share on other sites

thank you for posting the zip. I have been curious and a bit mystified about the motionPath classes. This example makes it all ridiculously clear what they do and how they work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.