Replies: 1 comment 6 replies
-
Ok, so actually implementing the Fiddle solution in my app shows that it doesn't fully work. Hitting the same issue as other less elegant approaches I've tried. Certain pivot offsets don't adjust properly for the whole rotation. See Fiddle for pivot offset (-50, -25). Often when they don't work fully, 2 of the 4 rotation positions seem off. Is it a geometry thing I'm screwing up? I feel like the issue lies in lines 44-56. Too simplistic for every combo of center position, pivot position, and angle. Because top and left change perspectives as the object rotates, it is confusing for me to determine what change is needed in that area. Any ideas? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Peeking at the source code for rotate(), I turned that into an animation. Then wanted to tweak it to support off-centered rotation. I came up with this JSFiddle. It takes a rectangle, an offset, and for every click of the button rotates the rectangle 90 degrees around the initial offset point. I'm curious:
What I have looks like it will work, so not a huge deal, but guessing there is a better way and would like to learn. Any recommendations are appreciated.
Beta Was this translation helpful? Give feedback.
All reactions