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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-animation-sbs-1.0.js

Код файла
Версия от 05.12.2026, 07:01:09 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
2401	(animatedHTML.colorTargets || []).forEach(target => {2402		target.nodes.forEach(node => t_animationSBS__restoreInlineStyles(node));2403		t_animationSBS__removeBgColorLayer(target);2404	});2405	if (animatedHTML.sbsShapeColorStyle) animatedHTML.sbsShapeColorStyle.remove();2406	delete animatedHTML.sbsShapeColorStyle;2407	delete animatedHTML.sbsShapeColorCss;2408	animatedHTML.colorTargets = [];2409}2410 2411/**2412
История файла и сравнение версий
  • 05.12.2026, 07:01:09 · 56c3b845
* Собирает цели анимации цвета по типу элемента:
2413 * color - у .tn-atom и у текста кнопки;
2414 * background-color - у .tn-atom (у тултипа это пин), у физической группы - у .tn-molecule,
2415 * или у обертки, если фон перенесен на нее в t_animationSBS__chromeFixBackdropFilter;
2416 * fill и stroke - у фигур внутри svg вектора, см. t_animationSBS__collectShapeColorTargets.
2417 * Ключи шагов cl, bg, fl и st у неподдерживаемых типов элементов обнуляются.
2418 * Правило слоев целям здесь не ставится, см. t_animationSBS__setColorTargets
2419 *
2420 * @param {AnimatedHTML} animatedHTML
2421 * @param {string | null} elType - тип элемента, по умолчанию определяется по animatedHTML
2422 * @returns {sbsColorTarget[]}
2423 */
2424function t_animationSBS__collectColorTargets(animatedHTML, elType = t_animationSBS__getColorElType(animatedHTML)) {
2425 const wrapperEl = animatedHTML.wrapperEl;
2426 // .tn-molecule для группы, .tn-atom для остальных элементов, как в t_animationSBS__wrapAndUpdateEls
2427 const animCore = wrapperEl ? wrapperEl.querySelector('.tn-molecule, .tn-atom') : null;
2428 const colorTargets = [];
2429
2430 // у одного узла может анимироваться и color, и bgColor, тогда это одна цель с одной анимацией
2431 const addTarget = (node, prop, alpha) => {
2432 let target = colorTargets.find(colorTarget => colorTarget.node === node);
2433 if (!target) {
2434 const selector = t_animationSBS__getChildSelector(wrapperEl, node);
2435 target = { node, nodes: [node], selector, props: [], base: {}, alpha };
2436 colorTargets.push(target);
2437 }
2438 target.props.push(prop);
2439 return target;
2440 };
2441
2442 const shapeProps = [];
2443 ['color', 'bgColor', 'fill', 'stroke'].forEach(prop => {
2444 const isSupported = animCore && t_animationSBS__getColorPropOpts(prop).elTypes.includes(elType);
2445 const hasColor = animatedHTML.steps.some(step => step.styles[prop]);
2446 // ключи могли попасть на неподдерживаемый элемент при копировании анимации - обнуляем их в шагах
2447 if (!isSupported || !hasColor) {
2448 animatedHTML.steps.forEach(step => {
2449 step.styles[prop] = null;
2450 });
2451 return;
2452 }
2453
2454 if (prop === 'fill' || prop === 'stroke') {
2455 shapeProps.push(prop);
2456 return;
2457 }
2458
2459 // в шагах есть градиент: все шаги свойства рисуются слоями градиента, см. t_animationSBS__createPaintMeta
2460 const paintMeta = t_animationSBS__createPaintMeta(animatedHTML, prop);
2461 const addPaintTarget = node => {
2462 const paintTarget = addTarget(node, prop, 1);
2463 paintTarget.paint = Object.assign(paintTarget.paint || {}, { [prop]: paintMeta });
2464 t_animationSBS__registerPaintProperties(paintMeta);
2465 };
2466
2467 if (prop === 'color') {
2468 // .tn-atom__btn-text - в редакторе, .tn-atom__button-text - в разметке кнопки на сайте
2469 const btnText = animCore.querySelector('.tn-atom__btn-text, .tn-atom__button-text');
2470 if (paintMeta) {
2471 // у кнопки градиент рисуется на тексте, а атому для иконок (currentColor) - цвет первого стопа
2472 if (btnText) addTarget(animCore, prop, 1);
2473 addPaintTarget(btnText || animCore);
2474 return;
2475 }
2476 addTarget(animCore, prop, 1);
2477 if (btnText) addTarget(btnText, prop, 1);
2478 return;
2479 }
2480
2481 if (paintMeta) {
2482 addPaintTarget(animCore);
2483 } else if (t_animationSBS__getBgLayerInfo(getComputedStyle(animCore))) {
2484 // background-color не виден под градиентом bgcolor и у текста с градиентом букв без фона,
2485 // в этих случаях цвет шага рисуется отдельным слоем, см. t_animationSBS__getBgLayerInfo.
2486 // Слой проверяется раньше chrome fix: тот переносит только background-color, а градиент остается на атоме
2487 t_animationSBS__registerBgColorProperty();
2488 addTarget(animCore, prop, 1).hasBgLayer = true;
2489 } else if (animCore.sbsBgHolder) {
2490 addTarget(animCore.sbsBgHolder.node, prop, animCore.sbsBgHolder.alpha);
2491 } else {
2492 addTarget(animCore, prop, 1);
2493 }
2494 });
2495
2496 if (shapeProps.length)
2497 colorTargets.push(...t_animationSBS__collectShapeColorTargets(animatedHTML, animCore, shapeProps));
2498
2499 return colorTargets;
2500}
Предыдущие 100 строкСледующие 100 строк