diff --git a/src/redux/reducers/scroll.js b/src/redux/reducers/scroll.js index 779e1b0..cd022e4 100644 --- a/src/redux/reducers/scroll.js +++ b/src/redux/reducers/scroll.js @@ -94,6 +94,8 @@ export default function scrollAction(state = initialState, action) { data.end ), }, + page2TopPosition: 0, + page2RotateX: 0, }; case "scroll/page2/mobilePosition": return { @@ -105,11 +107,13 @@ export default function scrollAction(state = initialState, action) { 2 * height, 2.5 * height ), + page2BoxPosition: { translateX: 32, translateY: 10, rotate: 0 }, }; case "scroll/page2/videoPosition": return { ...state, page2VideoPosition: scroll.videoLinearFormula(window.scrollY), + page2VideoTopPosition: 50, }; case "scroll/page2/videoTopPosition": return { @@ -121,6 +125,7 @@ export default function scrollAction(state = initialState, action) { 2.8 * height, 3 * height ), + page2MobilePosition: 6, }; case "scroll/page2/mobileUnit": return { @@ -130,6 +135,7 @@ export default function scrollAction(state = initialState, action) { case "scroll/videoTube/top": return { ...state, videoTubeTopPosition: scroll.homeScrollHandler(3) }; case "scroll/test/translateY": + const joiRect = JSON.parse(localStorage.getItem("joiRect")); return { ...state, testTranslateY: scroll.linearFormula( @@ -139,9 +145,16 @@ export default function scrollAction(state = initialState, action) { 4.5 * height, 5 * height ), + videoTubeTopPosition: 0, + page2VideoPosition: { + width: joiRect.width, + height: joiRect.height, + top: joiRect.top, + left: joiRect.left, + }, }; case "scroll/page3/top": - return { ...state, page3TopPosition: scroll.homeScrollHandler(4) }; + return { ...state, page3TopPosition: scroll.homeScrollHandler(4), testTranslateY : -101 }; case "scroll/page3/testTranslateY": return { ...state, @@ -152,9 +165,10 @@ export default function scrollAction(state = initialState, action) { 6.3 * height, 7 * height ), + page3TopPosition : 0, }; case "scroll/page4/top": - return { ...state, page4TopPosition: scroll.homeScrollHandler(5) }; + return { ...state, page4TopPosition: scroll.homeScrollHandler(5), page3TestTranslateY : 100 }; default: return state; } diff --git a/src/utils/scroll.js b/src/utils/scroll.js index 035ba1d..61b1486 100644 --- a/src/utils/scroll.js +++ b/src/utils/scroll.js @@ -8,51 +8,51 @@ class scroll { const height = Number(window.innerHeight); const scrollY = Number(window.scrollY); if (index === 1) { - if (prevScroll === 0) { + if (scrollY === 0) { return 0; }else - if (prevScroll > 0 && prevScroll <= height) { - return -prevScroll; + if (scrollY > 0 && scrollY <= height) { + return -scrollY; } - if (prevScroll > height) { + if (scrollY > height) { return -height; } } else if (index === 2) { - if (prevScroll === 0) { + if (scrollY === 0) { return height; } - if (prevScroll > 0 && prevScroll <= height) { - return height - prevScroll; + if (scrollY > 0 && scrollY <= height) { + return height - scrollY; } - if (prevScroll > 10 * height) { + if (scrollY > 10 * height) { return -1 * height; } } else if (index === 3) { - if (prevScroll <= 3.5 * height) { + if (scrollY <= 3.5 * height) { return height; } - if (prevScroll > 3.5 * height && prevScroll <= 4 * height) { - return 4 * height - prevScroll; + if (scrollY > 3.5 * height && scrollY <= 4 * height) { + return 4 * height - scrollY; } - if (prevScroll > 10 * height) { + if (scrollY > 10 * height) { return -height; } } else if (index === 4) { - if (prevScroll <= 5 * height) { + if (scrollY <= 5 * height) { return height; - } else if (prevScroll > 5 * height && prevScroll < 6 * height) { - return 6 * height - prevScroll; + } else if (scrollY > 5 * height && scrollY < 6 * height) { + return 6 * height - scrollY; } - if (prevScroll === 10 * height) { + if (scrollY === 10 * height) { return -height; } } else if (index === 5) { - if (prevScroll <= 7.3 * height) { + if (scrollY <= 7.3 * height) { return height; - } else if (prevScroll > 7.3 * height && prevScroll < 8.3 * height) { - return 8.3 * height - prevScroll; + } else if (scrollY > 7.3 * height && scrollY < 8.3 * height) { + return 8.3 * height - scrollY; } - if (prevScroll === 10 * height) { + if (scrollY === 10 * height) { return -height; } } diff --git a/src/views/Home/Landscape/index.js b/src/views/Home/Landscape/index.js index c32401f..78f65b5 100644 --- a/src/views/Home/Landscape/index.js +++ b/src/views/Home/Landscape/index.js @@ -138,7 +138,6 @@ function Home({