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. You have overflow hidden on your html/body, but are trying to use window.scrollTo, which is contradictory. Have you looked at using GSAP's scrollTo functionality/plugin? I also see multiple scroll bars in the CodePen, so I'm guessing that's also causing an issue.

    For your end value you spelled 'center' incorrectly, and your end value is triggering before your start value the way you have it setup.

    • Like 2
  2. Your fromTo needs more information, but it looks to me like you can just use a to animation for this. Example:

     

    gsap.to(
      ".right-door",
      {
        opacity: 0.85,
        scrollTrigger: {
          trigger: ".right-door",
          scrub: true,
          start: "top top"
        },
        xPercent: -50
      }
    );

     

    • Like 2
  3. 3 hours ago, Daniel Hult said:

    How would you play the timeline after all the child instanses are created without the interaction like clicking the button?


    Removing the button and taking the paused: true off the animation seems to play the animation just fine.

    The nature of setting things up like this, it's hard for React to know how many children/sub-children there are. That said, we set something similar to this up a long time ago, but I'm having trouble re-piecing it together in my head... this was when we were using pure components and lifecycles instead of hooks.

    • Like 1
  4. 19 hours ago, GreenSock said:

    using Flip.fit()

    @GreenSock: Is there a way to exclude a transform style in FLIP? The issue I'm now bumping into is my intertia plugin is continuing to transform my FLIP-element's rotationY slightly as it decelerates... I was hoping setting FLIP to simple: true, or disabling draggable would fix, but it seems not to, can I manually set a parameter?

    Here's the WIP... It's a bit more complex than my previous demo, but code should hopefully still be pretty easy to follow:

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

    • Like 3
  5. 15 minutes ago, Rodrigo said:

    The issue is that you're using as a trigger a class selector withou scoping it, so basically you're using all the elements with the class ".wrapper":

    Beat me to it! You'll also likely be able to remove the refs for span and header. And, since all the targets are being scoped now from the wrapper ref (Thank you gsap.context!) you can add a generic class to target rather than setting a unique id for each (unless you need that elsewhere).
     

    import { useRef, useEffect } from "react";
    
    import { gsap } from "gsap";
    import { ScrollTrigger } from "gsap/dist/ScrollTrigger";
    
    const Sectionheader = ({ span, head, id }) => {
      const wrapperRef = useRef()
    
      useEffect(() => {
        if (!wrapperRef.current) return;
        gsap.registerPlugin(ScrollTrigger);
        const ctx = gsap.context(() => {
          let tl = gsap.timeline({
            scrollTrigger: {
              trigger: wrapperRef.current,
              toggleActions: "restart reset restart reset",
              markers: true, 
              start: 'top bottom',
              end: 'bottom top'
            }
          });
          tl.from('gsap-span', {
            y: 30,
            opacity: 0,
            duration: 1,
            delay: 0.5,
            skewX: 3,
            ease: "power2.easeIn"
          }).from(
            '.gsap-head',
            {
              y: 30,
              opacity: 0,
              duration: 1,
              skewX: 3
            },
            +0.7
          );
    
        }, [wrapperRef.current]);
    
        return () => ctx.revert();
      }, []);
      return (
        <>
          <section ref={wrapperRef}>
            <p className="gsap-span">
              {span}
            </p>
            <h2 className="gsap-head" >
              {head}
            </h2>
          </section>
        </>
      );
    };
    
    export default Sectionheader;

     

    • Like 2
  6. The gsap/scrollTrigger objects would look something like this:

    gsap.to(el, {
      transformOrigin: '50% 0',
      rotateX: '50deg',
      scrollTrigger: {
        target: hero,
        start: 'top bottom'
        end: 'bottom top',
        scrub: true,
      }
    })

    You'll also want to make sure to set a perspective value in your CSS to the parent div.

    • Like 1
×
×
  • Create New...