Jump to content
GreenSock

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

TweenMax.set

Recommended Posts

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!
Link to comment
Share on other sites

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);
Link to comment
Share on other sites

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