Jump to content
Search Community

Drexel

Premium
  • Posts

    8
  • Joined

  • Last visited

Posts posted by Drexel

  1. This might be sometime simple that I am missing. I have a couple simple scorllTrigger elements and they work just fine. I also have a simple mobile menu that I built and is using absolute position to sit over the entire viewport when activated. This is also working as intended. What I can't seem to figure out is the elements that I applied scrollTrigger on are sitting on top of my absolute positioned elements. No matter how big I make the z-index for the mobile menu the scorllTrigger elements are always on top. I'm hoping this is a simple thing that I overlooked in the docs. 

     

    After a little more digging it seems that this is causing the issue
    gsap.set(".yellow-bar", {transformOrigin: "left center"});

    When you scroll the codepen you should not be able to see the bars

     

    added a codepen to show the issue

    See the Pen KKXyYao by icekomo (@icekomo) on CodePen

  2. I have a simple animation of a red box. I have a main timeline and each animation is broken into different functions and those functions return their timeline and that is added to the main timeline. Since I am using .from for each call I would think that the red box will animation from the position it is sitting in the DOM originally. This works for the first one as expected, but the 2nd .from seems to use the "+=500" as the ending point. So when moveTwo is called the red box ends up at the +=500 position. Why doesn't the red box animation from the position of 0 each time? Do I have to use a set to capture that original position because the first .from is actually setting the x position of the red box? 

    Thanks for clearing this up for me.

     

    const mainTL = gsap.timeline();
    
    function moveOne(){
            const tl = gsap.timeline();
      		tl.from("#red",{x:"+=500", duration:1})
      		return tl;
    }
    
    function moveTwo(){
            const tl = gsap.timeline();
      		tl.from("#red",{x:"-=200", duration:1})
      		return tl;
    }
    
    mainTL.add(moveOne())
        .add(moveTwo());

     

    See the Pen bGoGGjP by icekomo (@icekomo) on CodePen

×
×
  • Create New...