Это первая доступная в Git версия файла.
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*/1112
import { t396__isElementUsingCalcZoom, t396__initScaleFactorFlags } from './tilda-zero-shared.module';/** * @typedef {Object} FixedElementProperties * @property {number} topOffset * @property {number} basicAnimationtriggerOffset * @property {number} trigger * @property {number} distance * @property {number} end * @property {HTMLElement} fixedWrapperEl *//** * @typedef { HTMLElement | FixedElementProperties } FixedElement *//** * @typedef {Object} ScrollParallaxElementProperties * @property {Boolean} isAboveParallax * @property {number} speed * @property {number} topPos * @property {number} bottomPos * @property {Boolean} isStarted *//** * @typedef { HTMLElement | ScrollParallaxElementProperties } ScrollParallaxElement *//** * @typedef {Object} ParallaxMouseElementProperties * @property {number} topOffset * @property {number} bottomOffset * @property {number} pathX * @property {number} pathY * @property {NodeList} animEl * @property {number} parentTopOffset * @property {number} parentBottomOffset *//** * @typedef { HTMLElement | ParallaxMouseElementProperties } ParallaxMouseElement *//** * @typedef {Object} ObjecForCreatingParallax * @property {HTMLElement} el * @property {number} elHeight * @property {number} elTopPos * @property {number} elBottomPos * @property {number} posY * @property {number} speed * @property {Boolean} isAboveParallax */window.t_animationExt__isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || 'ontouchend' in document;t_onReady(t_animationExt__init);/** * Инициализация анимации. Если активирован режим редактирования, * выходим из функции. * * @returns {void} */function t_animationExt__init() { var record = document.querySelector('.t-records'); var isEditMode = record ? record.getAttribute('data-tilda-mode') === 'edit' : false; if (/Bot/i.test(navigator.userAgent) || t_animateParallax__checkOldIE() || isEditMode) return; t_animationExt__isZeroBlocksRender(function () { t396__initScaleFactorFlags(); t_animationExt__wrapFixEls(); t_animationExt__wrapParallaxEls(); t_animateParallax__initScroll(); //добавляем к элементам параллакса по прокрутке ключи topOffset и bottomOffset t_animateParallax__initMouse(); //добавляем к элементам параллакса по движению мыши ключи pathX, pathY и animEl var fixedElements = t_animationExt__getAnimatedElements('fix', []); var mouseElements = t_animationExt__getAnimatedElements('prx', ['mouse']); /** * добавляем к элементам параллакса по движению мыши параметры: topOffset, bottomOffset, parentTopOffset, parentBottomOffset * и к элементам с фиксацией: topOffset, basicAnimationtriggerOffset, trigger, distance, end, fixedWrapperEl */ t_animationExt__createResizeObserver(fixedElements, mouseElements); t_animateFix__init(fixedElements); });}