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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-animation-2.0.js

Код файла
Версия от 04.12.2026, 04:03:53 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1101	if (sectionDescr) {1102		var descrStartTime = sectionDescr.getAttribute('data-animate-start-time') || 0;1103		if (Date.now() - descrStartTime <= 160) {1104			sectionHeadDelay = 0.16;1105			return sectionHeadDelay;1106		}1107	}1108	return sectionHeadDelay;1109}1110 1111/**1112 * In this function we count delay, if chain items from this block on previous scroll event didn't finish its transition
История файла и сравнение версий
  • 04.12.2026, 04:03:53 · 56c3b845
1113 *
1114 * @param {HTMLElement} curBlock - current element
1115 * @param {number} chainDelay - chain delay
1116 * @returns {number} - number of delay
1117 */
1118function t_animate__getDelayFromPreviousScrollEvent(curBlock, chainDelay) {
1119 var isFirstRow = !curBlock.querySelectorAll('.t-animate_started').length;
1120 var notAnimated = curBlock.querySelectorAll('.t-animate__chain_first-in-row.t-animate_started');
1121 notAnimated = Array.prototype.filter.call(notAnimated, function (notAnim) {
1122 return !notAnim.classList.contains('t-animate__chain_showed');
1123 });
1124 // return, if it is the first element in chain or all the items are already animated
1125 if (isFirstRow || !notAnimated.length) {
1126 return 0;
1127 }
1128 if (notAnimated.length) {
1129 var lastNotAnimated = notAnimated[notAnimated.length - 1];
1130 var lastNotAnimatedStart = lastNotAnimated.getAttribute('data-animate-start-time') || 0;
1131 var timeGap = lastNotAnimatedStart - Date.now();
1132 if (timeGap <= 0) {
1133 return chainDelay;
1134 } else {
1135 return timeGap / 1000 + chainDelay;
1136 }
1137 }
1138}
1139
1140/**
1141 * Start element animation
1142 * @param {HTMLElement} element - current element
1143 * @param {boolean} needUpdateParent - whether to update the parent element
1144 */
1145function t_animate__startElementAnimation(element, needUpdateParent) {
1146 t_animate__prepareTextAnimation(element);
1147 t_animate__setStartAnimationClass(element, needUpdateParent);
1148}
1149
1150/**
1151 * Set start animation class to element
1152 * @param {HTMLElement} element - current element
1153 * @param {boolean} needUpdateParent - whether to update the parent element
1154 */
1155function t_animate__setStartAnimationClass(element, needUpdateParent) {
1156 if (!element) return;
1157 if (needUpdateParent) {
1158 var fixedAnimationParentClassName = 't-animate-for-wrapper';
1159 var fixedAnimationParent = element.closest('.' + fixedAnimationParentClassName);
1160 if (fixedAnimationParent) fixedAnimationParent.classList.remove(fixedAnimationParentClassName);
1161 }
1162 element.classList.add('t-animate_started');
1163
1164 const isFadeInLeft = element.getAttribute('data-animate-style') === 'fadeinleft';
1165 if (isFadeInLeft) {
1166 const parentElement = element.closest('.t-animate__overflow-x-hidden');
1167 if (
1168 parentElement &&
1169 !parentElement.querySelector('[data-animate-style="fadeinleft"]:not(.t-animate_started)')
1170 ) {
1171 parentElement.classList.remove('t-animate__overflow-x-hidden');
1172 }
1173 }
1174}
1175
1176/**
1177 * Animate chain blocks on event (transitionend)
1178 *
1179 * @param {HTMLElement} curBlock - current element
1180 */
1181function t_animate__catchTransitionEndEvent(curBlock) {
1182 var animateChainList = curBlock.querySelectorAll('.t-animate__chain_first-in-row.t-animate_started');
1183 animateChainList = Array.prototype.filter.call(animateChainList, function (animChain) {
1184 return !animChain.classList.contains('t-animate__chain_showed');
1185 });
1186 Array.prototype.forEach.call(animateChainList, function (animateChain) {
1187 var events = ['transitionend', 'webkitTransitionEnd', 'oTransitionEnd', 'otransitionend', 'MSTransitionEnd'];
1188 events.forEach(function (event) {
1189 animateChain.addEventListener(event, function () {
1190 t_animate__addEventOnAnimateChain(animateChain);
1191 });
1192 animateChain.removeEventListener(event, function () {
1193 t_animate__addEventOnAnimateChain(animateChain);
1194 });
1195 });
1196 });
1197}
1198
1199/* ---------- functions, for animated number ---------- */
1200
Предыдущие 100 строкСледующие 100 строк