import React, { useState, useEffect } from "react"; import _ from "lodash"; import ARImage from "../../../../../../assets/images/ar.jpg"; import scroll from "../../../../../../utils/scroll"; export default function Video({ selectedVideo, videoPosition }) { const height = window.innerHeight; const [top, setTop] = useState(null); useEffect(() => { scroll.linearFormula( window.scrollY > 3 * height ? 3 * height : window.scrollY, 70, 50, 2.8 * height, 3 * height ); window.addEventListener("scroll", () => { videoTopPositionHandler(window.scrollY); }); }, []); const videoTopPositionHandler = (scrollY) => { if (scrollY < 2.8 * height) { setTop(() => 50); } else if (scrollY >= 2.8 * height && scrollY < 3 * height) { setTop(() => scroll.linearFormula(scrollY, 75, 50, 2.8 * height, 3 * height) ); } else { setTop(() => 50); } }; return (