Animate and Center an Element to a Click Event with GreenSock

InstructorJohn Lindquist

Share this video with your friends

Send Tweet

Animating an element to a click event is as simple as passing the x and y coordinates of the click event to the properties of the TweenMax.to call. To be able to center the element where the mouse clicks, you also need to adjust the special xPercent and yPercent properties so the element is properly offset.