HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/quadcode/frontend/src/js/components/animations/AnimationSustainability.js
import { gsap, Power4 } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { swiperResponsibility } from "../swiper/SwiperResponsibility";
import { headerRemoveWhite, headerWhite } from "../header/Header";

gsap.registerPlugin(ScrollTrigger, Power4);

const letter = document.querySelectorAll('.main-screen__title-letter');

export const AnimationSustainability = () => {
  window.scrollTo(0, 0);
  gsap.to(".main-screen__desc", {y: 0, duration: 1, opacity: 1, delay: .2});
  Array.from(letter).forEach((el) => {
    gsap.to(el, {
      opacity: 1,
      duration: 1,
      y: 0,
      delay: 0.1,
    });
  });

  const video = document.querySelector('.main-screen__video--desc');
  const bg = document.querySelector('.main-screen__background');
  const btnArrow = document.querySelector('.btn-arrow__item_bottom');
  const breakpoint = window.matchMedia('(min-width: 1200px)');

  swiperResponsibility.init();
  swiperResponsibility.autoplay.start();

  if (!btnArrow) return false;

  if (breakpoint.matches) {
    btnArrow.addEventListener('click', () => {
      window.scrollTo(0, video.scrollHeight);
    });
  } else {
    btnArrow.addEventListener('click', () => {
      window.scrollTo(0, bg.scrollHeight);
    });
  }
}

export const AnimationSustainabilityScreen = (screen) => {

  if (screen === 1) {
    setTimeout(() => {
      headerRemoveWhite();
    }, 0);

    gsap.to(".main-screen__desc", {y: 0, duration: 1, opacity: 1});
    gsap.to(".main-screen__title", {y: 0, duration: .5, opacity: 1});
  }

  if (screen === 2) {
    setTimeout(() => {
      headerWhite();
    }, 600);

    gsap.to(".main-screen__desc", {y: -40, duration: .5, opacity: 0});
    gsap.to(".main-screen__title", {y: -40, duration: .5, opacity: 0});
  }
}