Hey guys
Need advice
There are two timelines, depending on the size of the window, the Timeline starts.
The difference is only xPercent & yPercent
Can ? Place xPercent/xPercent in a variable and change depending on the parameter
let sizeBnr = bnr.offsetWidth;
let pr = gsap.timeline();
window.onresize = function() {
setTimeout(function() {
sizeBnr = bnr.offsetWidth;
stAn(sizeBnr);
}, 500);
}
function stAn(raz) {
if (raz >= 560) {
an1();
} else if (raz >= 300) {
an2();
}
}
function an1() {
pr.add("st1")
.from('.rpanel', { xPercent: "+=100", delay: 0.5, duration: 0.65, ease: "power2.out" })
}
function an2() {
pr.add("st1")
.from('.rpanel', { yPercent: "+=100", delay: 0.5, duration: 0.65, ease: "power2.out" })
}
Or tell me how to properly separate streams / scripts