Sean19 Posted November 11, 2019 Share Posted November 11, 2019 Hello. In the codepen I provided above I have it so that when a circle with the class of social is clicked, an alert is given with the x position of the circle. I did this because what I would like to do, is when a circle is clicked, I want the purple rectangle with id mix, to have its x position moved to under that circle. So for example, if the third circle is clicked, I want the purple rectangle to move x: 966. And then if the second one were clicked after that, I would want it to move back to the second one. Right now I just have the rectangle move x:200 so I can make sure I am selecting it properly. I was wondering if this was possible in GSAP. See the Pen wvvxgKW by joseph19 (@joseph19) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted November 11, 2019 Share Posted November 11, 2019 Hey Sean, This is definitely possible! Just have your function return that value and call it inside of your click listener. Then use that value in your tween See the Pen PooBWKz?editors=0010 by GreenSock (@GreenSock) on CodePen Thanks for the reduced case demo. 2 Link to comment Share on other sites More sharing options...
Sean19 Posted November 11, 2019 Author Share Posted November 11, 2019 Thank you @ZachSaucier. This is exactly what I needed. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now