conditionnal animation on window height

This commit is contained in:
Tykayn 2023-06-30 15:04:18 +02:00 committed by tykayn
parent f5c2814ee8
commit 040bc7347e

View File

@ -12,6 +12,12 @@ enable_animations = true
const rotateYCard = '200deg' const rotateYCard = '200deg'
const offsetCard = '10' const offsetCard = '10'
let innerWidth = window.innerWidth;
document.onresize(event=> {
innerWidth = window.innerWidth;
console.log('innerWidth', innerWidth)
})
function animateCard (id, side) { function animateCard (id, side) {
console.log('animateCard', '#content-' + id + ' .flip-handle', side, offsetCard) console.log('animateCard', '#content-' + id + ' .flip-handle', side, offsetCard)
@ -86,6 +92,7 @@ if (enable_animations) {
}) })
gsap.to('#main_title', { gsap.to('#main_title', {
delay: 1, delay: 1,
// xPercent: ()=>nav.offsetHeight, // xPercent: ()=>nav.offsetHeight,
@ -94,7 +101,7 @@ if (enable_animations) {
scrub: 1, scrub: 1,
markers: development_debug, markers: development_debug,
}, },
top: '15vw', top: innerWidth > 1300 ? '15vw' : '30vw',
width: '-40vw', width: '-40vw',
}) })