Jump to content
Search Community

Rotating handles

Fork test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hey, all! I wanted to first say thanks for the great software; GreenSock's software is incredibly portable on mobile devices and just what I was looking for! :D

 

So, on to the code. I have made a rotating box thing. The green, red, and blue parts of the box are there to make visualization and debugging easier, since I will make them invisible later. Click and drag the green box to move the whole thing. Click and drag the blue circle to stretch that end of the box. It rotates and updates its width to follow where you want to place it. The red one, I haven't programmed anything for yet, so it doesn't do anything.

 

The problem I am having so far with it is that the blue dot does not always stay at the cursor, like if I drag it from the right side down so the shape is rotated 90 degrees, the cursor is to the left of it, and then if I continue dragging so it is at 180 degrees, the cursor is 32 pixels left of where it should be. Releasing and clicking again will cause it to stay at the cursor and gradually get farther away from it as it gets to another 90 and eventually 180 degree angle. It does this in all directions.

 

Can someone please take a look at my code and give me some input on how I can get it to stop doing this? Thanks, everyone! :)

 



Screenshot_0.png

See the Pen EKRXEE by Fork (@Fork) on CodePen

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.
×
×
  • Create New...