|
|
|
@ -3,11 +3,13 @@ import _ from "lodash"; |
|
|
|
|
import scroll from "../../../utils/scroll"; |
|
|
|
|
import Mobile from "./Mobile"; |
|
|
|
|
import qrImage from "../../../assets/images/qrImage.png"; |
|
|
|
|
import leftBg from "../../../assets/images/page-bg.png"; |
|
|
|
|
import rightBg from "../../../assets/images/page-bg.png"; |
|
|
|
|
import leftBg from "../../../assets/images/page-bg-1.png"; |
|
|
|
|
|
|
|
|
|
export default function Page2({ list, page, autoPlay }) { |
|
|
|
|
const height = window.innerHeight; |
|
|
|
|
const [top, setTop] = useState(window.innerHeight); |
|
|
|
|
const [scale, setScale] = useState(null); |
|
|
|
|
const [videoPosition, setVideoPosition] = useState(null); |
|
|
|
|
const [unit, setUnit] = useState(null); |
|
|
|
|
const [boxPosition, setBoxPosition] = useState({ |
|
|
|
@ -28,6 +30,16 @@ export default function Page2({ list, page, autoPlay }) { |
|
|
|
|
2.5 * height |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
setScale( |
|
|
|
|
scroll.linearFormula( |
|
|
|
|
window.scrollY > height ? height : window.scrollY, |
|
|
|
|
0.8, |
|
|
|
|
1, |
|
|
|
|
0, |
|
|
|
|
height |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
if (window.scrollY > 3.5 * height && window.scrollY < 4 * height) { |
|
|
|
|
setVideoPosition( |
|
|
|
|
window.scrollY > 4 * height |
|
|
|
@ -90,6 +102,7 @@ export default function Page2({ list, page, autoPlay }) { |
|
|
|
|
window.addEventListener("scroll", (e) => { |
|
|
|
|
const scrollY = window.scrollY; |
|
|
|
|
setTop(scroll.homeScrollHandler(page)); |
|
|
|
|
setScale(scaleHandler(scrollY)); |
|
|
|
|
boxPositionHandler(scrollY); |
|
|
|
|
mobilePositionHandler(scrollY); |
|
|
|
|
if (window.scrollY > 2 * height && window.scrollY < 3.5 * height) { |
|
|
|
@ -192,6 +205,24 @@ export default function Page2({ list, page, autoPlay }) { |
|
|
|
|
setUnit(4); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const scaleHandler = (scrollY) => { |
|
|
|
|
if (scrollY === 0) { |
|
|
|
|
setScale(0.8); |
|
|
|
|
} else if (scrollY > 0 && scrollY <= height) { |
|
|
|
|
setScale( |
|
|
|
|
scroll.linearFormula( |
|
|
|
|
scrollY, |
|
|
|
|
0.8, |
|
|
|
|
1, |
|
|
|
|
0, |
|
|
|
|
height |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
setScale(1); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
return ( |
|
|
|
|
<div |
|
|
|
|
onClick={(e) => e.stopPropagation()} |
|
|
|
@ -207,12 +238,14 @@ export default function Page2({ list, page, autoPlay }) { |
|
|
|
|
? 90 - (window.scrollY / height) * 90 |
|
|
|
|
: 0 |
|
|
|
|
: 90 |
|
|
|
|
}deg)`,
|
|
|
|
|
}deg) scale(${scale})`,
|
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<div |
|
|
|
|
className={_.join( |
|
|
|
|
["relative shadow-2xl transform flex bg-white text-center"], |
|
|
|
|
[ |
|
|
|
|
"relative shadow-2xl transform flex bg-white text-center overflow-hidden", |
|
|
|
|
], |
|
|
|
|
" " |
|
|
|
|
)} |
|
|
|
|
style={{ |
|
|
|
@ -223,11 +256,12 @@ export default function Page2({ list, page, autoPlay }) { |
|
|
|
|
> |
|
|
|
|
<div className="w-1/2 h-full relative"> |
|
|
|
|
<img |
|
|
|
|
src={leftBg} |
|
|
|
|
src={rightBg} |
|
|
|
|
alt="" |
|
|
|
|
// style={{
|
|
|
|
|
// transform: `rotate(-${boxPosition.rotate}deg))`,
|
|
|
|
|
// }}
|
|
|
|
|
className="w-full" |
|
|
|
|
/> |
|
|
|
|
<video |
|
|
|
|
className={_.join( |
|
|
|
@ -244,12 +278,17 @@ export default function Page2({ list, page, autoPlay }) { |
|
|
|
|
/> |
|
|
|
|
</video> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div className="absolute left-5 top-5 h-40 w-40"> |
|
|
|
|
<div className="w-1/2 h-full relative"> |
|
|
|
|
<img |
|
|
|
|
src={leftBg} |
|
|
|
|
alt="" |
|
|
|
|
className="absolute w-full h-full left-0 top-0" |
|
|
|
|
/> |
|
|
|
|
<div className="absolute left-5 top-5 h-40 w-40 z-10 bg-white"> |
|
|
|
|
<img src={qrImage} alt="" /> |
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
className="absolute left-7 bg-black" |
|
|
|
|
className="absolute left-7 bg-black z-10" |
|
|
|
|
style={{ |
|
|
|
|
height: (window.innerHeight * 9) / 25 - 40, |
|
|
|
|
width: (window.innerHeight * 10) / 20 - 16, |
|
|
|
@ -257,6 +296,7 @@ export default function Page2({ list, page, autoPlay }) { |
|
|
|
|
}} |
|
|
|
|
></div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
{/* mobile phone */} |
|
|
|
|
<Mobile |
|
|
|
|
mobilePosition={mobilePosition} |
|
|
|
|