Jump to content
Search Community

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

thewebdesignerpro
Posted

Hi,

 

Is this syntax correct for setting a property for several elements at one go?

 

 

function myFunc(a) {
   TweenMax.set([a], {css:{opacity:0}});
}
 
var a = 'id1, id2, id3, id4, id5';
myFunc(a);
 
 
Thanks!
thewebdesignerpro
Posted

Never mind, I got it. Should be..

 

function myFunc(a) {
   TweenMax.set(a, {css:{opacity:0}});
}
 
var a = [id1, id2, id3, id4, id5];
myFunc(a);
Posted

Hello thewebdesignerpro, Welcome to the GreenSock Forums!

 

Glad you figured it out. Just in case you need the link to the set() Docs

 

set() method:

http://api.greensock.com/js/com/greensock/TweenMax.html#set()

// if you want to set multipletargets at the same time
TweenMax.set([obj1, obj2, obj3], {x:100, y:50, opacity:0});

Parameters:

  • target:Object — Target object (or array of objects) whose properties will be affected.    
  • vars:Object — An object defining the value for each property that should be set. For example, to set mc.x to 100 and mc.y to 200, do this: TweenMax.set(mc, {x:100, y:200});

:)

  • Like 2
thewebdesignerpro
Posted

Thanks jonathan! 

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