(function ($) { ('use strict'); // Detect mobile device (Do not remove!!!) var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Nokia|Opera Mini/i.test(navigator.userAgent) ? true : false; if (isMobile) { $('body').addClass('is-mobile'); } var tl = gsap.timeline(); var $pageAppear = $('.appear'); if ($pageAppear.length) { tl.from( $pageAppear, { duration: 2, y: 40, autoAlpha: 0, stagger: 0.3, ease: Expo.easeOut, clearProps: 'all', }, 1.5, ); } //PARALLAX ITEM $('.parallax-item').wrap('
'); const itemWraps = document.querySelectorAll('.parallax-item-wrap'); const calcValue = (value, inputMax, inputMin, outputMax, outputMin) => { const percent = (value - inputMin) / (inputMax - inputMin); const output = percent * (outputMax - outputMin) + outputMin; return output; }; itemWraps.forEach(function (itemWrap) { const item = itemWrap.querySelector('.parallax-item'); itemWrap.addEventListener('mousemove', function (e) { const mouseX = e.clientX; const mouseY = e.clientY; const rect = itemWrap.getBoundingClientRect(); const offsetX = rect.left + rect.width / 2; const offsetY = rect.top + rect.height / 2; const deltaX = mouseX - offsetX; const deltaY = mouseY - offsetY; const percentX = deltaX / (itemWrap.clientWidth / 2); const percentY = deltaY / (itemWrap.clientHeight / 2); TweenMax.to(item, 0.5, { x: calcValue(percentX, 1, -1, 20, -20), y: calcValue(percentY, 1, -1, 20, -20), rotationX: calcValue(percentY, 1, -1, 5, -5), rotationY: calcValue(percentX, 1, -1, -5, 5), ease: Power1.easeOut, }); }); itemWrap.addEventListener('mouseleave', function (e) { TweenMax.to(item, 0.5, { x: 0, y: 0, rotationX: 0, rotationY: 0, ease: Power1.easeOut, }); }); }); //GSAP scrollTrigger gsap.registerPlugin(ScrollTrigger); let animationRotate = document.querySelectorAll('.animation-rotate'); animationRotate.forEach((animationRotate) => { gsap.to(animationRotate, { duration: 2, rotation: 360, ease: 'linear', repeat: -1, }); }); let scrollRotate = document.querySelectorAll('.scroll-rotate'); scrollRotate.forEach((scrollRotate) => { gsap.to(scrollRotate, { scrollTrigger: { trigger: scrollRotate, scrub: 2, }, rotation: 720, }); }); let scrollMoveRight = document.querySelectorAll('.scroll-move-right'); scrollMoveRight.forEach((scrollMoveRight) => { gsap.to(scrollMoveRight, { x: 500, duration: 1.5, scrollTrigger: { trigger: scrollMoveRight, start: 'top 30%', scrub: 2, }, }); }); let scrollMoveLeft = document.querySelectorAll('.scroll-move-left'); scrollMoveLeft.forEach((scrollMoveLeft) => { gsap.to(scrollMoveLeft, { x: -500, duration: 1.5, scrollTrigger: { trigger: scrollMoveLeft, start: 'top 30%', scrub: 2, }, }); }); let scrollMoveRight2 = document.querySelectorAll('.scroll-move-right2'); scrollMoveRight2.forEach((scrollMoveRight2) => { gsap.to(scrollMoveRight2, { x: 800, duration: 1.5, scrollTrigger: { trigger: scrollMoveRight2, start: 'top 80%', scrub: 2, }, }); }); let scrollMoveLeft2 = document.querySelectorAll('.scroll-move-left2'); scrollMoveLeft2.forEach((scrollMoveLeft2) => { gsap.to(scrollMoveLeft2, { x: -400, duration: 1.5, scrollTrigger: { trigger: scrollMoveLeft2, start: 'top 100%', scrub: 2, }, }); }); let scrollMoveUp = document.querySelectorAll('.scroll-move-up'); scrollMoveUp.forEach((scrollMoveUp) => { gsap.to(scrollMoveUp, { y: -400, duration: 1.5, scrollTrigger: { trigger: scrollMoveUp, start: 'top 20%', scrub: 2, }, }); }); let growUp = document.querySelectorAll('.grow-up'); growUp.forEach((growUp) => { gsap.fromTo( growUp, { autoAlpha: 0.5, scale: 0.7, }, { autoAlpha: 1, duration: 2, scale: 1, scrollTrigger: { trigger: growUp, start: 'top 90%', }, stagger: 0.2, }, ); }); let scrollZoomIn = document.querySelectorAll('.scroll-zoom-in'); scrollZoomIn.forEach((scrollZoomIn) => { gsap.to(scrollZoomIn, { scrollTrigger: { trigger: scrollZoomIn, start: 'top 10%', scrub: 2, }, scale: 1.2, }); }); let scrollZoomIn2 = document.querySelectorAll('.scroll-zoom-in-2'); scrollZoomIn2.forEach((scrollZoomIn2) => { gsap.to(scrollZoomIn2, { scrollTrigger: { trigger: scrollZoomIn2, start: 'top 90%', scrub: 2, }, scale: 1, }); }); let scrollZoomOut = document.querySelectorAll('.scroll-zoom-out'); scrollZoomOut.forEach((scrollZoomOut) => { gsap.to(scrollZoomOut, { scrollTrigger: { trigger: scrollZoomOut, start: 'top 5%', scrub: 2, }, scale: 0.5, }); }); $('.scoll-reduce-border-radius').each(function () { $(this).wrap(''); }); let reduceBorderRadius = document.querySelectorAll('.scoll-reduce-border-wraper'); reduceBorderRadius.forEach((reduceBorderRadius) => { gsap.to(reduceBorderRadius, { scrollTrigger: { trigger: reduceBorderRadius, start: 'top 98%', end: 'top 50%', duration: 0, scrub: 2, }, borderRadius: '0', }); }); let revealContainers = document.querySelectorAll('.reveal-img'); revealContainers.forEach((revealContainers) => { let image = revealContainers.querySelector('img'); let tl4 = gsap.timeline({ scrollTrigger: { trigger: revealContainers, toggleActions: 'restart none none reset', }, }); tl4.set(revealContainers, { autoAlpha: 1 }); tl4.from(revealContainers, 1.5, { xPercent: -100, ease: Power2.out, }); tl4.from(image, 1.5, { xPercent: 100, scale: 1.3, delay: -1.5, ease: Power2.out, }); }); //TEXT-UP if ($(window).width() > 500) { $('.text-up').each(function () { $(this).wrap('