import styles from '@/modules/home/home.module.scss'; import useLocale from '@/utils/useLocale'; import { LocalesMap } from '@/utils/useLocale'; import clsx from 'clsx'; import { manrope, caveat } from '@/styles/fonts'; import ThinStarBig from '@/assets/images/thin-star-big.svg'; import ThickRoundStar5 from '@/assets/images/thick-round-star-5.svg'; import thickRoundStar6Url from '@/assets/images/thick-round-star-6.svg?url'; import ridebusFlat from '@/assets/images/cities-backdrop.jpg'; import Image from 'next/image'; import { Gradients } from '@/components/gradients'; import { useEffect, useRef, Fragment } from 'react'; import useScroll from '@/utils/useScroll'; import { TopBar } from '@/components/topBar'; import useFrame from '@/utils/useFrame'; import useMediaQuery from '@/utils/useMediaQuery'; const locales: LocalesMap = { ru: { slogan_line: ( <> Приложение, которое поможет
вам
с лёгкостью смотреть расписание транспорта ), }, en: { slogan_line: ( <> Small app that helps
you
conveniently view public transport schedules ), }, }; export default function Header() { const t = useLocale(locales); const sloganLineRef = useRef(null); const transitionToBackgoundRef = useRef(null); const thickRoundStar6MaskRef = useRef(null); const thickRoundStar6ImageRef = useRef(null); const thickRoundStar5 = useRef(null); const breakpoint600 = false;//useMediaQuery('(max-width: 600px)'); useScroll((scrollY, deltaTime, time) => { const childs: HTMLSpanElement[] = [ ...Array.from(sloganLineRef.current?.children || []), ] as HTMLSpanElement[]; childs.forEach((child, index) => { const rawOffset = Math.min(-scrollY * 2 + index * 50, 0); const offset = Math.max(-Math.pow(rawOffset / 50, 2), -500); const rotateDirection = index % 2 === 0 ? 1 : -1; child.style.transform = `translate3D(0px, ${offset}px, 0px) rotate(${(offset / 10) * rotateDirection}deg)`; }); if (transitionToBackgoundRef.current && scrollY + 300 < window.innerHeight) { transitionToBackgoundRef.current.style.height = `${scrollY + 300}px`; } if (thickRoundStar6MaskRef.current && scrollY - 300 < window.innerHeight) { thickRoundStar6MaskRef.current.style.transform = `translate3D(0px, ${scrollY / 6}px, 0px) rotate(${scrollY / 8 + (time * 0.01) % 360}deg)`; } if (thickRoundStar6ImageRef.current && scrollY - 300 < window.innerHeight) { thickRoundStar6ImageRef.current.style.transform = `rotate(${-scrollY / 8 - (time * 0.01) % 360}deg) translate3d(0,0,0)`; } if (thickRoundStar5.current && scrollY - 300 < window.innerHeight) { thickRoundStar5.current.style.transform = `translate3D(-50%, -50%,0) rotate(${-scrollY / 6 - 10}deg)`; } }, { accelerator: 0.06 }); return (

{t('slogan_line')}

); }