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