Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Demorus

Make only selected item animate

Recommended Posts

One technical question. I have more than 3 .ss classes. How exactly do I make it so that only the selected .ss class of this timeline is animated?

 

 

var t= new TimelineMax({paused:true});

t.to('.ss', 4,  {rotation: 360, ease:Bounce.easeOut})
t.reverse();

$('.ss').click(function() {;
    t.reversed() ? t.play() : t.reverse();
});

 

I would appreciate some insight. I know that  "each()" does the job but how exactly to implement it in this context?

Link to comment
Share on other sites

You can use the event that gets passed by default inside the click handler

$(".ss").click(function(e){
  var selectedItem = $(e.currentTarget);
  t.to(selectedItem, 4, {rotation: 360, ease:Bounce.easeOut});
  t.play();
});

Mind that reverse is applied to the whole timeline effect, if you want individual tweens that can be reversed you might want to try TweenMax/Lite.

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