|
| 1 | +"use client"; |
| 2 | +import gsap from "gsap"; |
| 3 | +import { useGSAP } from "@gsap/react"; |
| 4 | +import { ScrollSmoother, ScrollTrigger, SplitText } from "gsap/all"; |
| 5 | + |
| 6 | +import SimpleBtn from "../Button/SimpleBtn"; |
| 7 | +import Image from "next/image"; |
| 8 | + |
| 9 | +gsap.registerPlugin(ScrollTrigger, SplitText, ScrollSmoother); |
| 10 | + |
| 11 | +export default function Production() { |
| 12 | + // const container = useRef(null); |
| 13 | + |
| 14 | + useGSAP(() => { |
| 15 | + const SplitedText = new SplitText(".textTarget", { |
| 16 | + type: "chars, words", |
| 17 | + }); |
| 18 | + |
| 19 | + const productionTl = gsap.timeline({ |
| 20 | + scrollTrigger: { |
| 21 | + trigger: ".prod-container", |
| 22 | + start: "top 70%", |
| 23 | + end: "+=2000", |
| 24 | + scrub: 5, |
| 25 | + // markers: true, |
| 26 | + }, |
| 27 | + }); |
| 28 | + productionTl.from(".prod-img", { |
| 29 | + yPercent: 500, |
| 30 | + stagger: { |
| 31 | + each: 1, |
| 32 | + from: "random", |
| 33 | + }, |
| 34 | + }); |
| 35 | + productionTl.from(SplitedText.chars, { |
| 36 | + duration: 3, |
| 37 | + opacity: 0, |
| 38 | + scale: 0, |
| 39 | + y: 80, |
| 40 | + rotationX: 180, |
| 41 | + transformOrigin: "0% 50% -50", |
| 42 | + ease: "back", |
| 43 | + stagger: 0.05, |
| 44 | + }); |
| 45 | + }); |
| 46 | + return ( |
| 47 | + <section className="prod-container relative w-full h-screen flex flex-col justify-around items-center overflow-hidden"> |
| 48 | + <h2>How Bakery Should be Today</h2> |
| 49 | + <SimpleBtn title="About" /> |
| 50 | + |
| 51 | + {/* <div |
| 52 | + id="img-content" |
| 53 | + className="w-full flex flex-row justify-around items-center" |
| 54 | + > */} |
| 55 | + <Image |
| 56 | + className="prod-img absolute top-[10%] left-[10%]" |
| 57 | + id="prod-img" |
| 58 | + src={"/img/mae-mu.jpg"} |
| 59 | + width={200} |
| 60 | + height={200} |
| 61 | + alt="bakery image" |
| 62 | + /> |
| 63 | + <Image |
| 64 | + className="prod-img absolute top-[-20%] left-[40%]" |
| 65 | + id="prod-img" |
| 66 | + src={"/img/DecorativeArtisanBreads.jpeg"} |
| 67 | + width={200} |
| 68 | + height={200} |
| 69 | + alt="bakery image" |
| 70 | + /> |
| 71 | + <Image |
| 72 | + className="prod-img absolute top-[-30%] left-[70%]" |
| 73 | + id="prod-img" |
| 74 | + src={"/img/heather-barnes.jpg"} |
| 75 | + width={200} |
| 76 | + height={200} |
| 77 | + alt="bakery image" |
| 78 | + /> |
| 79 | + {/* </div> */} |
| 80 | + </section> |
| 81 | + ); |
| 82 | +} |
| 83 | + |
| 84 | +{ |
| 85 | + /* <div> |
| 86 | + <h2 className="textTarget text-3xl text-cake"> |
| 87 | + We believe good food brings people together. |
| 88 | + </h2> |
| 89 | + <h2> |
| 90 | + We use organic flour, local honey, and other natural ingredients |
| 91 | + </h2> |
| 92 | + <h2>That’s why we bake with heart and keep things eco-friendly</h2> |
| 93 | + </div> */ |
| 94 | +} |
0 commit comments