From 5c8f485fbf4f82e78cc559f0cf1d0a13edda5c87 Mon Sep 17 00:00:00 2001 From: maamokun/MikanDev Date: Fri, 26 Jul 2024 12:59:42 +0900 Subject: [PATCH] pointless interactivity --- app/ui/SpinningGallery.tsx | 128 +++++++++++++++++++++++-------------- 1 file changed, 79 insertions(+), 49 deletions(-) diff --git a/app/ui/SpinningGallery.tsx b/app/ui/SpinningGallery.tsx index 1309c91..662ed08 100644 --- a/app/ui/SpinningGallery.tsx +++ b/app/ui/SpinningGallery.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { motion } from "framer-motion"; +import { motion, useInView, type Variants } from "framer-motion"; import Image from "next/image"; interface SpinningGalleryProps { @@ -14,24 +14,22 @@ const SpinningGallery: React.FC = ({ images, }) => { const filteredImages = images.slice(0, images.length); + const ref = React.useRef(null); + const isInView = useInView(ref, { once: true }); + + const containerVariants: Variants = { + hidden: { scale: 0 }, + visible: { scale: 1, transition: { duration: 0.5 } }, + }; return (
- Center Image = ({ position: "absolute", }} > - {filteredImages.map((img, index) => { - const angle = index * (360 / filteredImages.length); - const transform = `rotate(${angle}deg) translate(200px) rotate(-${angle}deg)`; + + {filteredImages.map((img, index) => { + const angle = index * (360 / filteredImages.length); + const transform = `rotate(${angle}deg) translate(200px) rotate(-${angle}deg)`; - return ( -
- - {`Image - -
- ); - })} + + + {`Image + + +
+ ); + })} + +
+ Center Image +
); };