Jump to content
GreenSock

Catalin R.

Draggable Picker

Moderator Tag

Recommended Posts

Hi,

I like this animation very much! Can anyone help me to get, onThrowComplete event, to get a data or to add a class to the current item (that from middle with red title)?

Thanks!

See the Pen wvgaLxQ?editors=0010 by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

You'd have to either craft an algorithm to figure it out (math based on the timeline's time mapped to the closest snapping point and which element is biggest at that point). I don't have time to do that for you, but here's a fork that just finds the biggest element at that point: 

See the Pen ExWwRZM?editors=0010 by GreenSock (@GreenSock) on CodePen

 

let biggestElement = cells.slice(0).sort((a, b) => gsap.getProperty(a, "scaleX") - gsap.getProperty(b, "scaleX")).pop();

Then you can do whatever you want with that. Add a class or whatever. 

  • Like 1
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.
×