Jump to content
Search Community

elegantseagulls last won the day on March 29 2023

elegantseagulls had the most liked content!

elegantseagulls

Members
  • Posts

    712
  • Joined

  • Last visited

  • Days Won

    13

Posts posted by elegantseagulls

  1. 1 hour ago, mindthegap said:

    rotation  is done

    I'd imagine this is cause it's an absolute value and once it rotates to that value (transform: rotate(-170deg)) it's trying to just tween from that value to that value, so it's not doing anything. Maybe try a relative value using += or -= eg: rotation: '-=170',.

    • Like 1
  2. Also, have you tried the useLayoutEffect(() => {},[]) hook? It sounds to me like ScrollTrigger is trying to calculate things before the layout is done rendering (with it working on resize). Or make sure to check if your ref is available in the dom before running your function.

    This may also be helpful with this (useIsomorphicLayoutEffect):

     

    • Like 1
  3. 2 hours ago, DanielLav said:

    I want all the animations that are in the standardAnim function to run immediately on page load without waiting for the headerItem to load.

    Not sure what your dev structure looks like, but you could put the headerItem tl after the standardAnim() function call. That way if that function is there, it'll put that into the timeline before it looks at the headerItem addition to the timeline. If you can't do that, you could do something like:

     

      const tl = gsap.timeline();
      const headerTL = gsap.timeline()
      const standardTL = gsap.timeline()
      const headerItem = $(".category-header__item")
    
      headerTL.to(headerItem, {
        ease: 'back',
        autoAlpha: 1,
        duration: 10,
      })
      
      function standardAnim() {
        standardTL.to('.category-bg__standard', {
        autoAlpha: 1,
        scale: 1,
        duration: .6
        }, '<')
        .from('.category-standard__item', {
        ease: 'slow',
        autoAlpha: 0,
        scale: 0,
        duration: 1.8
        })
        .from('.category-title', {
        ease: 'slow',
        autoAlpha: 0,
        y: 70,
        duration: 3.4
        })
      }
    
      if($('.category-standard')[0]) {
         console.log('Standard')
         standardAnim()
      }
    
     tl.add(standardTL).add(headerTL)


     

  4. The issue with this is that the horizontal animations are technically part of the scroll. If you try to skip these sections, you'll either have to pass a large blank space (the space the horizontal scrub is actually scrolling when pinned) or you'll have to re-flow the page, which is really difficult to calculate the current/previous/future scroll positions, and browsers don't like to repaint things like this, so there'll likely be some glitchyness.

  5. 14 minutes ago, teste_brazil_1998 said:

    convert this button to my React site

    @chrisgannon has a lot of complexities going on in his button. I'd recommend starting simple with your own design and working up from there than just trying to pull a larger complex animation into your site all at once.

    • Like 2
  6. const tl = gsap.timeline()
    
    tl.to(['.sun', '.moonMask', '.moon'], {
      attr: gsap.utils.wrap([{cx:'-=140', cy:'-=20'}, {cx:'-=140', cy:'-=20'}, {cx:'-=90',  cy:'-=0'}]),
      duration: 1, 
      stagger: yourStaggerAmount // yours is currently none, so you could remove this line
    }

    Check out GSAP's wrap utility to compare to the old cycle: https://greensock.com/docs/v3/GSAP/UtilityMethods/wrap()


    I haven't had my coffee yet, so let me know if this has issues

     

  7. 10 minutes ago, benji.3s.money said:

    You can see from a simple codepen it outputs a lot of logs whenever GSAP does its thing in Firefox Developer

    I just tried this in FF Dev, and am not seeing anything gsap realated in the logs. I just updated my browser today, and nothing different. I wonder if you have a setting toggled in your Dev Tools in FF, but I couldn't find any that'd cause this.

    • Like 1
  8. 11 minutes ago, pixelarchitect said:

    yPercent to higher values it still is not vertically aligned

    Ah yes, that's cause it's taking the transformed position of the element.

     

    const parallax50 = gsap.utils.toArray('.parallax50');
    parallax50.forEach(lax50 => {
      gsap.fromTo(lax50, {
        yPercent: 50,
      }, {
        yPercent: -50,
        ease: 'none',
        scrollTrigger: {
          trigger: lax50,
          start: "-50% bottom", //top of element (offsetting 50% "from" transform), bottom of viewport
          end: "50% top",  //bottom of element (offsetting -50% "to" transform), top of viewport
          scrub: true,
          markers: true,
        }
      });
    });

     

    • Like 1
  9. 6 minutes ago, pixelarchitect said:

    So in my example the text should be vertical aligned with the other once it reaches the center of the screen

    Try this:

     

    gsap.fromTo(lax50, { 
      yPercent: 50,
    }, {
      yPercent: -50,
      ease: 'none',
      scrollTrigger: {
        trigger: lax50,
        start: "top bottom", //top of element, bottom of viewport
        end: "bottom top",  //bottom of element, top of viewport
        scrub: true,
        markers: true,
      }
    })

     

  10. 1 hour ago, Avenues said:

    idea behind a wrap element

    This is to prevent a horizontal scroll bar, which can mess things up (transforms vs real scroll).

    If you want the box animation to be longer/tied to the pin, you'll maybe want to consider adding it as part of the timeline, and dividing the timeline's duration up to match the ratio of each animation. I updated my codepen to show how this would look:

    See the Pen ExegKJN?editors=0010 by elegantseagulls (@elegantseagulls) on CodePen

    • Like 1
  11. The apple site is adding a position: sticky; to the text, then achieving the gradient effect by animating a mix-blend-mode: darken; colored gradient vertically (in that same sticky container). You could do the same thing with ScrollTrigger and pinning, pretty easily.

    Similar to this, but animating a gradient instead of parts of a shoe:

    See the Pen gOabMXv by GreenSock (@GreenSock) on CodePen

    • Like 2
×
×
  • Create New...