import gsap from 'gsap';
import { useEffect, useRef } from 'react';
export default function Modal() {
const modalContainer = useRef(null);
useEffect(() => {
let xMoveContainer = gsap.quickTo(modalContainer.current, 'left', { duration: 0.8, ease: 'power3' });
let yMoveContainer = gsap.quickTo(modalContainer.current, 'top', { duration: 0.8, ease: 'power3' });
window.addEventListener('mousemove', (e) => {
const { pageX, pageY } = e;
xMoveContainer(pageX);
yMoveContainer(pageY);
})
},[])
return (
<motion.div
className='h-[350px] w-[400px] absolute bg-white overflow-hidden pointer-events-none flex items-center justify-center'
ref={modalContainer}
>
<div className='absolute h-full w-full' style={{ top: index * -100 + '%', transition: 'top 0.5s cubic-bezier(0.76, 0, 0.24, 1)' }}>
{projects.map((project, index) => {
const { src, color } = project;
return (
<div className='w-full h-full flex justify-center items-center' key={index} style={{ backgroundColor: color }}>
<Image src={`/${src}`} width={300} height={0} alt='image' className='h-auto' />
</div>
);
})}
</div>
</motion.div>
);
}
{ duration: 0.8, ease: 'power3' }
: