Jump to content
GreenSock

Ves

Any suggestions how to improve animation

Go to solution Solved by PointC,

Recommended Posts

Hello there!
I'm open to any suggestions, how to improve this list animation. I'm trying to create list animation. When we scroll to .target section, scroll stops, and then next animation starting. All good so far. But the list animation is not correct. It's should be visible 3 items in a time, and the middle one is highlighted. But i've got some bugs with it.
I will be grateful for any help.

See the Pen YzeBmpK by vasya-ves (@vasya-ves) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @Ves :)

 

Welcome to the forum.

 

I think I'd wire this up a bit differently. I'd create a timeline and scrub through it rather than add individual triggers to each element. Something like this.

See the Pen BaYbaNb by PointC (@PointC) on CodePen

 

Hopefully that helps. Happy tweening and welcome aboard.

:)

 

  • Like 2
Link to comment
Share on other sites

Hi, @PointC !
Your solution is much easier and works like a charm! Thank you so much!

Maybe you have time to clarify 2 things, i don't quiet understand in your code.
Why you disable warnings in tis line gsap.config({ trialWarn: false });
And this line, why multiple by 3?

let newHeight = targets[0].offsetHeight * 3;

Link to comment
Share on other sites

We multiply by 3, because we want to show 3 items in a time. Sorry for not thinking 

Link to comment
Share on other sites

11 hours ago, Ves said:

We multiply by 3, because we want to show 3 items in a time.

Exactly. :)

 

You wouldn't need to do it with JS. You could also just set a height for the <li> elements and manually set a height for the <ul> in your CSS. The trialWarn:false thing is just for CodePen so you don't see any warnings in the console. Nothing at all to do with the animations.

 

Happy tweening.

:)

 

  • Like 2
Link to comment
Share on other sites

@PointC thank you so much for clarification and your help!

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