javascript - Can't keep elements from overlapping when using GSAPs stagger method -


so trying stagger letters using tweenmax.staggerto.

here js:

tweenmax.staggerto(letter, 2, {bottom:0, opacity: 1, delay: 2}, 1); 

the html:

<div class="middle">   <p class="letter">p</p>   <p class="letter">p</p>   <p class="letter">p</p>   <p class="letter">p</p> </div> 

and css:

.letter {   display: inline;   margin-right: 100px;   opacity: 0;   position: absolute; }  .middle {   text-align: center;   padding-top: 100px;   height: 100vh;   margin: auto;  } 

one of official tutorials watched explains position on element being animated needs have position property of either absolute or fixed.

i confused though, how can animate these objects without have them overlapping each other. example of going for: gsap staggered animated elements

thanks!

i got same problem and, please consider i'm beginner too, staggerto method not appropriate example.

let's @ official definition of staggerto method greensock :

tweens array of targets common set of destination values,  staggers start times specified amount of time, creating     evenly-spaced sequence surprisingly small amount of code. 

so, if understand, important thing keep in mind tweens array of targets common set of destination values. why letters overlapping eachother, have same destinations values, how staggerto method used basically.

what tried in order solve problem that, since of elements in array, used foreach() method in javascript , increments index each loop.

here codepen modified, please, feel free ask again if don't undestand : codepen solution

basically did doing simple timeline , adding method each letter.

hope helps !

happy tweening


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -