Jump to content
Search Community

Xurshed

Members
  • Posts

    20
  • Joined

  • Last visited

Posts posted by Xurshed

  1. Hey, guys! My ScrollTrigger animation starts earlier and before its position. Plus, it appears over the previous component. I don't know what am i doing wrong. I appreciate if you can solve my problem. Please help with this, this is soo urgent!

        gsap.registerPlugin(ScrollTrigger)
        useEffect(() => {
            let tl = gsap.timeline({
                scrollTrigger: {
                    trigger: '#wrapper-letters',
                    scrub: true,
                    pin: true,
                    start: 'top center',
                    end: "+=" + (window.innerHeight * 3),
                    markers: true,
                }
            })
            tl.to('#letter-c', 1.5, {
                opacity: 1,
                y: -100
            })
                .to('#letter-r', 1.5, {
                    opacity: 1,
                    y: -100
                })
                .to('#letter-e', 1.5, {
                    opacity: 1,
                    y: -100
                })
                .to('#letter-a', 1.5, {
                    opacity: 1,
                    y: -100
                })
                .to('#letter-t', 1.5, {
                    opacity: 1,
                    y: -100
                })
                .to('#text-container', {
                    rotate: -90,
                    duration: 3,
                })
                .to('#letter-new', {
                    opacity: 1,
                    x: -50,
                    duration: 1.5
                })
    
                .to('#letter-c', {
                    y: -400,
                    duration: 1.5,
                })
                .to('#letter-r', {
                    y: -400,
                    duration: 1.5,
                })
                .to('#letter-e', {
                    y: -400,
                    duration: 1.5,
                })
                .to('#letter-new', {
                    x: -350,
                    duration: 1.5,
                })
                .to('#letter-a', {
                    y: -400,
                    duration: 1.5,
                })
                .to('#letter-t', {
                    y: -400,
                    duration: 1.5,
                })
                .to('#word-container', {
                    rotate: 90,
                    duration: 1.5,
                    x: 0,
                    y: 0,
                    z: 0,
                })
                .to('#all-container', {
                    color: '#000'
                })
                .to('#letter-p', {
                    opacity: 1,
                    y: -100,
                    duration: 1.5
    
                })
                .to('#letter-second-a', {
                    opacity: 1,
                    y: -100,
                    duration: 1.5
    
                })
                .to('#letter-second-t', {
                    opacity: 1,
                    y: -100,
                    duration: 1.5
    
                })
                .to('#letter-h', {
                    opacity: 1,
                    y: -100,
                    duration: 1.5
                })
                .to('#letter-s', {
                    opacity: 1,
                    y: -100,
                    duration: 1.5
                })
                .to('#all-container', {
                    opacity: 0,
                    duration: 2
                })
        }, [ScrollTrigger])

     

  2. Hello guys, I am trying to make a component like https://b14.dk/14years/ exactly, but I couldn't get the result that I want. I hope you guys can help me with this problem. I am not understanding the logic of this component. Thank you! But it is very urgent

     

     

     

    ort React, {useEffect} from "react";
    import {Wrapper, Image, Container, FirstChild, SecondChild, BeImage} from "./style";
    import {gsap} from 'gsap'
    import {ScrollTrigger} from 'gsap/ScrollTrigger';
    
    const BeBold = () => {
        gsap.registerPlugin(ScrollTrigger);
        useEffect(() => {
            const beText = document.querySelector('.bla-hello');
            gsap.timeline({
                scrollTrigger: {
                    trigger: beText,
                    start: "top top",
                    end: "bottom top",
                    scrub: true,
                    pin: '#first-child',
                }
            });
    
    
    
            const sections = gsap.utils.toArray('.imageToShow');
    
            console.log(sections)
            let tl = gsap.timeline();
            sections.forEach((section, index) => {
              
                tl.to(section, {
                    scale: 1.2,
                    scrollTrigger: {
                        trigger: section,
                        start: 'top bottom -= 300',
                        toggleActions: 'play none none reverse',
                        scrub: true,
                    }
                })  
    .to('#img500', {
                    scrollTrigger: {
                        trigger: beText,
                        start: 'top 0',
                        scrub: true,
                    },
                    opacity: 1
                })
        return (
            <div>
                <Wrapper>
                    <Container className="bla-hello">
                        <FirstChild id={"first-child"}>
                            <BeImage id="img101" src="https://b14.dk/14years/images/bebold/be-bold-be.svg"
                                     alt="kitty"/>
                        </FirstChild>
                        <SecondChild>
                            <Image id="img100" className="imageToShow"
                                   src="https://b14.dk/14years/images/bebold/be-bold-light.svg"
                                   alt="kitty"/>
                            <Image id="img200" className="imageToShow"
                                   src="https://b14.dk/14years/images/bebold/be-bold-book.svg"
                                   alt="kitty"/>
                            <Image id="img300" className="imageToShow"
                                   src="https://b14.dk/14years/images/bebold/be-bold-medium.svg"
                                   alt="kitty"/>
                            <Image id="img400" className="imageToShow"
                                   src="https://b14.dk/14years/images/bebold/be-bold-demi.svg"
                                   alt="kitty"/>
                            <Image id="img500" className="imageToShow"
                                   src="https://b14.dk/14years/images/bebold/be-bold-bold.svg"
                                   alt="kitty"/>
                        </SecondChild>
                    </Container>
                </Wrapper>
            </div>
        )
    }
    
    export default BeBold;

    This code is written in react.

    Screenshot 2021-07-17 180009.png

×
×
  • Create New...