2401return acc;2402}, [])2403.map(({ words }) => words);24042405return lines;2406}24072408/**2409* Prepare word by word animation to the left.2410* Split text into lines and reverse the order of words in each line.2411* Add animation delay for each word by increment.2412* @param {HTMLElement|null} element - optional specific element to prepare, if null, prepares all elements with the specified animation styles
*/function t_animate__prepareWordByWordAnimationToLeft(element = null) { const wordDelayIncrement = 0.06; const animatedTextElements = t_animate__getAnimatedTextElements(['word-fade-in-left'], element); animatedTextElements.forEach(animatedTextElement => { const lines = t_animate__getElementLines(animatedTextElement); const linesWithReversedWords = lines.map(line => line.reverse()); const baseDelay = t_animate__getElementBaseDelay(animatedTextElement); let wordIndex = 0; linesWithReversedWords.forEach(lineElement => { lineElement.forEach(wordElement => { t_animate__setTextParticleDelay(wordElement, baseDelay + wordIndex * wordDelayIncrement); if (!t_animate__isWhitespaceParticle(wordElement)) { wordIndex++; } }); }); });}/** * Prepare line by line animation. * Add animation delay for each line by increment. * @param {HTMLElement|null} element - optional specific element to prepare, if null, prepares all elements with the specified animation styles */function t_animate__prepareLinesFadeInAnimation(element = null) { const lineDelayIncrement = 0.12; const animatedTextElements = t_animate__getAnimatedTextElements(['line-fade-in-up-masked'], element); animatedTextElements.forEach(animatedTextElement => { const lines = t_animate__getElementLines(animatedTextElement); const baseDelay = t_animate__getElementBaseDelay(animatedTextElement); lines.forEach((words, lineIndex) => { words.forEach(word => { t_animate__setTextParticleDelay(word, baseDelay + lineIndex * lineDelayIncrement); }); }); });}/** * Prepare line by line animation for wrapped lines (line-fade-in-right-gradient, line-fade-in-left-gradient). * Add animation delay for each line by increment. * @param {HTMLElement|null} element - optional specific element to prepare, if null, prepares all elements with the specified animation styles */function t_animate__prepareLinesFadeInWrappedAnimation(element = null) { const lineDelayIncrement = 0.12; const animatedTextElements = t_animate__getAnimatedTextElements( ['line-fade-in-right-gradient', 'line-fade-in-left-gradient'], element ); animatedTextElements.forEach(animatedTextElement => { const lines = animatedTextElement.querySelectorAll('.t-animate__line'); const baseDelay = t_animate__getElementBaseDelay(animatedTextElement); lines.forEach((line, lineIndex) => { const lineDelay = baseDelay + lineIndex * lineDelayIncrement; line.style.animationDelay = `${lineDelay}s`; }); });}/** * Prepare letter by letter animation (letter-bounce-in-up). * Add animation delay for each letter by increment, index is continuous through the whole element. * Increment is proportional to the letter animation duration, so the whole animation slows down with longer duration. * Strict words are not split into letters, so they are animated as a single letter. * @param {HTMLElement} element - specific element to prepare * @param {number|null} duration - letter animation duration in seconds, if null, default duration is used */function t_animate__prepareLetterByLetterAnimation(element, duration = null) { const defaultLetterDuration = 0.36; const letterDelayRatio = 0.1; const maxLetterDelayIncrement = 0.1; const letterDuration = duration ?? defaultLetterDuration; const letterDelayIncrement = Math.min(letterDuration * letterDelayRatio, maxLetterDelayIncrement); const animatedTextElements = t_animate__getAnimatedTextElements(['letter-bounce-in-up'], element); animatedTextElements.forEach(animatedTextElement => { const particles = animatedTextElement.querySelectorAll( '.t-animate__letter, .t-animate__word_strict, .t-animate__word_whitespace' );