2001*/2002function t_animate__makeSectionButtonWait(curBlock) {2003var chainLength = curBlock.querySelectorAll('.t-animate[data-animate-chain=yes]').length;2004var sectionBtn = curBlock.querySelectorAll('.t-section__bottomwrapper .t-btn.t-animate');2005if (chainLength.length && sectionBtn.length) {2006Array.prototype.forEach.call(sectionBtn, function (btn) {2007btn.classList.add('t-animate__btn-wait-chain');2008});2009}2010}20112012
/** * Add animation to btn if it has t-animate__btn-wait-chain * * @param {HTMLElement} curBlock - block contains animated btn * @param {number} curItemDelay - current delay */function t_animate__checkSectionButtonAnimation(curBlock, curItemDelay) { var chainBtn = curBlock.querySelectorAll('.t-animate__btn-wait-chain'); if (chainBtn.length) { Array.prototype.forEach.call(chainBtn, function (btn) { btn.style.transitionDelay = curItemDelay + 0.16 + 's'; t_animate__removeNoHoverClassFromBtns(btn); btn.classList.remove('t-animate__btn-wait-chain'); t_animate__startElementAnimation(btn, false); }); }}/** * Add chainDelay if current block not contains chain items * * @param {HTMLElement} curBlock - current block */function t_animate__checkSectionButtonAnimation__outOfTurn(curBlock) { var waitingChainItems = curBlock.querySelectorAll('.t-animate[data-animate-chain=yes]'); waitingChainItems = Array.prototype.filter.call(waitingChainItems, function (chain) { return !chain.classList.contains('t-animate_started'); }); if (!waitingChainItems.length) { var chainDelay = 0.16; t_animate__checkSectionButtonAnimation(curBlock, chainDelay); }}/** * Add no-hover class to btn */function t_animate__addNoHoverClassToBtns() { var animatedBtns = document.querySelectorAll('.t-btn.t-animate'); Array.prototype.forEach.call(animatedBtns, function (btn) { btn.classList.add('t-animate_no-hover'); });}/** * Add event to .t-btn on transitionend after which remove transition-delay&transition-duration and t-animate_no-hover class * * @param {HTMLElement} curBlockAnimElem - current el * @returns {false} - if current el is not defined */function t_animate__removeNoHoverClassFromBtns(curBlockAnimElem) { if (!curBlockAnimElem) return false; var currentBtn = curBlockAnimElem.classList.contains('t-btn') ? curBlockAnimElem : null; if (currentBtn) { currentBtn.ontransitionend = function (e) { if (e.propertyName === 'opacity' || e.propertyName === 'transform') { currentBtn.classList.remove('t-animate_no-hover'); currentBtn.style.transitionDelay = ''; currentBtn.style.transitionDuration = ''; this.ontransitionend = null; } }; }}/** * For group animation add equal offset (curTopOffset) * * @param {HTMLElement[]} animGroupsBlocks - animated group block list */function t_animate__getGroupsOffsets(animGroupsBlocks) { animGroupsBlocks.forEach(function (animGroupsBlock) { var animatedChild = animGroupsBlock.querySelector('.t-animate'); if (animatedChild) { animGroupsBlock.curTopOffset = animatedChild.getBoundingClientRect().top + window.pageYOffset; var zoom = t_animation__getZoom(animGroupsBlock); if (!window.isOnlyScalable) animGroupsBlock.curTopOffset *= zoom; } });}function t_animation__getZoom(el) { if (typeof el.scaleFactor !== 'undefined') return el.scaleFactor; var artboard = el.closest('.t396__artboard'); if (!artboard) return 1; var isOldPage = document.querySelector('script[src*="tilda-blocks-2.7"]'); if ( artboard.classList.contains('t396__artboard_scale') || (!isOldPage &&