Jump to content
Search Community

Combining click and hover animation

Jason Baciulis test
Moderator Tag

Go to solution Solved by OSUblake,

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 Gedas  :)


You can have different functions for each event. Here's a pen I made as an answer to another forum question, but it should help.


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


You'll see that a timeline plays/reverses on mouseenter/mouseleave and a background fill color is set and removed on mousedown/mouseup. Hopefully that helps a bit.


Happy tweening.


  • Like 3
Link to comment
Share on other sites

  • Solution

It sounds like what you have might already be simpler than using GSAP for everything, but it's still possible. I show how to toggle animations based on various conditions in this thread.



Those demos use jQuery, but arrays have a map function too, so it works out pretty much the same.

See the Pen OWKevR?editors=1010 by osublake (@osublake) on CodePen



  • Like 2
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.
  • Create New...