From 432f20783f3292564ebe9ce5b2003281c6ed1934 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Mon, 3 Jul 2023 16:17:42 +0200 Subject: [PATCH] displace sesame --- css/sprint_4.css | 4 ++++ js/animations_custom.js | 39 ++++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/css/sprint_4.css b/css/sprint_4.css index c271596..a57cc8f 100644 --- a/css/sprint_4.css +++ b/css/sprint_4.css @@ -14424,8 +14424,12 @@ responsive land @media all and (min-width: 1300px){ + #hand{ + top: 15vh; + } #main_title{ top: 10vh; + min-height: 35vw; max-width: 1300px; max-height: 500px; } diff --git a/js/animations_custom.js b/js/animations_custom.js index 41906ba..f36a763 100644 --- a/js/animations_custom.js +++ b/js/animations_custom.js @@ -12,11 +12,14 @@ enable_animations = true const rotateYCard = '200deg' const offsetCard = '10' -let innerWidth = window.innerWidth; -document.onresize(event=> { - innerWidth = window.innerWidth; - console.log('innerWidth', innerWidth) -}) +let innerWidth = window.innerWidth +if (document.onresize) { + + document.onresize(event => { + innerWidth = window.innerWidth + console.log('innerWidth', innerWidth) + }) +} function animateCard (id, side) { @@ -38,8 +41,8 @@ function animateCard (id, side) { markers: development_debug, } } - fromObject[side] = 1; - toObject[side] = offsetCard; + fromObject[side] = 1 + toObject[side] = offsetCard gsap.fromTo('#content-' + id, fromObject, toObject) @@ -50,13 +53,13 @@ if (enable_animations) { gsap.fromTo('#for_all_your', { opacity: 0, - top: 100, - scale:0.5, + top: 100, + scale: 0.5, }, { opacity: 1, - top:0, - scale:1, + top: 0, + scale: 1, duration: 0.25, scrollTrigger: { trigger: '#for_all_your', @@ -65,12 +68,12 @@ if (enable_animations) { }) gsap.fromTo('#for_all_your_2', { opacity: 0, - scale:0.5, + scale: 0.5, }, { opacity: 1, duration: 1, - scale:1, + scale: 1, scrollTrigger: { trigger: '#for_all_your_2', delay: 0.4, @@ -86,13 +89,11 @@ if (enable_animations) { scrollTrigger: { trigger: '#unlock_white', delay: 1, - scrub:2, + scrub: 2, start: '+50% 80%' } }) - - gsap.to('#main_title', { delay: 1, // xPercent: ()=>nav.offsetHeight, @@ -101,8 +102,8 @@ if (enable_animations) { scrub: 1, markers: development_debug, }, - top: innerWidth > 1300 ? '15vw' : '30vw', - width: '-40vw', + top: innerWidth > 1300 ? '15vw' : '30vw', + width: '-40vw', }) @@ -219,7 +220,7 @@ if (enable_animations) { gsap.fromTo('#content_all_img', { scale: 1, - left: "-100" + left: '-100' }, { scale: 1.1,