Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
Журнал изменений История Git Файлы Tilda MCP Каталог файловtilda-animation-ext-1.0.js Следить за файлом 1 /**2 * @file3 * Только для Zero Block. Данный скрипт описывает такие типы анимаций, как4 * Parallax — это настройки эффекта параллакса элемента;5 * Fixing — это настройки эффекта фиксации.6 * Анимация параллакса имеет две настройки — параллакс может быть по скроллу и по движению мыши.7 * Для анимации фиксации можно задать старт анимации относительно8 * экрана пользователя Window Top / Middle / Bottom.9 * @module tilda-zero-animation-ext-1.0.js10 */11 12 История файла и сравнение версий import { t396__isElementUsingCalcZoom, t396__initScaleFactorFlags } from './tilda-zero-shared.module';
15 * @typedef {Object} FixedElementProperties16 * @property {number} topOffset17 * @property {number} basicAnimationtriggerOffset18 * @property {number} trigger19 * @property {number} distance20 * @property {number} end21 * @property {HTMLElement} fixedWrapperEl25 * @typedef { HTMLElement | FixedElementProperties } FixedElement29 * @typedef {Object} ScrollParallaxElementProperties30 * @property {Boolean} isAboveParallax31 * @property {number} speed32 * @property {number} topPos33 * @property {number} bottomPos34 * @property {Boolean} isStarted38 * @typedef { HTMLElement | ScrollParallaxElementProperties } ScrollParallaxElement42 * @typedef {Object} ParallaxMouseElementProperties43 * @property {number} topOffset44 * @property {number} bottomOffset45 * @property {number} pathX46 * @property {number} pathY47 * @property {NodeList} animEl48 * @property {number} parentTopOffset49 * @property {number} parentBottomOffset53 * @typedef { HTMLElement | ParallaxMouseElementProperties } ParallaxMouseElement57 * @typedef {Object} ObjecForCreatingParallax58 * @property {HTMLElement} el59 * @property {number} elHeight60 * @property {number} elTopPos61 * @property {number} elBottomPos62 * @property {number} posY63 * @property {number} speed64 * @property {Boolean} isAboveParallax67 window.t_animationExt__isMobile =68 /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ||69 'ontouchend' in document;71 t_onReady(t_animationExt__init);74 * Инициализация анимации. Если активирован режим редактирования,79 function t_animationExt__init() {80 var record = document.querySelector('.t-records');81 var isEditMode = record ? record.getAttribute('data-tilda-mode') === 'edit' : false;82 if (/Bot/i.test(navigator.userAgent) || t_animateParallax__checkOldIE() || isEditMode) return;84 t_animationExt__isZeroBlocksRender(function () {85 t396__initScaleFactorFlags();86 t_animationExt__wrapFixEls();87 t_animationExt__wrapParallaxEls();88 t_animateParallax__initScroll(); //добавляем к элементам параллакса по прокрутке ключи topOffset и bottomOffset89 t_animateParallax__initMouse(); //добавляем к элементам параллакса по движению мыши ключи pathX, pathY и animEl90 var fixedElements = t_animationExt__getAnimatedElements('fix', []);91 var mouseElements = t_animationExt__getAnimatedElements('prx', ['mouse']);94 * добавляем к элементам параллакса по движению мыши параметры: topOffset, bottomOffset, parentTopOffset, parentBottomOffset95 * и к элементам с фиксацией: topOffset, basicAnimationtriggerOffset, trigger, distance, end, fixedWrapperEl97 t_animationExt__createResizeObserver(fixedElements, mouseElements);98 t_animateFix__init(fixedElements);