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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-animation-sbs-1.0.js

Код файла
Версия от 05.12.2026, 07:01:09 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
3101 * @param {sbsColorTarget} target3102 * @param {'color' | 'bgColor' | 'fill' | 'stroke'} prop3103 * @param {sbsRGBA | sbsPaintState | sbsShapeUrlPaint} value - см. t_animationSBS__getTargetStepValue3104 * @param {boolean} isScroll3105 * @returns {string[][]} - пары [свойство, значение]3106 */3107function t_animationSBS__getTargetColorDeclarations(target, prop, value, isScroll) {3108	const paintMeta = target.paint && target.paint[prop];3109	if (paintMeta) return t_animationSBS__getPaintDeclarations(paintMeta, value);3110	// обводки на стопах в props группы нет, см. t_animationSBS__collectShapeColorTargets3111
История файла и сравнение версий
  • 05.12.2026, 07:01:09 · 56c3b845
if (t_animationSBS__isShapeOnStops(target, prop)) return isScroll ? [] : [['fill-opacity', '1']];
3112 const cssProp = isScroll
3113 ? t_animationSBS__getScrollColorCssProp(target, prop)
3114 : t_animationSBS__getColorCssProp(target, prop);
3115 if (target.gradientStops) {
3116 const declarations = [[cssProp, t_animationSBS__stringifyColor(value)]];
3117 if (!isScroll) declarations.push(['stop-opacity', '1']);
3118 return declarations;
3119 }
3120 if (!target.shapeSelectors) return [[cssProp, t_animationSBS__stringifyColor(value)]];
3121
3122 const declarations = [[cssProp, t_animationSBS__stringifyShapePaint(value)]];
3123 if (prop !== 'fill') return declarations;
3124 // у цвета fill-opacity фигуры уже учтен в нем самом (см. t_animationSBS__getShapeBaseFill), у градиента - собственная
3125 const fillOpacity = String(t_animationSBS__getShapeFillOpacity(value));
3126 const opacityProp = isScroll ? t_animationSBS__getShapeScrollFillOpacityVar(target) : 'fill-opacity';
3127 if (opacityProp) declarations.push([opacityProp, fillOpacity]);
3128 return declarations;
3129}
3130
3131/**
3132 * Ставит инлайн-стиль и сохраняет прежнее инлайн-значение, чтобы потом его восстановить
3133 *
3134 * @param {HTMLElement} node
3135 * @param {string} cssProp
3136 * @param {string} value
3137 */
3138function t_animationSBS__setInlineStyleWithBackup(node, cssProp, value) {
3139 if (!node.sbsInlineStylesBackup) node.sbsInlineStylesBackup = {};
3140 if (!(cssProp in node.sbsInlineStylesBackup)) {
3141 node.sbsInlineStylesBackup[cssProp] = {
3142 value: node.style.getPropertyValue(cssProp),
3143 priority: node.style.getPropertyPriority(cssProp),
3144 };
3145 }
3146 node.style.setProperty(cssProp, value);
3147}
3148
3149/**
3150 * Возвращает инлайн-стили, сохраненные в t_animationSBS__setInlineStyleWithBackup
3151 *
3152 * @param {HTMLElement} node
3153 */
3154function t_animationSBS__restoreInlineStyles(node) {
3155 if (!node.sbsInlineStylesBackup) return;
3156 Object.keys(node.sbsInlineStylesBackup).forEach(cssProp => {
3157 const { value, priority } = node.sbsInlineStylesBackup[cssProp];
3158 if (value) {
3159 node.style.setProperty(cssProp, value, priority);
3160 } else {
3161 node.style.removeProperty(cssProp);
3162 }
3163 });
3164 delete node.sbsInlineStylesBackup;
3165}
3166
3167/**
3168 * Регистрирует переменную слоя цвета фона, чтобы браузер плавно интерполировал ее в keyframes.
3169 * Без поддержки @property переменная меняется скачком, а слой остается валидным за счет fallback в var()
3170 */
3171function t_animationSBS__registerBgColorProperty() {
3172 if (window.t_animationSBS__isBgColorPropertyRegistered) return;
3173 window.t_animationSBS__isBgColorPropertyRegistered = true;
3174 if (!window.CSS || typeof CSS.registerProperty !== 'function') return;
3175 try {
3176 CSS.registerProperty({
3177 name: window.t_animationSBS__BG_LAYER_PROP,
3178 syntax: '<color>',
3179 inherits: false,
3180 initialValue: 'transparent',
3181 });
3182 } catch (e) {
3183 // свойство уже зарегистрировано другой копией скрипта
3184 }
3185}
3186
3187/**
3188 * Делит значение css-списка (background-image, background-clip и т.д.) на слои по запятым верхнего уровня.
3189 * Простой split(',') не подходит: запятые есть внутри градиентов, rgba() и url()
3190 *
3191 * @param {string} value
3192 * @returns {string[]}
3193 */
3194function t_animationSBS__splitBackgroundLayers(value) {
3195 const layers = [];
3196 // глубина вложенности скобок и открытая кавычка: запятая внутри них не разделяет слои
3197 let depth = 0;
3198 let quote = '';
3199 let layer = '';
3200 for (const char of value) {
Предыдущие 100 строкСледующие 100 строк