Jump to content
Search Community

gareth

Business
  • Posts

    108
  • Joined

  • Last visited

Posts posted by gareth

  1. I am trying to fix a title until it reaches the section below. It all works fine unless I resize the window which can change the height of the title (if it goes onto more lines) and so the end position is now wrong. 

     

    I am using the title height in order to position it correctly

     

     var titleHeight = document.querySelector(".project-title").offsetHeight;

    Inside scrolltrigger:

      end: "top bottom-=" + titleHeight,

     

    How can I update the titleHeight on browser resize ? or is there another way to set this value dynamically during the scroll so it always checking what the current height is? 

     

    See the Pen zYLRjxv?editors=1010 by garethworld (@garethworld) on CodePen

  2. I am trying to animate type along a svg path. Thanks to some help from demos on this forum, I am very close to the effect I am after. 

     

    The problem I have is the kerning (space between each letter ) is messed up. I understand this is because I am not allowing for the individual character widths within my start and end positions. Is it possible to access these within the forEach loop?

    See the Pen jOmeadL by garethj (@garethj) on CodePen

  3. I am trying to blend a linear gradient fill of a svg so it cycles through a few colors. The gradient looks how I want, but the tween feels very choppy. I know this is because of the way I have used stagger, but not sure what approach to take to make is color change smoother, but still have the gradient change from left to right?

     

     

    See the Pen wvJWYXd by garethj (@garethj) on CodePen

  4. @ZachSaucier Thank you for taking the time to explain how to code more efficiently with gsap, this is what I ended up with: 

     

    const colors1 = ['#ffae65', '#ffd898', '#acaf9d'];
    const colors2 = ['#110029', '#f61317', '#ffa600'];
    const colors3 = ['#ffb72f', '#e1ceb7', '#8199ac'];
    const colors4 = ['#ffb72f', '#e1ceb7', '#8199ac'];
    const colors5 = ['#ffb075', '#ff8c73', '#e0508c'];
    const colors6 = ['#ffb075', '#ff8c73', '#e0508c'];
    const colors7 = ['#00f050', '#00f050', '#00f050'];
    
    
    const gradTl = gsap.timeline({defaults: { duration:1, stagger:.2,ease:"Power4.inOut" } });
    
    gradTl.to("#gradient stop", {keyframes: [ 
      {stopColor: (i) => colors1[i]},
       {stopColor: (i) => colors2[i]},
       {stopColor: (i) => colors3[i]},
       {stopColor: (i) => colors5[i]},
       {stopColor: (i) => colors6[i]},
       {stopColor: (i) => colors7[i]}
    ]});
    
    gsap.from("#sun", 10, {y:200,ease:"Power4.inOut"})

     

    The bit I am still unsure of is how to loop through the colors arrays in a timeline tween. 

  5. I have a site with ajax page loads (using highway js). On one of the pages I have a looping timeline tween.

     

    Should I try and kill this tween on page exit or is it killed anyway because the elements are removed from the dom? I reinitialise it on each page visit. 

  6. thanks so much for having a go at this, but I actually meant the amount of drag it takes to go the next snap point.

     

    In my demo you will see you have to drag the next div past the red line or it snaps back, I was hoping you could move halfway towards the line and then it would snap forward. 

×
×
  • Create New...