Jump to content
Search Community

kasiuleckretulec

Members
  • Posts

    2
  • Joined

  • Last visited

kasiuleckretulec's Achievements

  1. Hello, I have a problem with component positioning: whenever hover is active, the images are displayed at the top of the page, not in the component area. How to deal with this? Should property "top", "left" be applied to a specific div with specific units? const scaleAnimation = { initial: { scale: 0, x: "-50%", y: "-50%" }, enter: { scale: 1, x: "-50%", y: "-50%", transition: { duration: 0.4, ease: [0.76, 0, 0.24, 1] }, }, closed: { scale: 0, x: "-50%", y: "-50%", transition: { duration: 0.4, ease: [0.32, 0, 0.67, 0] }, }, }; const Modal = ({ modal, portfolioLinks }) => { const { active, index } = modal; const container = useRef(null); useEffect(() => { const moveContainerX = gsap.quickTo(container.current, "left", { duration: 0.8, ease: "power3", }); const moveContainerY = gsap.quickTo(container.current, "top", { duration: 0.8, ease: "power3", }); window.addEventListener("mousemove", (e) => { const { clientX, clientY } = e; moveContainerX(clientX); moveContainerY(clientY); }); }); return ( <motion.div ref={container} variants={scaleAnimation} initial={"initial"} animate={active ? "enter" : "closed"} className="modalContainer" > <div style={{ top: index * -100 + "%" }} className="modalSlider"> {portfolioLinks.map((project, index) => { const { src, color } = project; return ( <div key={index} style={{ backgroundColor: color }} className="modal" > <img src={src} width={300} height={0} alt="image" className="modalImg" ></img> </div> ); })} </div> </motion.div> ); }; export default Modal;
  2. Hi! I have a problem with mapping through an array and displaying three images in a row. If I'm not using the map function images show very well (one by one) - I really want to know how to achieve this row animation Thanks for any suggestions and tips import { TweenMax, Power3 } from "gsap"; import gsap from "gsap"; import { useEffect, useRef } from "react"; import { Link } from "react-router-dom"; import { portfolioLinks } from "../../constants/index.jsx"; import "./Portfolio.scss"; const Portfolio = () => { const manageMouseEnter = (e, color) => { gsap.to(e.target, { backgroundColor: color, duration: 0.5 }); }; const manageMouseLeave = (e, color2) => { gsap.to(e.target, { backgroundColor: color2, duration: 0.5, delay: 0.1 }); }; let img1 = useRef(null); let img2 = useRef(null); let img3 = useRef(null); useEffect(() => { TweenMax.from(img1, 0.8, { opacity: 0, x: 40, ease: Power3.easeOut }); TweenMax.from(img2, 0.8, { opacity: 0, x: 40, ease: Power3.easeOut, delay: 0.2, }); TweenMax.from(img3, 0.8, { opacity: 0, x: 40, ease: Power3.easeOut, delay: 0.4, }); }); return ( <> <div className="container_portfolio"> <h1 className="h1_portfolio">Portolio</h1> <p className=" p_portfolio"> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </div> <div className="black_Line"></div> <div className="container_portfolioGroup"> {portfolioLinks.map((proto, index) => ( <> <Link className="link" onMouseEnter={(e) => { manageMouseEnter(e, proto.color); }} onMouseLeave={(e) => { manageMouseLeave(e, proto.color2); }} key={index.id} to={proto.to} > <div className="grid_Portfolio"> <h1 className="h1_Grid">{proto.title}</h1> <div className="containerImages"> <img src={proto.protoImg} ref={(el) => (img1 = el)} className="imagesRow" ></img> <img src={proto.protoImg2} ref={(el) => (img2 = el)} className="imagesRow" ></img> <img src={proto.protoImg3} ref={(el) => (img3 = el)} className="imagesRow" ></img> </div> </div> </Link> <div className="black_Line"></div> </> ))} </div> </> ); }; export default Portfolio;
×
×
  • Create New...