Jump to content
Search Community

anu

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by anu

  1. Thanks guys for quick replies!! I'll look them closer but looks good!
  2. Hi, I have an array and I have put those contents to dynamically created divs like this var array = ["content1", "content2", "content3"]; var myVar = ""; for (j = 0 ; j < array.length; j++) { myVar += "<div id='name"+(j+1)+"'>"+array[j]+"</div>" } someDiv.innerHTML = myVar; So as a result of this, my page looks like <div id="someDiv"> <div id="name1">content1</div> <div id="name2">content2</div> <div id="name3">content3</div> </div> Now, I would like to put those dynamically in TimelineLite, so the result would be var tl = new TimelineLite(); tl.add( TweenLite.from(name1, 1, {left:0, opacity:0} ) ); tl.add( TweenLite.from(name2, 1, {left:0, opacity:0} ) ); tl.add( TweenLite.from(name3, 1, {left:0, opacity:0} ) ); So my question is, how can I put a variable inside TimelineLite constructor? I've tried for (k=1; k<array.length+1; k++){ tl.add( TweenLite.from(name+k, 1, {opacity:0} ) ); } but this doesn't work.. anyone? Thanks in advance!
×
×
  • Create New...