Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

tilda-animation-2.0.js

Код файла
Версия от 04.12.2026, 04:03:53 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
2501		const baseDelay = t_animate__getElementBaseDelay(animatedTextElement);2502		let letterIndex = 0;2503		let lastLetter = null;2504 2505		particles.forEach(particle => {2506			t_animate__setTextParticleDelay(particle, baseDelay + letterIndex * letterDelayIncrement);2507 2508			if (!t_animate__isWhitespaceParticle(particle)) {2509				letterIndex++;2510				lastLetter = particle;2511			}2512
История файла и сравнение версий
  • 04.12.2026, 04:03:53 · 56c3b845
});
2513
2514 if (!lastLetter) {
2515 return;
2516 }
2517
2518 // letters aren't animated with zero duration, so they can be joined right away
2519 if (letterDuration === 0) {
2520 t_animate__unwrapAnimatedTextLetters(animatedTextElement);
2521 return;
2522 }
2523
2524 // the last letter has the biggest delay, so the whole text is animated when its animation ends
2525 const onLastLetterAnimationEnd = event => {
2526 // setting delay returns paused animation to the before phase, it fires animationend with zero elapsed time
2527 if (event.elapsedTime === 0) {
2528 return;
2529 }
2530
2531 lastLetter.removeEventListener('animationend', onLastLetterAnimationEnd);
2532 t_animate__unwrapAnimatedTextLetters(animatedTextElement);
2533 };
2534
2535 lastLetter.addEventListener('animationend', onLastLetterAnimationEnd);
2536 });
2537}
2538
2539/**
2540 * Wrap each word of animated text with a span for specific animation styles
2541 * @param {string|null} scopeSelector - optional selector of container, if set, only elements inside it are wrapped
2542 */
2543function t_animate__wrapAnimatedTextWords(scopeSelector = null) {
2544 const animatedTextElements = t_animate__getAnimatedTextElements([
2545 'word-fade-in-right',
2546 'word-fade-in-left',
2547 'word-fade-in-down',
2548 'word-fade-in-up',
2549 'line-fade-in-right-gradient',
2550 'line-fade-in-left-gradient',
2551 ]).filter(animatedTextElement => !scopeSelector || animatedTextElement.closest(scopeSelector));
2552
2553 animatedTextElements.forEach(animatedTextElement => {
2554 t_animate__wrapAnimatedTextElementContentWords(animatedTextElement, false);
2555 });
2556}
2557
2558/**
2559 * Wrap each word of animated text with a mask wrapper for specific animation styles
2560 * @param {string|null} scopeSelector - optional selector of container, if set, only elements inside it are wrapped
2561 */
2562function t_animate__wrapAnimatedTextWordsWithMasks(scopeSelector = null) {
2563 const animatedTextElements = t_animate__getAnimatedTextElements([
2564 'word-fade-in-up-masked',
2565 'line-fade-in-up-masked',
2566 ]).filter(animatedTextElement => !scopeSelector || animatedTextElement.closest(scopeSelector));
2567
2568 animatedTextElements.forEach(animatedTextElement => {
2569 t_animate__wrapAnimatedTextElementContentWords(animatedTextElement, true);
2570 });
2571}
2572
2573/**
2574 * Wrap each word and then each letter of animated text with a span for letter animation styles.
2575 * Letter animations are available only for ZeroBlock elements.
2576 */
2577function t_animate__wrapAnimatedTextLetters() {
2578 const animatedTextElements = t_animate__getAnimatedTextElements(['letter-bounce-in-up']).filter(
2579 animatedTextElement => animatedTextElement.closest('.t396')
2580 );
2581
2582 animatedTextElements.forEach(animatedTextElement => {
2583 t_animate__wrapAnimatedTextElementContentWords(animatedTextElement, false);
2584
2585 const wordElements = animatedTextElement.querySelectorAll(
2586 '.t-animate__word:not(.t-animate__word_whitespace):not(.t-animate__word_strict)'
2587 );
2588
2589 wordElements.forEach(wordElement => {
2590 const letters = t_animate__splitTextIntoLetters(wordElement.textContent);
2591
2592 wordElement.textContent = '';
2593 wordElement.appendChild(letters);
2594 });
2595 });
2596}
2597
2598/**
2599 * Join letters of animated text back into words after animation end.
2600 * Browser doesn't shape text across inline-block boundaries, so split letters lose kerning, ligatures
Предыдущие 100 строкСледующие 100 строк