Jump to content
Search Community

One tween or set for more elements?

Web Dizajner test
Moderator Tag

Go to solution Solved by PointC,

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

Is is possible to use one tween (from, to, fromTo) or set for more elements:

 

example:

 

tl.from(element1, element2, element3, 1, {}); or

 

tl.to(element1, element2, element3, 1, {}); or

 

tl.fromTo(element1, element2, element3, 1, {}); or

 

tl.set(element1, element2, element3, 1, {});

 

 

I am particulary interested for SET, when I must SET at once many elements.

 

Example, on start 10 elements are hidden and then at some time they all are visible at once and then again at some time some of them are hidden at once.

Link to comment
Share on other sites

  • Solution

Hi Web Dizajner :)

 

Yes - you can do that. I'd probably recommend putting a class on your targets and target the class, but you can target an array of elements.

// if they are variable names, put them in an array
tl.set([element1, element2, element3], {...});

// or just target IDs or classes like this 
tl.set("#myDiv1, #myDiv2, #myDiv3", {...});

Happy tweening.

:)

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