diff --git a/src/assets/videos/COD.mp4 b/src/assets/videos/COD.mp4 new file mode 100644 index 0000000..0263b2a Binary files /dev/null and b/src/assets/videos/COD.mp4 differ diff --git a/src/utils/scroll.js b/src/utils/scroll.js index 5b1d532..4ebf1f5 100644 --- a/src/utils/scroll.js +++ b/src/utils/scroll.js @@ -6,22 +6,21 @@ class scroll { // return 0; if (scrollY === 0) { return 0; - } - if(scrollY > 0 && scrollY < 7 * height) { + } + if (scrollY > 0 && scrollY < 7 * height) { return -scrollY; - } - if(scrollY === 7 * height){ - return -height; } - }else - if (index === 2) { + if (scrollY === 7 * height) { + return -height; + } + } else if (index === 2) { if (scrollY === 0) { return height; - } + } if (scrollY > 0 && scrollY < height) { return height - scrollY; - } - if(scrollY === 7 * height){ + } + if (scrollY === 7 * height) { return -1 * height; } } @@ -29,52 +28,47 @@ class scroll { // if (index === 3) { // if (scrollY <= height) { // return height; - // } + // } // if (scrollY > height && scrollY < 3 * height) { // return 2 * height - scrollY; - // } + // } // if(scrollY === 4 * height){ // return -height; // } // } - else - if (index === 4) { + else if (index === 4) { if (scrollY <= 2 * height) { return height; } else if (scrollY > 2 * height && scrollY < 3 * height) { return 3 * height - scrollY; - } - if(scrollY === 4 * height){ + } + if (scrollY === 4 * height) { return -height; } - }else - if (index === 5) { + } else if (index === 5) { if (scrollY <= 3 * height) { return height; } else if (scrollY > 3 * height && scrollY < 4 * height) { return 4 * height - scrollY; - } - if(scrollY === 5 * height){ + } + if (scrollY === 5 * height) { return -height; } - }else - if (index === 6) { + } else if (index === 6) { if (scrollY <= 4 * height) { return height; } else if (scrollY > 4 * height && scrollY < 5 * height) { return 5 * height - scrollY; - } - if(scrollY === 6 * height){ + } + if (scrollY === 6 * height) { return -height; } - - }else - if (index === 7) { + } else if (index === 7) { if (scrollY <= 5 * height) { return height; } else if (scrollY > 5 * height && scrollY < 6 * height) { return 6 * height - scrollY; - } + } // if(scrollY === 7 * height){ // return; // } @@ -92,13 +86,19 @@ class scroll { // } }; - linearFormula = (currentScroll, position1, position2, scroll1, scroll2 ) => { + linearFormula = (currentScroll, position1, position2, scroll1, scroll2) => { const alpha = (currentScroll - scroll1) / (scroll2 - scroll1); const deltaPosition = position2 - position1; const currectPosition = position1 + deltaPosition * alpha; return currectPosition; - } + }; + + doubleLinearFormula = (currentScroll) => { + const rect = document.getElementsById("video").getClientRects(); + console.log(rect); + return 1; + }; } const _scroll = new scroll(); diff --git a/src/views/Home/Page2/Mobile/index.js b/src/views/Home/Page2/Mobile/index.js index 72b5aa4..f36bd78 100644 --- a/src/views/Home/Page2/Mobile/index.js +++ b/src/views/Home/Page2/Mobile/index.js @@ -1,5 +1,7 @@ import React, { useEffect, useState } from "react"; -import _ from 'lodash'; +import _ from "lodash"; +import codVideo from "../../../../assets/videos/COD.mp4"; +import scroll from '../../../../utils/scroll'; export default function Mobile({ mobilePosition }) { const [checked, setChecked] = useState(mobilePosition > 0 ? true : false); @@ -13,7 +15,14 @@ export default function Mobile({ mobilePosition }) { return (