HatakeK
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by HatakeK
-
-
I'm rotating an svg on mouseenter, and currently just reversing the rotation with .reverse(1) on mouseleave. What I'd like to do on mouseleave is to tween the rotation counter-clockwise back to the starting point -- i.e. rotation % 360 == 0. E.g. if rotation is 780 when mouseleave, it should rotate back to 720.
I couldn't find a way to do this "natively", so I tried getting the current rotation of the svg when mouseleave event fires, but I can't seem to get this value. I read in the SVG-tips that
Quote{...] The same goes for any transforms - if you rotate or move or whatever in CSS, Chrome reports it as scale:1, rotation:0, translate:0, etc. So when GSAP asks the browser for the current value, it'll get bogus data.
Is there another way to get the current rotation or a simpler way to do this rotation snap?
See the Pen awpQZm?editors=1010 by HatakeK (@HatakeK) on CodePen
Snap rotation
in GSAP
Posted
Found a decent solution I think -- I wrongly presumed that the tween
would continue to increase the rotation beyond 360. Since it doesn't, I can simply do this on mouseleave:
Thanks anyway
PS -- I'm absolutely in love with GSAP!!
See the Pen MoJxpW?editors=1010 by HatakeK (@HatakeK) on CodePen