Jump to content
GreenSock

Daniel Hult

Gsap slideshow animation

Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi!

In the codepen example - I have a slideshow with a small function called "animateSlide" that just maked the h1 tag red. At the moment it's happening very slow eventhough I've set it to one second. Any ideas why? :)

See the Pen aeqMMY by daniel-hult (@daniel-hult) on CodePen

Link to comment
Share on other sites

That's happening because you keep adding tweens to the end of the timeline. Each click adds a one second tween in your animateSlide() function. You may want to use timeline.clear() at the beginning of that function.

 

Happy tweening.

:)

 

  • Like 2
Link to comment
Share on other sites

Thanks for the reply! I tried implementing that, but then it doesn't do the animation when I click again.
I want the animation to run each time I click :D 

Link to comment
Share on other sites

How about this:

timeline.fromTo(nextHeading, 1, {color: 'white'}, {color:"red"});

Does that 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.
×