damus.io

damus.io website
git clone git://jb55.com/damus.io
Log | Files | Refs | README | LICENSE

EndThankYou.tsx (5413B)


      1 import { MotionValue, circOut, easeInOut, easeOut, motion, useMotionValue, useScroll, useTime, useTransform } from "framer-motion";
      2 import { PurpleIcon } from "../../icons/PurpleIcon";
      3 import { ArrowDown } from "lucide-react";import { useRef } from "react";
      4 
      5 export function EndThankYou() {
      6   const time = useTime()
      7   const ref = useRef<HTMLDivElement>(null)
      8   const { scrollYProgress } = useScroll({
      9     target: ref,
     10     offset: ["start start", "end end"]
     11   })
     12   const starProgress = useTransform(
     13     scrollYProgress,
     14     [0, 0.9],
     15     [0, 1],
     16     {
     17       clamp: true,
     18       ease: circOut
     19     }
     20   )
     21   const headingGradient = useTransform(
     22     time,
     23     [0, 3000],
     24     [
     25       "linear-gradient(to right, #000000 0%, #D34CD9 1000%, #F869B6 3000%)",
     26       "linear-gradient(to right, #000000 -10%, #D34CD9 0%, #F869B6 100%)"
     27     ],
     28     {
     29       clamp: true,
     30       ease: circOut
     31     }
     32   )
     33   const headingOpacity = useTransform(
     34     scrollYProgress,
     35     [0.5, 0.7],
     36     [0, 1],
     37     {
     38       clamp: true,
     39       ease: easeInOut
     40     }
     41   )
     42   const secondaryContentOpacity = useTransform(
     43     scrollYProgress,
     44     [0.7, 1.0],
     45     [0, 1],
     46     {
     47       clamp: true,
     48       ease: easeInOut
     49     }
     50   )
     51 
     52   return <div ref={ref} style={{ height: 3000 }} className="relative">
     53     <div className="sticky top-0 container z-30 mx-auto px-6 pt-12 h-auto min-h-screen flex flex-col gap-y-4 justify-center items-center pb-12">
     54       <PurpleStarIcon className="w-32 h-32 z-40" progress={starProgress} />
     55       <motion.h1
     56         className="text-4xl md:text-6xl text-center text-transparent bg-clip-text font-semibold break-keep tracking-tight z-30 pb-6"
     57         style={{
     58           backgroundImage: headingGradient,
     59           opacity: headingOpacity,
     60         }}
     61       >
     62         Thank you for your support in 2024!
     63       </motion.h1>
     64 
     65       <motion.div
     66         className="text-center text-purple-200/80 text-lg max-w-lg p-6 space-y-4 z-30"
     67         style={{ opacity: secondaryContentOpacity }}
     68       >
     69         <p>
     70           We would like to thank you for your continued support, from the bottom of our hearts. You help us make our mission possible. We are a small team, but we will keep working and doing our best to bring you the most innovative Nostr experience, and help build a better, freer future together in 2025!
     71         </p>
     72         <p className="text-3xl capitalize">
     73           Happy New Year!
     74         </p>
     75       </motion.div>
     76     </div>
     77   </div>
     78 }
     79 
     80 interface StarIconProps {
     81     className?: string;
     82     progress: MotionValue<number>;
     83 }
     84 
     85 function PurpleStarIcon(props: StarIconProps) {
     86   const { className, progress } = props;
     87 
     88   const purple1Color = "#D34CD9";
     89   const purple2Color = "#F869B6";
     90 
     91   const starScale = useTransform(
     92     progress,
     93     [0, 0.6],
     94     [3, 1.0],
     95     {
     96       clamp: true,
     97       ease: circOut
     98     }
     99   )
    100 
    101   const starOpacity = useTransform(
    102     progress,
    103     [0, 0.6],
    104     [0, 1],
    105     {
    106       clamp: true,
    107       ease: circOut
    108     }
    109   )
    110 
    111   const starShadowColor = useTransform(
    112     progress,
    113     [0, 0.8],
    114     [
    115       "#FFFFFF00",
    116       "#FFFFFFFF",
    117     ],
    118     {
    119       clamp: true,
    120       ease: circOut
    121     }
    122   )
    123 
    124   const gradientOffsetKeyframes = [0, 0.2, 1.0]
    125 
    126   const whiteGradientStopOffset = useTransform(
    127     progress,
    128     gradientOffsetKeyframes,
    129     ["0%", "0%", "70%"],
    130     {
    131       clamp: true,
    132       ease: circOut
    133     }
    134   );
    135 
    136   const purple2GradientStopOffset = useTransform(
    137     progress,
    138     gradientOffsetKeyframes,
    139     ["1%", "1%", "100%"],
    140     {
    141       clamp: true,
    142       ease: circOut
    143     }
    144   );
    145 
    146   const purple1GradientStopOffset = useTransform(
    147     progress,
    148     gradientOffsetKeyframes,
    149     ["2%", "2%", "125%"],
    150     {
    151       clamp: true,
    152       ease: circOut
    153     }
    154   );
    155 
    156   const blackGradientStopOffset = useTransform(
    157     progress,
    158     gradientOffsetKeyframes,
    159     ["3%", "3%", "250%"],
    160     {
    161       clamp: true,
    162       ease: circOut
    163     }
    164   );
    165 
    166   return (
    167     // Generated by Pixelmator Pro 3.6.8
    168     <motion.svg
    169       className={className}
    170       width="4267" height="4267" viewBox="0 0 4267 4267" xmlns="http://www.w3.org/2000/svg"
    171       style={{
    172         scale: starScale,
    173         opacity: starOpacity
    174       }}
    175     >
    176       <defs>
    177         <radialGradient id="purpleGradient" cx="150%" cy="-50%" r="250%">
    178           <motion.stop offset={whiteGradientStopOffset} style={{ stopColor: "#ffffff", stopOpacity: 1 }} />
    179           <motion.stop offset={purple2GradientStopOffset} style={{ stopColor: purple2Color, stopOpacity: 1 }} />
    180           <motion.stop offset={purple1GradientStopOffset} style={{ stopColor: purple1Color, stopOpacity: 1 }} />
    181           <motion.stop offset={blackGradientStopOffset} style={{ stopColor: "#000000", stopOpacity: 1 }} />
    182         </radialGradient>
    183         <filter id="whiteShadow" x="-50%" y="-50%" width="200%" height="200%">
    184           <motion.feDropShadow dx="0" dy="0" stdDeviation="500" floodColor={starShadowColor} />
    185         </filter>
    186       </defs>
    187       <path
    188         id="Star"
    189         fill="url(#purpleGradient)"
    190         stroke="url(#purpleGradient)"
    191         fill-rule="evenodd"
    192         stroke-width="400"
    193         stroke-linejoin="round"
    194         filter="url(#whiteShadow)"
    195         d="M 2133.5 750 L 1812.484985 1691.660645 L 817.713318 1705.975098 L 1614.086914 2302.267578 L 1320.299072 3252.774902 L 2133.5 2679.643311 L 2946.700928 3252.774902 L 2652.913086 2302.267578 L 3449.286621 1705.975098 L 2454.515137 1691.660645 Z"
    196       />
    197     </motion.svg>
    198   )
    199 }