1/******/ (function() { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ 799: 5/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 6 7module.exports = inViewport; 8 9var instances = []; 10var supportsMutationObserver = typeof __webpack_require__.g.MutationObserver === 'function'; 11 12function inViewport(elt, params, cb) { 13 var opts = { 14 container: __webpack_require__.g.document.body, 15 offset: 0, 16 debounce: 15, 17 failsafe: 150 18 }; 19 20 if (params === undefined || typeof params === 'function') { 21 cb = params; 22 params = {}; 23 } 24 25 var container = opts.container = params.container || opts.container; 26 var offset = opts.offset = params.offset || opts.offset; 27 var debounceValue = opts.debounce = params.debounce || opts.debounce; 28 var failsafe = opts.failsafe = params.failsafe || opts.failsafe; 29 30 // ensure backward compatibility with failsafe as boolean 31 if (failsafe === true) { 32 failsafe = 150; 33 } else if(failsafe === false) { 34 failsafe = 0; 35 } 36 37 // failsafe check always needs to be higher than debounceValue 38 if (failsafe > 0 && failsafe < debounceValue) { 39 failsafe = debounceValue + 50; 40 } 41 42 for (var i = 0; i < instances.length; i++) { 43 if ( 44 instances[i].container === container && 45 instances[i]._debounce === debounceValue && 46 instances[i]._failsafe === failsafe 47 ) { 48 return instances[i].isInViewport(elt, offset, cb); 49 } 50 } 51 52 return instances[ 53 instances.push(createInViewport(container, debounceValue, failsafe)) - 1 54 ].isInViewport(elt, offset, cb); 55} 56 57function addEvent(el, type, fn) { 58 if (el.attachEvent) { 59 el.attachEvent('on' + type, fn); 60 } else { 61 el.addEventListener(type, fn, false); 62 } 63} 64 65function debounce(func, wait, immediate) { 66 var timeout; 67 return function () { 68 var context = this, args = arguments; 69 var callNow = immediate && !timeout; 70 clearTimeout(timeout); 71 timeout = setTimeout(later, wait); 72 if (callNow) func.apply(context, args); 73 74 function later() { 75 timeout = null; 76 if (!immediate) func.apply(context, args); 77 } 78 }; 79} 80 81// https://github.com/jquery/sizzle/blob/3136f48b90e3edc84cbaaa6f6f7734ef03775a07/sizzle.js#L708 82var contains = function() { 83 if (!__webpack_require__.g.document) { 84 return true; 85 } 86 return __webpack_require__.g.document.documentElement.compareDocumentPosition ? 87 function (a, b) { 88 return !!(a.compareDocumentPosition(b) & 16); 89 } : 90 __webpack_require__.g.document.documentElement.contains ? 91 function (a, b) { 92 return a !== b && ( a.contains ? a.contains(b) : false ); 93 } : 94 function (a, b) { 95 while (b = b.parentNode) { 96 if (b === a) { 97 return true; 98 } 99 } 100 return false; 101 }; 102} 103 104function createInViewport(container, debounceValue, failsafe) { 105 var watches = createWatches(); 106 107 var scrollContainer = container === __webpack_require__.g.document.body ? __webpack_require__.g : container; 108 var debouncedCheck = debounce(watches.checkAll(watchInViewport), debounceValue); 109 110 addEvent(scrollContainer, 'scroll', debouncedCheck); 111 112 if (scrollContainer === __webpack_require__.g) { 113 addEvent(__webpack_require__.g, 'resize', debouncedCheck); 114 } 115 116 if (supportsMutationObserver) { 117 observeDOM(watches, container, debouncedCheck); 118 } 119 120 // failsafe check, every X we check for visible images 121 // usecase: a hidden parent containing eleements 122 // when the parent becomes visible, we have no event that the children 123 // became visible 124 if (failsafe > 0) { 125 setInterval(debouncedCheck, failsafe); 126 } 127 128 function isInViewport(elt, offset, cb) { 129 if (!cb) { 130 return isVisible(elt, offset); 131 } 132 133 var remote = createRemote(elt, offset, cb); 134 remote.watch(); 135 return remote; 136 } 137 138 function createRemote(elt, offset, cb) { 139 function watch() { 140 watches.add(elt, offset, cb); 141 } 142 143 function dispose() { 144 watches.remove(elt); 145 } 146 147 return { 148 watch: watch, 149 dispose: dispose 150 }; 151 } 152 153 function watchInViewport(elt, offset, cb) { 154 if (isVisible(elt, offset)) { 155 watches.remove(elt); 156 cb(elt); 157 } 158 } 159 160 function isVisible(elt, offset) { 161 if (!elt) { 162 return false;
163 } 164 165 if (!contains(__webpack_require__.g.document.documentElement, elt) || !contains(__webpack_require__.g.document.documentElement, container)) { 166 return false; 167 } 168 169 // Check if the element is visible 170 // https://github.com/jquery/jquery/blob/740e190223d19a114d5373758127285d14d6b71e/src/css/hiddenVisibleSelectors.js 171 if (!elt.offsetWidth || !elt.offsetHeight) { 172 return false; 173 } 174 175 var eltRect = elt.getBoundingClientRect(); 176 var viewport = {}; 177 178 if (container === __webpack_require__.g.document.body) { 179 viewport = { 180 top: -offset, 181 left: -offset, 182 right: __webpack_require__.g.document.documentElement.clientWidth + offset, 183 bottom: __webpack_require__.g.document.documentElement.clientHeight + offset 184 }; 185 } else { 186 var containerRect = container.getBoundingClientRect(); 187 viewport = { 188 top: containerRect.top - offset, 189 left: containerRect.left - offset, 190 right: containerRect.right + offset, 191 bottom: containerRect.bottom + offset 192 }; 193 } 194 195 // The element must overlap with the visible part of the viewport 196 var visible = 197 ( 198 eltRect.right >= viewport.left && 199 eltRect.left <= viewport.right && 200 eltRect.bottom >= viewport.top && 201 eltRect.top <= viewport.bottom 202 ); 203 204 return visible; 205 } 206 207 return { 208 container: container, 209 isInViewport: isInViewport, 210 _debounce: debounceValue, 211 _failsafe: failsafe 212 }; 213} 214 215function createWatches() { 216 var watches = []; 217 218 function add(elt, offset, cb) { 219 if (!isWatched(elt)) { 220 watches.push([elt, offset, cb]); 221 } 222 } 223 224 function remove(elt) { 225 var pos = indexOf(elt); 226 if (pos !== -1) { 227 watches.splice(pos, 1); 228 } 229 } 230 231 function indexOf(elt) { 232 for (var i = watches.length - 1; i >= 0; i--) { 233 if (watches[i][0] === elt) { 234 return i; 235 } 236 } 237 return -1; 238 } 239 240 function isWatched(elt) { 241 return indexOf(elt) !== -1; 242 } 243 244 function checkAll(cb) { 245 return function () { 246 for (var i = watches.length - 1; i >= 0; i--) { 247 cb.apply(this, watches[i]); 248 } 249 }; 250 } 251 252 return { 253 add: add, 254 remove: remove, 255 isWatched: isWatched, 256 checkAll: checkAll 257 }; 258} 259 260function observeDOM(watches, container, cb) { 261 var observer = new MutationObserver(watch); 262 var filter = Array.prototype.filter; 263 var concat = Array.prototype.concat; 264 265 observer.observe(container, { 266 childList: true, 267 subtree: true, 268 // changes like style/width/height/display will be catched 269 attributes: true 270 }); 271 272 function watch(mutations) { 273 // some new DOM nodes where previously watched 274 // we should check their positions 275 if (mutations.some(knownNodes) === true) { 276 setTimeout(cb, 0); 277 } 278 } 279 280 function knownNodes(mutation) { 281 var nodes = concat.call([], 282 Array.prototype.slice.call(mutation.addedNodes), 283 mutation.target 284 ); 285 return filter.call(nodes, watches.isWatched).length > 0; 286 } 287} 288 289 290/***/ }), 291 292/***/ 879: 293/***/ (function(module) { 294 295(function(window, factory) { 296 var lazySizes = factory(window, window.document, Date); 297 window.lazySizes = lazySizes; 298 if( true
vendor: 19,841 bytes, lines 298-1108
298 && module.exports){ 299 module.exports = lazySizes; 300 } 301}(typeof window != 'undefined' ? 302 window : {}, 303/** 304 * import("./types/global") 305 * @typedef { import("./types/lazysizes-config").LazySizesConfigPartial } LazySizesConfigPartial 306 */ 307function l(window, document, Date) { // Pass in the window Date function also for SSR because the Date class can be lost 308 'use strict'; 309 /*jshint eqnull:true */ 310 311 var lazysizes, 312 /** 313 * @type { LazySizesConfigPartial } 314 */ 315 lazySizesCfg; 316 317 (function(){ 318 var prop; 319 320 var lazySizesDefaults = { 321 lazyClass: 'lazyload', 322 loadedClass: 'lazyloaded', 323 loadingClass: 'lazyloading', 324 preloadClass: 'lazypreload', 325 errorClass: 'lazyerror', 326 //strictClass: 'lazystrict', 327 autosizesClass: 'lazyautosizes', 328 fastLoadedClass: 'ls-is-cached', 329 iframeLoadMode: 0, 330 srcAttr: 'data-src', 331 srcsetAttr: 'data-srcset', 332 sizesAttr: 'data-sizes', 333 //preloadAfterLoad: false, 334 minSize: 40, 335 customMedia: {}, 336 init: true, 337 expFactor: 1.5, 338 hFac: 0.8, 339 loadMode: 2, 340 loadHidden: true, 341 ricTimeout: 0, 342 throttleDelay: 125, 343 }; 344 345 lazySizesCfg = window.lazySizesConfig || window.lazysizesConfig || {}; 346 347 for(prop in lazySizesDefaults){ 348 if(!(prop in lazySizesCfg)){ 349 lazySizesCfg[prop] = lazySizesDefaults[prop]; 350 } 351 } 352 })(); 353 354 if (!document || !document.getElementsByClassName) { 355 return { 356 init: function () {}, 357 /** 358 * @type { LazySizesConfigPartial } 359 */ 360 cfg: lazySizesCfg, 361 /** 362 * @type { true } 363 */ 364 noSupport: true, 365 }; 366 } 367 368 var docElem = document.documentElement; 369 370 var supportPicture = window.HTMLPictureElement; 371 372 var _addEventListener = 'addEventListener'; 373 374 var _getAttribute = 'getAttribute'; 375 376 /** 377 * Update to bind to window because 'this' becomes null during SSR 378 * builds. 379 */ 380 var addEventListener = window[_addEventListener].bind(window); 381 382 var setTimeout = window.setTimeout; 383 384 var requestAnimationFrame = window.requestAnimationFrame || setTimeout; 385 386 var requestIdleCallback = window.requestIdleCallback; 387 388 var regPicture = /^picture$/i; 389 390 var loadEvents = ['load', 'error', 'lazyincluded', '_lazyloaded']; 391 392 var regClassCache = {}; 393 394 var forEach = Array.prototype.forEach; 395 396 /** 397 * @param ele {Element} 398 * @param cls {string} 399 */ 400 var hasClass = function(ele, cls) { 401 if(!regClassCache[cls]){ 402 regClassCache[cls] = new RegExp('(\\s|^)'+cls+'(\\s|$)'); 403 } 404 return regClassCache[cls].test(ele[_getAttribute]('class') || '') && regClassCache[cls]; 405 }; 406 407 /** 408 * @param ele {Element} 409 * @param cls {string} 410 */ 411 var addClass = function(ele, cls) { 412 if (!hasClass(ele, cls)){ 413 ele.setAttribute('class', (ele[_getAttribute]('class') || '').trim() + ' ' + cls); 414 } 415 }; 416 417 /** 418 * @param ele {Element} 419 * @param cls {string} 420 */ 421 var removeClass = function(ele, cls) { 422 var reg; 423 if ((reg = hasClass(ele,cls))) { 424 ele.setAttribute('class', (ele[_getAttribute]('class') || '').replace(reg, ' ')); 425 } 426 }; 427 428 var addRemoveLoadEvents = function(dom, fn, add){ 429 var action = add ? _addEventListener : 'removeEventListener'; 430 if(add){ 431 addRemoveLoadEvents(dom, fn); 432 } 433 loadEvents.forEach(function(evt){ 434 dom[action](evt, fn); 435 }); 436 }; 437 438 /** 439 * @param elem { Element } 440 * @param name { string } 441 * @param detail { any } 442 * @param noBubbles { boolean } 443 * @param noCancelable { boolean } 444 * @returns { CustomEvent } 445 */ 446 var triggerEvent = function(elem, name, detail, noBubbles, noCancelable){ 447 var event = document.createEvent('Event'); 448 449 if(!detail){ 450 detail = {}; 451 } 452 453 detail.instance = lazysizes; 454 455 event.initEvent(name, !noBubbles, !noCancelable); 456 457 event.detail = detail; 458 459 elem.dispatchEvent(event); 460 return event; 461 }; 462 463 var updatePolyfill = function (el, full){ 464 var polyfill; 465 if( !supportPicture && ( polyfill = (window.picturefill || lazySizesCfg.pf) ) ){ 466 if(full && full.src && !el[_getAttribute]('srcset')){ 467 el.setAttribute('srcset', full.src); 468 } 469 polyfill({reevaluate: true, elements: [el]}); 470 } else if(full && full.src){ 471 el.src = full.src; 472 } 473 }; 474 475 var getCSS = function (elem, style){ 476 return (getComputedStyle(elem, null) || {})[style]; 477 }; 478 479 /** 480 * 481 * @param elem { Element } 482 * @param parent { Element } 483 * @param [width] {number} 484 * @returns {number} 485 */ 486 var getWidth = function(elem, parent, width){ 487 width = width || elem.offsetWidth; 488 489 while(width < lazySizesCfg.minSize && parent && !elem._lazysizesWidth){ 490 width = parent.offsetWidth; 491 parent = parent.parentNode; 492 } 493 494 return width; 495 }; 496 497 var rAF = (function(){ 498 var running, waiting; 499 var firstFns = []; 500 var secondFns = []; 501 var fns = firstFns; 502 503 var run = function(){ 504 var runFns = fns; 505 506 fns = firstFns.length ? secondFns : firstFns; 507 508 running = true; 509 waiting = false; 510 511 while(runFns.length){ 512 runFns.shift()(); 513 } 514 515 running = false; 516 }; 517 518 var rafBatch = function(fn, queue){ 519 if(running && !queue){ 520 fn.apply(this, arguments); 521 } else { 522 fns.push(fn); 523 524 if(!waiting){ 525 waiting = true; 526 (document.hidden ? setTimeout : requestAnimationFrame)(run); 527 } 528 } 529 }; 530 531 rafBatch._lsFlush = run; 532 533 return rafBatch; 534 })(); 535 536 var rAFIt = function(fn, simple){ 537 return simple ? 538 function() { 539 rAF(fn); 540 } : 541 function(){ 542 var that = this; 543 var args = arguments; 544 rAF(function(){ 545 fn.apply(that, args); 546 }); 547 } 548 ; 549 }; 550 551 var throttle = function(fn){ 552 var running; 553 var lastTime = 0; 554 var gDelay = lazySizesCfg.throttleDelay; 555 var rICTimeout = lazySizesCfg.ricTimeout; 556 var run = function(){ 557 running = false; 558 lastTime = Date.now(); 559 fn(); 560 }; 561 var idleCallback = requestIdleCallback && rICTimeout > 49 ? 562 function(){ 563 requestIdleCallback(run, {timeout: rICTimeout}); 564 565 if(rICTimeout !== lazySizesCfg.ricTimeout){ 566 rICTimeout = lazySizesCfg.ricTimeout; 567 } 568 } : 569 rAFIt(function(){ 570 setTimeout(run); 571 }, true) 572 ; 573 574 return function(isPriority){ 575 var delay; 576 577 if((isPriority = isPriority === true)){ 578 rICTimeout = 33; 579 } 580 581 if(running){ 582 return; 583 } 584 585 running = true; 586 587 delay = gDelay - (Date.now() - lastTime); 588 589 if(delay < 0){ 590 delay = 0; 591 } 592 593 if(isPriority || delay < 9){ 594 idleCallback(); 595 } else { 596 setTimeout(idleCallback, delay); 597 } 598 }; 599 }; 600 601 //based on http://modernjavascript.blogspot.de/2013/08/building-better-debounce.html 602 var debounce = function(func) { 603 var timeout, timestamp; 604 var wait = 99; 605 var run = function(){ 606 timeout = null; 607 func(); 608 }; 609 var later = function() { 610 var last = Date.now() - timestamp; 611 612 if (last < wait) { 613 setTimeout(later, wait - last); 614 } else { 615 (requestIdleCallback || run)(run); 616 } 617 }; 618 619 return function() { 620 timestamp = Date.now(); 621 622 if (!timeout) { 623 timeout = setTimeout(later, wait); 624 } 625 }; 626 }; 627 628 var loader = (function(){ 629 var preloadElems, isCompleted, resetPreloadingTimer, loadMode, started; 630 631 var eLvW, elvH, eLtop, eLleft, eLright, eLbottom, isBodyHidden; 632 633 var regImg = /^img$/i; 634 var regIframe = /^iframe$/i; 635 636 var supportScroll = ('onscroll' in window) && !(/(gle|ing)bot/.test(navigator.userAgent)); 637 638 var shrinkExpand = 0; 639 var currentExpand = 0; 640 641 var isLoading = 0; 642 var lowRuns = -1; 643 644 var resetPreloading = function(e){ 645 isLoading--; 646 if(!e || isLoading < 0 || !e.target){ 647 isLoading = 0; 648 } 649 }; 650 651 var isVisible = function (elem) { 652 if (isBodyHidden == null) { 653 isBodyHidden = getCSS(document.body, 'visibility') == 'hidden'; 654 } 655 656 return isBodyHidden || !(getCSS(elem.parentNode, 'visibility') == 'hidden' && getCSS(elem, 'visibility') == 'hidden'); 657 }; 658 659 var isNestedVisible = function(elem, elemExpand){ 660 var outerRect; 661 var parent = elem; 662 var visible = isVisible(elem); 663 664 eLtop -= elemExpand; 665 eLbottom += elemExpand; 666 eLleft -= elemExpand; 667 eLright += elemExpand; 668 669 while(visible && (parent = parent.offsetParent) && parent != document.body && parent != docElem){ 670 visible = ((getCSS(parent, 'opacity') || 1) > 0); 671 672 if(visible && getCSS(parent, 'overflow') != 'visible'){ 673 outerRect = parent.getBoundingClientRect(); 674 visible = eLright > outerRect.left && 675 eLleft < outerRect.right && 676 eLbottom > outerRect.top - 1 && 677 eLtop < outerRect.bottom + 1 678 ; 679 } 680 } 681 682 return visible; 683 }; 684 685 var checkElements = function() { 686 var eLlen, i, rect, autoLoadElem, loadedSomething, elemExpand, elemNegativeExpand, elemExpandVal, 687 beforeExpandVal, defaultExpand, preloadExpand, hFac; 688 var lazyloadElems = lazysizes.elements; 689 690 if((loadMode = lazySizesCfg.loadMode) && isLoading < 8 && (eLlen = lazyloadElems.length)){ 691 692 i = 0; 693 694 lowRuns++; 695 696 for(; i < eLlen; i++){ 697 698 if(!lazyloadElems[i] || lazyloadElems[i]._lazyRace){continue;} 699 700 if(!supportScroll || (lazysizes.prematureUnveil && lazysizes.prematureUnveil(lazyloadElems[i]))){unveilElement(lazyloadElems[i]);continue;} 701 702 if(!(elemExpandVal = lazyloadElems[i][_getAttribute]('data-expand')) || !(elemExpand = elemExpandVal * 1)){ 703 elemExpand = currentExpand; 704 } 705 706 if (!defaultExpand) { 707 defaultExpand = (!lazySizesCfg.expand || lazySizesCfg.expand < 1) ? 708 docElem.clientHeight > 500 && docElem.clientWidth > 500 ? 500 : 370 : 709 lazySizesCfg.expand; 710 711 lazysizes._defEx = defaultExpand; 712 713 preloadExpand = defaultExpand * lazySizesCfg.expFactor; 714 hFac = lazySizesCfg.hFac; 715 isBodyHidden = null; 716 717 if(currentExpand < preloadExpand && isLoading < 1 && lowRuns > 2 && loadMode > 2 && !document.hidden){ 718 currentExpand = preloadExpand; 719 lowRuns = 0; 720 } else if(loadMode > 1 && lowRuns > 1 && isLoading < 6){ 721 currentExpand = defaultExpand; 722 } else { 723 currentExpand = shrinkExpand; 724 } 725 } 726 727 if(beforeExpandVal !== elemExpand){ 728 eLvW = innerWidth + (elemExpand * hFac); 729 elvH = innerHeight + elemExpand; 730 elemNegativeExpand = elemExpand * -1; 731 beforeExpandVal = elemExpand; 732 } 733 734 rect = lazyloadElems[i].getBoundingClientRect(); 735 736 if ((eLbottom = rect.bottom) >= elemNegativeExpand && 737 (eLtop = rect.top) <= elvH && 738 (eLright = rect.right) >= elemNegativeExpand * hFac && 739 (eLleft = rect.left) <= eLvW && 740 (eLbottom || eLright || eLleft || eLtop) && 741 (lazySizesCfg.loadHidden || isVisible(lazyloadElems[i])) && 742 ((isCompleted && isLoading < 3 && !elemExpandVal && (loadMode < 3 || lowRuns < 4)) || isNestedVisible(lazyloadElems[i], elemExpand))){ 743 unveilElement(lazyloadElems[i]); 744 loadedSomething = true; 745 if(isLoading > 9){break;} 746 } else if(!loadedSomething && isCompleted && !autoLoadElem && 747 isLoading < 4 && lowRuns < 4 && loadMode > 2 && 748 (preloadElems[0] || lazySizesCfg.preloadAfterLoad) && 749 (preloadElems[0] || (!elemExpandVal && ((eLbottom || eLright || eLleft || eLtop) || lazyloadElems[i][_getAttribute](lazySizesCfg.sizesAttr) != 'auto')))){ 750 autoLoadElem = preloadElems[0] || lazyloadElems[i]; 751 } 752 } 753 754 if(autoLoadElem && !loadedSomething){ 755 unveilElement(autoLoadElem); 756 } 757 } 758 }; 759 760 var throttledCheckElements = throttle(checkElements); 761 762 var switchLoadingClass = function(e){ 763 var elem = e.target; 764 765 if (elem._lazyCache) { 766 delete elem._lazyCache; 767 return; 768 } 769 770 resetPreloading(e); 771 addClass(elem, lazySizesCfg.loadedClass); 772 removeClass(elem, lazySizesCfg.loadingClass); 773 addRemoveLoadEvents(elem, rafSwitchLoadingClass); 774 triggerEvent(elem, 'lazyloaded'); 775 }; 776 var rafedSwitchLoadingClass = rAFIt(switchLoadingClass); 777 var rafSwitchLoadingClass = function(e){ 778 rafedSwitchLoadingClass({target: e.target}); 779 }; 780 781 var changeIframeSrc = function(elem, src){ 782 var loadMode = elem.getAttribute('data-load-mode') || lazySizesCfg.iframeLoadMode; 783 784 // loadMode can be also a string! 785 if (loadMode == 0) { 786 elem.contentWindow.location.replace(src); 787 } else if (loadMode == 1) { 788 elem.src = src; 789 } 790 }; 791 792 var handleSources = function(source){ 793 var customMedia; 794 795 var sourceSrcset = source[_getAttribute](lazySizesCfg.srcsetAttr); 796 797 if( (customMedia = lazySizesCfg.customMedia[source[_getAttribute]('data-media') || source[_getAttribute]('media')]) ){ 798 source.setAttribute('media', customMedia); 799 } 800 801 if(sourceSrcset){ 802 source.setAttribute('srcset', sourceSrcset); 803 } 804 }; 805 806 var lazyUnveil = rAFIt(function (elem, detail, isAuto, sizes, isImg){ 807 var src, srcset, parent, isPicture, event, firesLoad; 808 809 if(!(event = triggerEvent(elem, 'lazybeforeunveil', detail)).defaultPrevented){ 810 811 if(sizes){ 812 if(isAuto){ 813 addClass(elem, lazySizesCfg.autosizesClass); 814 } else { 815 elem.setAttribute('sizes', sizes); 816 } 817 } 818 819 srcset = elem[_getAttribute](lazySizesCfg.srcsetAttr); 820 src = elem[_getAttribute](lazySizesCfg.srcAttr); 821 822 if(isImg) { 823 parent = elem.parentNode; 824 isPicture = parent && regPicture.test(parent.nodeName || ''); 825 } 826 827 firesLoad = detail.firesLoad || (('src' in elem) && (srcset || src || isPicture)); 828 829 event = {target: elem}; 830 831 addClass(elem, lazySizesCfg.loadingClass); 832 833 if(firesLoad){ 834 clearTimeout(resetPreloadingTimer); 835 resetPreloadingTimer = setTimeout(resetPreloading, 2500); 836 addRemoveLoadEvents(elem, rafSwitchLoadingClass, true); 837 } 838 839 if(isPicture){ 840 forEach.call(parent.getElementsByTagName('source'), handleSources); 841 } 842 843 if(srcset){ 844 elem.setAttribute('srcset', srcset); 845 } else if(src && !isPicture){ 846 if(regIframe.test(elem.nodeName)){ 847 changeIframeSrc(elem, src); 848 } else { 849 elem.src = src; 850 } 851 } 852 853 if(isImg && (srcset || isPicture)){ 854 updatePolyfill(elem, {src: src}); 855 } 856 } 857 858 if(elem._lazyRace){ 859 delete elem._lazyRace; 860 } 861 removeClass(elem, lazySizesCfg.lazyClass); 862 863 rAF(function(){ 864 // Part of this can be removed as soon as this fix is older: https://bugs.chromium.org/p/chromium/issues/detail?id=7731 (2015) 865 var isLoaded = elem.complete && elem.naturalWidth > 1; 866 867 if( !firesLoad || isLoaded){ 868 if (isLoaded) { 869 addClass(elem, lazySizesCfg.fastLoadedClass); 870 } 871 switchLoadingClass(event); 872 elem._lazyCache = true; 873 setTimeout(function(){ 874 if ('_lazyCache' in elem) { 875 delete elem._lazyCache; 876 } 877 }, 9); 878 } 879 if (elem.loading == 'lazy') { 880 isLoading--; 881 } 882 }, true); 883 }); 884 885 /** 886 * 887 * @param elem { Element } 888 */ 889 var unveilElement = function (elem){ 890 if (elem._lazyRace) {return;} 891 var detail; 892 893 var isImg = regImg.test(elem.nodeName); 894 895 //allow using sizes="auto", but don't use. it's invalid. Use data-sizes="auto" or a valid value for sizes instead (i.e.: sizes="80vw") 896 var sizes = isImg && (elem[_getAttribute](lazySizesCfg.sizesAttr) || elem[_getAttribute]('sizes')); 897 var isAuto = sizes == 'auto'; 898 899 if( (isAuto || !isCompleted) && isImg && (elem[_getAttribute]('src') || elem.srcset) && !elem.complete && !hasClass(elem, lazySizesCfg.errorClass) && hasClass(elem, lazySizesCfg.lazyClass)){return;} 900 901 detail = triggerEvent(elem, 'lazyunveilread').detail; 902 903 if(isAuto){ 904 autoSizer.updateElem(elem, true, elem.offsetWidth); 905 } 906 907 elem._lazyRace = true; 908 isLoading++; 909 910 lazyUnveil(elem, detail, isAuto, sizes, isImg); 911 }; 912 913 var afterScroll = debounce(function(){ 914 lazySizesCfg.loadMode = 3; 915 throttledCheckElements(); 916 }); 917 918 var altLoadmodeScrollListner = function(){ 919 if(lazySizesCfg.loadMode == 3){ 920 lazySizesCfg.loadMode = 2; 921 } 922 afterScroll(); 923 }; 924 925 var onload = function(){ 926 if(isCompleted){return;} 927 if(Date.now() - started < 999){ 928 setTimeout(onload, 999); 929 return; 930 } 931 932 933 isCompleted = true; 934 935 lazySizesCfg.loadMode = 3; 936 937 throttledCheckElements(); 938 939 addEventListener('scroll', altLoadmodeScrollListner, true); 940 }; 941 942 return { 943 _: function(){ 944 started = Date.now(); 945 946 lazysizes.elements = document.getElementsByClassName(lazySizesCfg.lazyClass); 947 preloadElems = document.getElementsByClassName(lazySizesCfg.lazyClass + ' ' + lazySizesCfg.preloadClass); 948 949 addEventListener('scroll', throttledCheckElements, true); 950 951 addEventListener('resize', throttledCheckElements, true); 952 953 addEventListener('pageshow', function (e) { 954 if (e.persisted) { 955 var loadingElements = document.querySelectorAll('.' + lazySizesCfg.loadingClass); 956 957 if (loadingElements.length && loadingElements.forEach) { 958 requestAnimationFrame(function () { 959 loadingElements.forEach( function (img) { 960 if (img.complete) { 961 unveilElement(img); 962 } 963 }); 964 }); 965 } 966 } 967 }); 968 969 if(window.MutationObserver){ 970 new MutationObserver( throttledCheckElements ).observe( docElem, {childList: true, subtree: true, attributes: true} ); 971 } else { 972 docElem[_addEventListener]('DOMNodeInserted', throttledCheckElements, true); 973 docElem[_addEventListener]('DOMAttrModified', throttledCheckElements, true); 974 setInterval(throttledCheckElements, 999); 975 } 976 977 addEventListener('hashchange', throttledCheckElements, true); 978 979 //, 'fullscreenchange' 980 ['focus', 'mouseover', 'click', 'load', 'transitionend', 'animationend'].forEach(function(name){ 981 document[_addEventListener](name, throttledCheckElements, true); 982 }); 983 984 if((/d$|^c/.test(document.readyState))){ 985 onload(); 986 } else { 987 addEventListener('load', onload); 988 document[_addEventListener]('DOMContentLoaded', throttledCheckElements); 989 setTimeout(onload, 20000); 990 } 991 992 if(lazysizes.elements.length){ 993 checkElements(); 994 rAF._lsFlush(); 995 } else { 996 throttledCheckElements(); 997 } 998 }, 999 checkElems: throttledCheckElements, 1000 unveil: unveilElement, 1001 _aLSL: altLoadmodeScrollListner, 1002 }; 1003 })(); 1004 1005 1006 var autoSizer = (function(){ 1007 var autosizesElems; 1008 1009 var sizeElement = rAFIt(function(elem, parent, event, width){ 1010 var sources, i, len; 1011 elem._lazysizesWidth = width; 1012 width += 'px'; 1013 1014 elem.setAttribute('sizes', width); 1015 1016 if(regPicture.test(parent.nodeName || '')){ 1017 sources = parent.getElementsByTagName('source'); 1018 for(i = 0, len = sources.length; i < len; i++){ 1019 sources[i].setAttribute('sizes', width); 1020 } 1021 } 1022 1023 if(!event.detail.dataAttr){ 1024 updatePolyfill(elem, event.detail); 1025 } 1026 }); 1027 /** 1028 * 1029 * @param elem {Element} 1030 * @param dataAttr 1031 * @param [width] { number } 1032 */ 1033 var getSizeElement = function (elem, dataAttr, width){ 1034 var event; 1035 var parent = elem.parentNode; 1036 1037 if(parent){ 1038 width = getWidth(elem, parent, width); 1039 event = triggerEvent(elem, 'lazybeforesizes', {width: width, dataAttr: !!dataAttr}); 1040 1041 if(!event.defaultPrevented){ 1042 width = event.detail.width; 1043 1044 if(width && width !== elem._lazysizesWidth){ 1045 sizeElement(elem, parent, event, width); 1046 } 1047 } 1048 } 1049 }; 1050 1051 var updateElementsSizes = function(){ 1052 var i; 1053 var len = autosizesElems.length; 1054 if(len){ 1055 i = 0; 1056 1057 for(; i < len; i++){ 1058 getSizeElement(autosizesElems[i]); 1059 } 1060 } 1061 }; 1062 1063 var debouncedUpdateElementsSizes = debounce(updateElementsSizes); 1064 1065 return { 1066 _: function(){ 1067 autosizesElems = document.getElementsByClassName(lazySizesCfg.autosizesClass); 1068 addEventListener('resize', debouncedUpdateElementsSizes); 1069 }, 1070 checkElems: debouncedUpdateElementsSizes, 1071 updateElem: getSizeElement 1072 }; 1073 })(); 1074 1075 var init = function(){ 1076 if(!init.i && document.getElementsByClassName){ 1077 init.i = true; 1078 autoSizer._(); 1079 loader._(); 1080 } 1081 }; 1082 1083 setTimeout(function(){ 1084 if(lazySizesCfg.init){ 1085 init(); 1086 } 1087 }); 1088 1089 lazysizes = { 1090 /** 1091 * @type { LazySizesConfigPartial } 1092 */ 1093 cfg: lazySizesCfg, 1094 autoSizer: autoSizer, 1095 loader: loader, 1096 init: init, 1097 uP: updatePolyfill, 1098 aC: addClass, 1099 rC: removeClass, 1100 hC: hasClass, 1101 fire: triggerEvent, 1102 gW: getWidth, 1103 rAF: rAF, 1104 }; 1105 1106 return lazysizes; 1107} 1108));
1109 1110 1111/***/ }) 1112 1113/******/ }); 1114/************************************************************************/ 1115/******/ // The module cache 1116/******/ var __webpack_module_cache__ = {}; 1117/******/ 1118/******/ // The require function 1119/******/ function __webpack_require__(moduleId) { 1120/******/ // Check if module is in cache 1121/******/ var cachedModule = __webpack_module_cache__[moduleId]; 1122/******/ if (cachedModule !== undefined) { 1123/******/ return cachedModule.exports; 1124/******/ } 1125/******/ // Create a new module (and put it into the cache) 1126/******/ var module = __webpack_module_cache__[moduleId] = { 1127/******/ // no module.id needed 1128/******/ // no module.loaded needed 1129/******/ exports: {} 1130/******/ }; 1131/******/ 1132/******/ // Execute the module function 1133/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 1134/******/ 1135/******/ // Return the exports of the module 1136/******/ return module.exports; 1137/******/ } 1138/******/ 1139/************************************************************************/ 1140/******/ /* webpack/runtime/compat get default export */ 1141/******/ !function() { 1142/******/ // getDefaultExport function for compatibility with non-harmony modules 1143/******/ __webpack_require__.n = function(module) { 1144/******/ var getter = module && module.__esModule ? 1145/******/ function() { return module['default']; } : 1146/******/ function() { return module; }; 1147/******/ __webpack_require__.d(getter, { a: getter }); 1148/******/ return getter; 1149/******/ }; 1150/******/ }(); 1151/******/ 1152/******/ /* webpack/runtime/define property getters */ 1153/******/ !function() { 1154/******/ // define getter functions for harmony exports 1155/******/ __webpack_require__.d = function(exports, definition) { 1156/******/ for(var key in definition) { 1157/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 1158/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 1159/******/ } 1160/******/ } 1161/******/ }; 1162/******/ }(); 1163/******/ 1164/******/ /* webpack/runtime/global */ 1165/******/ !function() { 1166/******/ __webpack_require__.g = (function() { 1167/******/ if (typeof globalThis === 'object') return globalThis; 1168/******/ try { 1169/******/ return this || new Function('return this')(); 1170/******/ } catch (e) { 1171/******/ if (typeof window === 'object') return window; 1172/******/ } 1173/******/ })(); 1174/******/ }(); 1175/******/ 1176/******/ /* webpack/runtime/hasOwnProperty shorthand */ 1177/******/ !function() { 1178/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 1179/******/ }(); 1180/******/ 1181/************************************************************************/ 1182// This entry need to be wrapped in an IIFE because it need to be in strict mode. 1183!function() { 1184"use strict"; 1185 1186// EXTERNAL MODULE: ./node_modules/lazysizes/lazysizes.js 1187var lazysizes = __webpack_require__(879); 1188;// CONCATENATED MODULE: ./node_modules/gsap/gsap-core.js 1189function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 1190 1191function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } 1192 1193/*! 1194 * GSAP 3.12.5 1195 * https://gsap.com 1196 * 1197 * @license Copyright 2008-2024, GreenSock. All rights reserved. 1198 * Subject to the terms at https://gsap.com/standard-license or for 1199 * Club GSAP members, the agreement issued with that membership. 1200 * @author: Jack Doyle, [email protected] 1201*/ 1202 1203/* eslint-disable */ 1204var _config = { 1205 autoSleep: 120, 1206 force3D: "auto", 1207 nullTargetWarn: 1, 1208 units: { 1209 lineHeight: "" 1210 } 1211}, 1212 _defaults = { 1213 duration: .5, 1214 overwrite: false, 1215 delay: 0 1216}, 1217 _suppressOverwrites, 1218 _reverting, 1219 _context, 1220 _bigNum = 1e8, 1221 _tinyNum = 1 / _bigNum, 1222 _2PI = Math.PI * 2, 1223 _HALF_PI = _2PI / 4, 1224 _gsID = 0, 1225 _sqrt = Math.sqrt, 1226 _cos = Math.cos, 1227 _sin = Math.sin, 1228 _isString = function _isString(value) { 1229 return typeof value === "string"; 1230}, 1231 _isFunction = function _isFunction(value) { 1232 return typeof value === "function"; 1233}, 1234 _isNumber = function _isNumber(value) { 1235 return typeof value === "number"; 1236}, 1237 _isUndefined = function _isUndefined(value) { 1238 return typeof value === "undefined"; 1239}, 1240 _isObject = function _isObject(value) { 1241 return typeof value === "object"; 1242}, 1243 _isNotFalse = function _isNotFalse(value) { 1244 return value !== false; 1245}, 1246 _windowExists = function _windowExists() { 1247 return typeof window !== "undefined"; 1248}, 1249 _isFuncOrString = function _isFuncOrString(value) { 1250 return _isFunction(value) || _isString(value); 1251}, 1252 _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function () {}, 1253 // note: IE10 has ArrayBuffer, but NOT ArrayBuffer.isView(). 1254_isArray = Array.isArray,
vendor: 10,427 bytes, lines 1255-1553
1255 _strictNumExp = /(?:-?\.?\d|\.)+/gi, 1256 //only numbers (including negatives and decimals) but NOT relative values. 1257_numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g, 1258 //finds any numbers, including ones that start with += or -=, negative numbers, and ones in scientific notation like 1e-8. 1259_numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g, 1260 _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi, 1261 //duplicate so that while we're looping through matches from exec(), it doesn't contaminate the lastIndex of _numExp which we use to search for colors too. 1262_relExp = /[+-]=-?[.\d]+/, 1263 _delimitedValueExp = /[^,'"\[\]\s]+/gi, 1264 // previously /[#\-+.]*\b[a-z\d\-=+%.]+/gi but didn't catch special characters. 1265_unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i, 1266 _globalTimeline, 1267 _win, 1268 _coreInitted, 1269 _doc, 1270 _globals = {}, 1271 _installScope = {}, 1272 _coreReady, 1273 _install = function _install(scope) { 1274 return (_installScope = _merge(scope, _globals)) && gsap; 1275}, 1276 _missingPlugin = function _missingPlugin(property, value) { 1277 return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()"); 1278}, 1279 _warn = function _warn(message, suppress) { 1280 return !suppress && console.warn(message); 1281}, 1282 _addGlobal = function _addGlobal(name, obj) { 1283 return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals; 1284}, 1285 _emptyFunc = function _emptyFunc() { 1286 return 0; 1287}, 1288 _startAtRevertConfig = { 1289 suppressEvents: true, 1290 isStart: true, 1291 kill: false 1292}, 1293 _revertConfigNoKill = { 1294 suppressEvents: true, 1295 kill: false 1296}, 1297 _revertConfig = { 1298 suppressEvents: true 1299}, 1300 _reservedProps = {}, 1301 _lazyTweens = [], 1302 _lazyLookup = {}, 1303 _lastRenderedFrame, 1304 _plugins = {}, 1305 _effects = {}, 1306 _nextGCFrame = 30, 1307 _harnessPlugins = [], 1308 _callbackNames = "", 1309 _harness = function _harness(targets) { 1310 var target = targets[0], 1311 harnessPlugin, 1312 i; 1313 _isObject(target) || _isFunction(target) || (targets = [targets]); 1314 1315 if (!(harnessPlugin = (target._gsap || {}).harness)) { 1316 // find the first target with a harness. We assume targets passed into an animation will be of similar type, meaning the same kind of harness can be used for them all (performance optimization) 1317 i = _harnessPlugins.length; 1318 1319 while (i-- && !_harnessPlugins[i].targetTest(target)) {} 1320 1321 harnessPlugin = _harnessPlugins[i]; 1322 } 1323 1324 i = targets.length; 1325 1326 while (i--) { 1327 targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1); 1328 } 1329 1330 return targets; 1331}, 1332 _getCache = function _getCache(target) { 1333 return target._gsap || _harness(toArray(target))[0]._gsap; 1334}, 1335 _getProperty = function _getProperty(target, property, v) { 1336 return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v; 1337}, 1338 _forEachName = function _forEachName(names, func) { 1339 return (names = names.split(",")).forEach(func) || names; 1340}, 1341 //split a comma-delimited list of names into an array, then run a forEach() function and return the split array (this is just a way to consolidate/shorten some code). 1342_round = function _round(value) { 1343 return Math.round(value * 100000) / 100000 || 0; 1344}, 1345 _roundPrecise = function _roundPrecise(value) { 1346 return Math.round(value * 10000000) / 10000000 || 0; 1347}, 1348 // increased precision mostly for timing values. 1349_parseRelative = function _parseRelative(start, value) { 1350 var operator = value.charAt(0), 1351 end = parseFloat(value.substr(2)); 1352 start = parseFloat(start); 1353 return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end; 1354}, 1355 _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) { 1356 //searches one array to find matches for any of the items in the toFind array. As soon as one is found, it returns true. It does NOT return all the matches; it's simply a boolean search. 1357 var l = toFind.length, 1358 i = 0; 1359 1360 for (; toSearch.indexOf(toFind[i]) < 0 && ++i < l;) {} 1361 1362 return i < l; 1363}, 1364 _lazyRender = function _lazyRender() { 1365 var l = _lazyTweens.length, 1366 a = _lazyTweens.slice(0), 1367 i, 1368 tween; 1369 1370 _lazyLookup = {}; 1371 _lazyTweens.length = 0; 1372 1373 for (i = 0; i < l; i++) { 1374 tween = a[i]; 1375 tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0); 1376 } 1377}, 1378 _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) { 1379 _lazyTweens.length && !_reverting && _lazyRender(); 1380 animation.render(time, suppressEvents, force || _reverting && time < 0 && (animation._initted || animation._startAt)); 1381 _lazyTweens.length && !_reverting && _lazyRender(); //in case rendering caused any tweens to lazy-init, we should render them because typically when someone calls seek() or time() or progress(), they expect an immediate render. 1382}, 1383 _numericIfPossible = function _numericIfPossible(value) { 1384 var n = parseFloat(value); 1385 return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value; 1386}, 1387 _passThrough = function _passThrough(p) { 1388 return p; 1389}, 1390 _setDefaults = function _setDefaults(obj, defaults) { 1391 for (var p in defaults) { 1392 p in obj || (obj[p] = defaults[p]); 1393 } 1394 1395 return obj; 1396}, 1397 _setKeyframeDefaults = function _setKeyframeDefaults(excludeDuration) { 1398 return function (obj, defaults) { 1399 for (var p in defaults) { 1400 p in obj || p === "duration" && excludeDuration || p === "ease" || (obj[p] = defaults[p]); 1401 } 1402 }; 1403}, 1404 _merge = function _merge(base, toMerge) { 1405 for (var p in toMerge) { 1406 base[p] = toMerge[p]; 1407 } 1408 1409 return base; 1410}, 1411 _mergeDeep = function _mergeDeep(base, toMerge) { 1412 for (var p in toMerge) { 1413 p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]); 1414 } 1415 1416 return base; 1417}, 1418 _copyExcluding = function _copyExcluding(obj, excluding) { 1419 var copy = {}, 1420 p; 1421 1422 for (p in obj) { 1423 p in excluding || (copy[p] = obj[p]); 1424 } 1425 1426 return copy; 1427}, 1428 _inheritDefaults = function _inheritDefaults(vars) { 1429 var parent = vars.parent || _globalTimeline, 1430 func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults; 1431 1432 if (_isNotFalse(vars.inherit)) { 1433 while (parent) { 1434 func(vars, parent.vars.defaults); 1435 parent = parent.parent || parent._dp; 1436 } 1437 } 1438 1439 return vars; 1440}, 1441 _arraysMatch = function _arraysMatch(a1, a2) { 1442 var i = a1.length, 1443 match = i === a2.length; 1444 1445 while (match && i-- && a1[i] === a2[i]) {} 1446 1447 return i < 0; 1448}, 1449 _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) { 1450 if (firstProp === void 0) { 1451 firstProp = "_first"; 1452 } 1453 1454 if (lastProp === void 0) { 1455 lastProp = "_last"; 1456 } 1457 1458 var prev = parent[lastProp], 1459 t; 1460 1461 if (sortBy) { 1462 t = child[sortBy]; 1463 1464 while (prev && prev[sortBy] > t) { 1465 prev = prev._prev; 1466 } 1467 } 1468 1469 if (prev) { 1470 child._next = prev._next; 1471 prev._next = child; 1472 } else { 1473 child._next = parent[firstProp]; 1474 parent[firstProp] = child; 1475 } 1476 1477 if (child._next) { 1478 child._next._prev = child; 1479 } else { 1480 parent[lastProp] = child; 1481 } 1482 1483 child._prev = prev; 1484 child.parent = child._dp = parent; 1485 return child; 1486}, 1487 _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) { 1488 if (firstProp === void 0) { 1489 firstProp = "_first"; 1490 } 1491 1492 if (lastProp === void 0) { 1493 lastProp = "_last"; 1494 } 1495 1496 var prev = child._prev, 1497 next = child._next; 1498 1499 if (prev) { 1500 prev._next = next; 1501 } else if (parent[firstProp] === child) { 1502 parent[firstProp] = next; 1503 } 1504 1505 if (next) { 1506 next._prev = prev; 1507 } else if (parent[lastProp] === child) { 1508 parent[lastProp] = prev; 1509 } 1510 1511 child._next = child._prev = child.parent = null; // don't delete the _dp just so we can revert if necessary. But parent should be null to indicate the item isn't in a linked list. 1512}, 1513 _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) { 1514 child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove && child.parent.remove(child); 1515 child._act = 0; 1516}, 1517 _uncache = function _uncache(animation, child) { 1518 if (animation && (!child || child._end > animation._dur || child._start < 0)) { 1519 // performance optimization: if a child animation is passed in we should only uncache if that child EXTENDS the animation (its end time is beyond the end) 1520 var a = animation; 1521 1522 while (a) { 1523 a._dirty = 1; 1524 a = a.parent; 1525 } 1526 } 1527 1528 return animation; 1529}, 1530 _recacheAncestors = function _recacheAncestors(animation) { 1531 var parent = animation.parent; 1532 1533 while (parent && parent.parent) { 1534 //sometimes we must force a re-sort of all children and update the duration/totalDuration of all ancestor timelines immediately in case, for example, in the middle of a render loop, one tween alters another tween's timeScale which shoves its startTime before 0, forcing the parent timeline to shift around and shiftChildren() which could affect that next tween's render (startTime). Doesn't matter for the root timeline though. 1535 parent._dirty = 1; 1536 parent.totalDuration(); 1537 parent = parent.parent; 1538 } 1539 1540 return animation; 1541}, 1542 _rewindStartAt = function _rewindStartAt(tween, totalTime, suppressEvents, force) { 1543 return tween._startAt && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween.vars.immediateRender && !tween.vars.autoRevert || tween._startAt.render(totalTime, true, force)); 1544}, 1545 _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) { 1546 return !animation || animation._ts && _hasNoPausedAncestors(animation.parent); 1547}, 1548 _elapsedCycleDuration = function _elapsedCycleDuration(animation) { 1549 return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0; 1550}, 1551 // feed in the totalTime and cycleDuration and it'll return the cycle (iteration minus 1) and if the playhead is exactly at the very END, it will NOT bump up to the next cycle. 1552_animationCycle = function _animationCycle(tTime, cycleDuration) { 1553 var whole = Math.floor(tTime /= cycleDuration
vendor: 15,351 bytes, lines 1553-1853
1553); 1554 return tTime && whole === tTime ? whole - 1 : whole; 1555}, 1556 _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) { 1557 return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur); 1558}, 1559 _setEnd = function _setEnd(animation) { 1560 return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0)); 1561}, 1562 _alignPlayhead = function _alignPlayhead(animation, totalTime) { 1563 // adjusts the animation's _start and _end according to the provided totalTime (only if the parent's smoothChildTiming is true and the animation isn't paused). It doesn't do any rendering or forcing things back into parent timelines, etc. - that's what totalTime() is for. 1564 var parent = animation._dp; 1565 1566 if (parent && parent.smoothChildTiming && animation._ts) { 1567 animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts)); 1568 1569 _setEnd(animation); 1570 1571 parent._dirty || _uncache(parent, animation); //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here. 1572 } 1573 1574 return animation; 1575}, 1576 1577/* 1578_totalTimeToTime = (clampedTotalTime, duration, repeat, repeatDelay, yoyo) => { 1579 let cycleDuration = duration + repeatDelay, 1580 time = _round(clampedTotalTime % cycleDuration); 1581 if (time > duration) { 1582 time = duration; 1583 } 1584 return (yoyo && (~~(clampedTotalTime / cycleDuration) & 1)) ? duration - time : time; 1585}, 1586*/ 1587_postAddChecks = function _postAddChecks(timeline, child) { 1588 var t; 1589 1590 if (child._time || !child._dur && child._initted || child._start < timeline._time && (child._dur || !child.add)) { 1591 // in case, for example, the _start is moved on a tween that has already rendered, or if it's being inserted into a timeline BEFORE where the playhead is currently. Imagine it's at its end state, then the startTime is moved WAY later (after the end of this timeline), it should render at its beginning. Special case: if it's a timeline (has .add() method) and no duration, we can skip rendering because the user may be populating it AFTER adding it to a parent timeline (unconventional, but possible, and we wouldn't want it to get removed if the parent's autoRemoveChildren is true). 1592 t = _parentToChildTotalTime(timeline.rawTime(), child); 1593 1594 if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) { 1595 child.render(t, true); 1596 } 1597 } //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate. 1598 1599 1600 if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) { 1601 //in case any of the ancestors had completed but should now be enabled... 1602 if (timeline._dur < timeline.duration()) { 1603 t = timeline; 1604 1605 while (t._dp) { 1606 t.rawTime() >= 0 && t.totalTime(t._tTime); //moves the timeline (shifts its startTime) if necessary, and also enables it. If it's currently zero, though, it may not be scheduled to render until later so there's no need to force it to align with the current playhead position. Only move to catch up with the playhead. 1607 1608 t = t._dp; 1609 } 1610 } 1611 1612 timeline._zTime = -_tinyNum; // helps ensure that the next render() will be forced (crossingStart = true in render()), even if the duration hasn't changed (we're adding a child which would need to get rendered). Definitely an edge case. Note: we MUST do this AFTER the loop above where the totalTime() might trigger a render() because this _addToTimeline() method gets called from the Animation constructor, BEFORE tweens even record their targets, etc. so we wouldn't want things to get triggered in the wrong order. 1613 } 1614}, 1615 _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) { 1616 child.parent && _removeFromParent(child); 1617 child._start = _roundPrecise((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay); 1618 child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0)); 1619 1620 _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0); 1621 1622 _isFromOrFromStart(child) || (timeline._recent = child); 1623 skipChecks || _postAddChecks(timeline, child); 1624 timeline._ts < 0 && _alignPlayhead(timeline, timeline._tTime); // if the timeline is reversed and the new child makes it longer, we may need to adjust the parent's _start (push it back) 1625 1626 return timeline; 1627}, 1628 _scrollTrigger = function _scrollTrigger(animation, trigger) { 1629 return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation); 1630}, 1631 _attemptInitTween = function _attemptInitTween(tween, time, force, suppressEvents, tTime) { 1632 _initTween(tween, time, tTime); 1633 1634 if (!tween._initted) { 1635 return 1; 1636 } 1637 1638 if (!force && tween._pt && !_reverting && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) { 1639 _lazyTweens.push(tween); 1640 1641 tween._lazy = [tTime, suppressEvents]; 1642 return 1; 1643 } 1644}, 1645 _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) { 1646 var parent = _ref.parent; 1647 return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent)); 1648}, 1649 // check parent's _lock because when a timeline repeats/yoyos and does its artificial wrapping, we shouldn't force the ratio back to 0 1650_isFromOrFromStart = function _isFromOrFromStart(_ref2) { 1651 var data = _ref2.data; 1652 return data === "isFromStart" || data === "isStart"; 1653}, 1654 _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) { 1655 var prevRatio = tween.ratio, 1656 ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1, 1657 // if the tween or its parent is reversed and the totalTime is 0, we should go to a ratio of 0. Edge case: if a from() or fromTo() stagger tween is placed later in a timeline, the "startAt" zero-duration tween could initially render at a time when the parent timeline's playhead is technically BEFORE where this tween is, so make sure that any "from" and "fromTo" startAt tweens are rendered the first time at a ratio of 1. 1658 repeatDelay = tween._rDelay, 1659 tTime = 0, 1660 pt, 1661 iteration, 1662 prevIteration; 1663 1664 if (repeatDelay && tween._repeat) { 1665 // in case there's a zero-duration tween that has a repeat with a repeatDelay 1666 tTime = _clamp(0, tween._tDur, totalTime); 1667 iteration = _animationCycle(tTime, repeatDelay); 1668 tween._yoyo && iteration & 1 && (ratio = 1 - ratio); 1669 1670 if (iteration !== _animationCycle(tween._tTime, repeatDelay)) { 1671 // if iteration changed 1672 prevRatio = 1 - ratio; 1673 tween.vars.repeatRefresh && tween._initted && tween.invalidate(); 1674 } 1675 } 1676 1677 if (ratio !== prevRatio || _reverting || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) { 1678 if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents, tTime)) { 1679 // if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately. 1680 return; 1681 } 1682 1683 prevIteration = tween._zTime; 1684 tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0); // when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. 1685 1686 suppressEvents || (suppressEvents = totalTime && !prevIteration); // if it was rendered previously at exactly 0 (_zTime) and now the playhead is moving away, DON'T fire callbacks otherwise they'll seem like duplicates. 1687 1688 tween.ratio = ratio; 1689 tween._from && (ratio = 1 - ratio); 1690 tween._time = 0; 1691 tween._tTime = tTime; 1692 pt = tween._pt; 1693 1694 while (pt) { 1695 pt.r(ratio, pt.d); 1696 pt = pt._next; 1697 } 1698 1699 totalTime < 0 && _rewindStartAt(tween, totalTime, suppressEvents, true); 1700 tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate"); 1701 tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat"); 1702 1703 if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) { 1704 ratio && _removeFromParent(tween, 1); 1705 1706 if (!suppressEvents && !_reverting) { 1707 _callback(tween, ratio ? "onComplete" : "onReverseComplete", true); 1708 1709 tween._prom && tween._prom(); 1710 } 1711 } 1712 } else if (!tween._zTime) { 1713 tween._zTime = totalTime; 1714 } 1715}, 1716 _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) { 1717 var child; 1718 1719 if (time > prevTime) { 1720 child = animation._first; 1721 1722 while (child && child._start <= time) { 1723 if (child.data === "isPause" && child._start > prevTime) { 1724 return child; 1725 } 1726 1727 child = child._next; 1728 } 1729 } else { 1730 child = animation._last; 1731 1732 while (child && child._start >= time) { 1733 if (child.data === "isPause" && child._start < prevTime) { 1734 return child; 1735 } 1736 1737 child = child._prev; 1738 } 1739 } 1740}, 1741 _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) { 1742 var repeat = animation._repeat, 1743 dur = _roundPrecise(duration) || 0, 1744 totalProgress = animation._tTime / animation._tDur; 1745 totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur); 1746 animation._dur = dur; 1747 animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat); 1748 totalProgress > 0 && !leavePlayhead && _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress); 1749 animation.parent && _setEnd(animation); 1750 skipUncache || _uncache(animation.parent, animation); 1751 return animation; 1752}, 1753 _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) { 1754 return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur); 1755}, 1756 _zeroPosition = { 1757 _start: 0, 1758 endTime: _emptyFunc, 1759 totalDuration: _emptyFunc 1760}, 1761 _parsePosition = function _parsePosition(animation, position, percentAnimation) { 1762 var labels = animation.labels, 1763 recent = animation._recent || _zeroPosition, 1764 clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur, 1765 //in case there's a child that infinitely repeats, users almost never intend for the insertion point of a new child to be based on a SUPER long value like that so we clip it and assume the most recently-added child's endTime should be used instead. 1766 i, 1767 offset, 1768 isPercent; 1769 1770 if (_isString(position) && (isNaN(position) || position in labels)) { 1771 //if the string is a number like "1", check to see if there's a label with that name, otherwise interpret it as a number (absolute value). 1772 offset = position.charAt(0); 1773 isPercent = position.substr(-1) === "%"; 1774 i = position.indexOf("="); 1775 1776 if (offset === "<" || offset === ">") { 1777 i >= 0 && (position = position.replace(/=/, "")); 1778 return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1); 1779 } 1780 1781 if (i < 0) { 1782 position in labels || (labels[position] = clippedDuration); 1783 return labels[position]; 1784 } 1785 1786 offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1)); 1787 1788 if (isPercent && percentAnimation) { 1789 offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration(); 1790 } 1791 1792 return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset; 1793 } 1794 1795 return position == null ? clippedDuration : +position; 1796}, 1797 _createTweenType = function _createTweenType(type, params, timeline) { 1798 var isLegacy = _isNumber(params[1]), 1799 varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1), 1800 vars = params[varsIndex], 1801 irVars, 1802 parent; 1803 1804 isLegacy && (vars.duration = params[1]); 1805 vars.parent = timeline; 1806 1807 if (type) { 1808 irVars = vars; 1809 parent = timeline; 1810 1811 while (parent && !("immediateRender" in irVars)) { 1812 // inheritance hasn't happened yet, but someone may have set a default in an ancestor timeline. We could do vars.immediateRender = _isNotFalse(_inheritDefaults(vars).immediateRender) but that'd exact a slight performance penalty because _inheritDefaults() also runs in the Tween constructor. We're paying a small kb price here to gain speed. 1813 irVars = parent.vars.defaults || {}; 1814 parent = _isNotFalse(parent.vars.inherit) && parent.parent; 1815 } 1816 1817 vars.immediateRender = _isNotFalse(irVars.immediateRender); 1818 type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1]; // "from" vars 1819 } 1820 1821 return new Tween(params[0], vars, params[varsIndex + 1]); 1822}, 1823 _conditionalReturn = function _conditionalReturn(value, func) { 1824 return value || value === 0 ? func(value) : func; 1825}, 1826 _clamp = function _clamp(min, max, value) { 1827 return value < min ? min : value > max ? max : value; 1828}, 1829 getUnit = function getUnit(value, v) { 1830 return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1]; 1831}, 1832 // note: protect against padded numbers as strings, like "100.100". That shouldn't return "00" as the unit. If it's numeric, return no unit. 1833clamp = function clamp(min, max, value) { 1834 return _conditionalReturn(value, function (v) { 1835 return _clamp(min, max, v); 1836 }); 1837}, 1838 _slice = [].slice, 1839 _isArrayLike = function _isArrayLike(value, nonEmpty) { 1840 return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win; 1841}, 1842 _flatten = function _flatten(ar, leaveStrings, accumulator) { 1843 if (accumulator === void 0) { 1844 accumulator = []; 1845 } 1846 1847 return ar.forEach(function (value) { 1848 var _accumulator; 1849 1850 return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value); 1851 }) || accumulator; 1852}, 1853 //
vendor: 6,500 bytes, lines 1853-2015
1853takes any value and returns an array. If it's a string (and leaveStrings isn't true), it'll use document.querySelectorAll() and convert that to an array. It'll also accept iterables like jQuery objects. 1854toArray = function toArray(value, scope, leaveStrings) { 1855 return _context && !scope && _context.selector ? _context.selector(value) : _isString(value) && !leaveStrings && (_coreInitted || !_wake()) ? _slice.call((scope || _doc).querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [value] : []; 1856}, 1857 selector = function selector(value) { 1858 value = toArray(value)[0] || _warn("Invalid scope") || {}; 1859 return function (v) { 1860 var el = value.current || value.nativeElement || value; 1861 return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value); 1862 }; 1863}, 1864 shuffle = function shuffle(a) { 1865 return a.sort(function () { 1866 return .5 - Math.random(); 1867 }); 1868}, 1869 // alternative that's a bit faster and more reliably diverse but bigger: for (let j, v, i = a.length; i; j = Math.floor(Math.random() * i), v = a[--i], a[i] = a[j], a[j] = v); return a; 1870//for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length, each}. Returns a function that expects the following parameters: index, target, array. Recognizes the following 1871distribute = function distribute(v) { 1872 if (_isFunction(v)) { 1873 return v; 1874 } 1875 1876 var vars = _isObject(v) ? v : { 1877 each: v 1878 }, 1879 //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all. 1880 ease = _parseEase(vars.ease), 1881 from = vars.from || 0, 1882 base = parseFloat(vars.base) || 0, 1883 cache = {}, 1884 isDecimal = from > 0 && from < 1, 1885 ratios = isNaN(from) || isDecimal, 1886 axis = vars.axis, 1887 ratioX = from, 1888 ratioY = from; 1889 1890 if (_isString(from)) { 1891 ratioX = ratioY = { 1892 center: .5, 1893 edges: .5, 1894 end: 1 1895 }[from] || 0; 1896 } else if (!isDecimal && ratios) { 1897 ratioX = from[0]; 1898 ratioY = from[1]; 1899 } 1900 1901 return function (i, target, a) { 1902 var l = (a || vars).length, 1903 distances = cache[l], 1904 originX, 1905 originY, 1906 x, 1907 y, 1908 d, 1909 j, 1910 max, 1911 min, 1912 wrapAt; 1913 1914 if (!distances) { 1915 wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1]; 1916 1917 if (!wrapAt) { 1918 max = -_bigNum; 1919 1920 while (max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l) {} 1921 1922 wrapAt < l && wrapAt--; 1923 } 1924 1925 distances = cache[l] = []; 1926 originX = ratios ? Math.min(wrapAt, l) * ratioX - .5 : from % wrapAt; 1927 originY = wrapAt === _bigNum ? 0 : ratios ? l * ratioY / wrapAt - .5 : from / wrapAt | 0; 1928 max = 0; 1929 min = _bigNum; 1930 1931 for (j = 0; j < l; j++) { 1932 x = j % wrapAt - originX; 1933 y = originY - (j / wrapAt | 0); 1934 distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x); 1935 d > max && (max = d); 1936 d < min && (min = d); 1937 } 1938 1939 from === "random" && shuffle(distances); 1940 distances.max = max - min; 1941 distances.min = min; 1942 distances.v = l = (parseFloat(vars.amount) || parseFloat(vars.each) * (wrapAt > l ? l - 1 : !axis ? Math.max(wrapAt, l / wrapAt) : axis === "y" ? l / wrapAt : wrapAt) || 0) * (from === "edges" ? -1 : 1); 1943 distances.b = l < 0 ? base - l : base; 1944 distances.u = getUnit(vars.amount || vars.each) || 0; //unit 1945 1946 ease = ease && l < 0 ? _invertEase(ease) : ease; 1947 } 1948 1949 l = (distances[i] - distances.min) / distances.max || 0; 1950 return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u; //round in order to work around floating point errors 1951 }; 1952}, 1953 _roundModifier = function _roundModifier(v) { 1954 //pass in 0.1 get a function that'll round to the nearest tenth, or 5 to round to the closest 5, or 0.001 to the closest 1000th, etc. 1955 var p = Math.pow(10, ((v + "").split(".")[1] || "").length); //to avoid floating point math errors (like 24 * 0.1 == 2.4000000000000004), we chop off at a specific number of decimal places (much faster than toFixed()) 1956 1957 return function (raw) { 1958 var n = _roundPrecise(Math.round(parseFloat(raw) / v) * v * p); 1959 1960 return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw)); // n - n % 1 replaces Math.floor() in order to handle negative values properly. For example, Math.floor(-150.00000000000003) is 151! 1961 }; 1962}, 1963 snap = function snap(snapTo, value) { 1964 var isArray = _isArray(snapTo), 1965 radius, 1966 is2D; 1967 1968 if (!isArray && _isObject(snapTo)) { 1969 radius = isArray = snapTo.radius || _bigNum; 1970 1971 if (snapTo.values) { 1972 snapTo = toArray(snapTo.values); 1973 1974 if (is2D = !_isNumber(snapTo[0])) { 1975 radius *= radius; //performance optimization so we don't have to Math.sqrt() in the loop. 1976 } 1977 } else { 1978 snapTo = _roundModifier(snapTo.increment); 1979 } 1980 } 1981 1982 return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function (raw) { 1983 is2D = snapTo(raw); 1984 return Math.abs(is2D - raw) <= radius ? is2D : raw; 1985 } : function (raw) { 1986 var x = parseFloat(is2D ? raw.x : raw), 1987 y = parseFloat(is2D ? raw.y : 0), 1988 min = _bigNum, 1989 closest = 0, 1990 i = snapTo.length, 1991 dx, 1992 dy; 1993 1994 while (i--) { 1995 if (is2D) { 1996 dx = snapTo[i].x - x; 1997 dy = snapTo[i].y - y; 1998 dx = dx * dx + dy * dy; 1999 } else { 2000 dx = Math.abs(snapTo[i] - x); 2001 } 2002 2003 if (dx < min) { 2004 min = dx; 2005 closest = i; 2006 } 2007 } 2008 2009 closest = !radius || min <= radius ? snapTo[closest] : raw; 2010 return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw); 2011 }); 2012}, 2013 random = function random(min, max, roundingIncrement, returnFunction) { 2014 return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function () { 2015 return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e
vendor: 2,410 bytes, lines 2015-2074
2015-5) && (returnFunction = roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2) : 1) && Math.floor(Math.round((min - roundingIncrement / 2 + Math.random() * (max - min + roundingIncrement * .99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction; 2016 }); 2017}, 2018 pipe = function pipe() { 2019 for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) { 2020 functions[_key] = arguments[_key]; 2021 } 2022 2023 return function (value) { 2024 return functions.reduce(function (v, f) { 2025 return f(v); 2026 }, value); 2027 }; 2028}, 2029 unitize = function unitize(func, unit) { 2030 return function (value) { 2031 return func(parseFloat(value)) + (unit || getUnit(value)); 2032 }; 2033}, 2034 normalize = function normalize(min, max, value) { 2035 return mapRange(min, max, 0, 1, value); 2036}, 2037 _wrapArray = function _wrapArray(a, wrapper, value) { 2038 return _conditionalReturn(value, function (index) { 2039 return a[~~wrapper(index)]; 2040 }); 2041}, 2042 wrap = function wrap(min, max, value) { 2043 // NOTE: wrap() CANNOT be an arrow function! A very odd compiling bug causes problems (unrelated to GSAP). 2044 var range = max - min; 2045 return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function (value) { 2046 return (range + (value - min) % range) % range + min; 2047 }); 2048}, 2049 wrapYoyo = function wrapYoyo(min, max, value) { 2050 var range = max - min, 2051 total = range * 2; 2052 return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function (value) { 2053 value = (total + (value - min) % total) % total || 0; 2054 return min + (value > range ? total - value : value); 2055 }); 2056}, 2057 _replaceRandom = function _replaceRandom(value) { 2058 //replaces all occurrences of random(...) in a string with the calculated random value. can be a range like random(-100, 100, 5) or an array like random([0, 100, 500]) 2059 var prev = 0, 2060 s = "", 2061 i, 2062 nums, 2063 end, 2064 isArray; 2065 2066 while (~(i = value.indexOf("random(", prev))) { 2067 end = value.indexOf(")", i); 2068 isArray = value.charAt(i + 7) === "["; 2069 nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp); 2070 s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5); 2071 prev = end + 1; 2072 } 2073 2074 return s + value.substr(prev, value.length - prev
vendor: 17,631 bytes, lines 2074-2630
2074); 2075}, 2076 mapRange = function mapRange(inMin, inMax, outMin, outMax, value) { 2077 var inRange = inMax - inMin, 2078 outRange = outMax - outMin; 2079 return _conditionalReturn(value, function (value) { 2080 return outMin + ((value - inMin) / inRange * outRange || 0); 2081 }); 2082}, 2083 interpolate = function interpolate(start, end, progress, mutate) { 2084 var func = isNaN(start + end) ? 0 : function (p) { 2085 return (1 - p) * start + p * end; 2086 }; 2087 2088 if (!func) { 2089 var isString = _isString(start), 2090 master = {}, 2091 p, 2092 i, 2093 interpolators, 2094 l, 2095 il; 2096 2097 progress === true && (mutate = 1) && (progress = null); 2098 2099 if (isString) { 2100 start = { 2101 p: start 2102 }; 2103 end = { 2104 p: end 2105 }; 2106 } else if (_isArray(start) && !_isArray(end)) { 2107 interpolators = []; 2108 l = start.length; 2109 il = l - 2; 2110 2111 for (i = 1; i < l; i++) { 2112 interpolators.push(interpolate(start[i - 1], start[i])); //build the interpolators up front as a performance optimization so that when the function is called many times, it can just reuse them. 2113 } 2114 2115 l--; 2116 2117 func = function func(p) { 2118 p *= l; 2119 var i = Math.min(il, ~~p); 2120 return interpolators[i](p - i); 2121 }; 2122 2123 progress = end; 2124 } else if (!mutate) { 2125 start = _merge(_isArray(start) ? [] : {}, start); 2126 } 2127 2128 if (!interpolators) { 2129 for (p in end) { 2130 _addPropTween.call(master, start, p, "get", end[p]); 2131 } 2132 2133 func = function func(p) { 2134 return _renderPropTweens(p, master) || (isString ? start.p : start); 2135 }; 2136 } 2137 } 2138 2139 return _conditionalReturn(progress, func); 2140}, 2141 _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) { 2142 //used for nextLabel() and previousLabel() 2143 var labels = timeline.labels, 2144 min = _bigNum, 2145 p, 2146 distance, 2147 label; 2148 2149 for (p in labels) { 2150 distance = labels[p] - fromTime; 2151 2152 if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) { 2153 label = p; 2154 min = distance; 2155 } 2156 } 2157 2158 return label; 2159}, 2160 _callback = function _callback(animation, type, executeLazyFirst) { 2161 var v = animation.vars, 2162 callback = v[type], 2163 prevContext = _context, 2164 context = animation._ctx, 2165 params, 2166 scope, 2167 result; 2168 2169 if (!callback) { 2170 return; 2171 } 2172 2173 params = v[type + "Params"]; 2174 scope = v.callbackScope || animation; 2175 executeLazyFirst && _lazyTweens.length && _lazyRender(); //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values. 2176 2177 context && (_context = context); 2178 result = params ? callback.apply(scope, params) : callback.call(scope); 2179 _context = prevContext; 2180 return result; 2181}, 2182 _interrupt = function _interrupt(animation) { 2183 _removeFromParent(animation); 2184 2185 animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting); 2186 animation.progress() < 1 && _callback(animation, "onInterrupt"); 2187 return animation; 2188}, 2189 _quickTween, 2190 _registerPluginQueue = [], 2191 _createPlugin = function _createPlugin(config) { 2192 if (!config) return; 2193 config = !config.name && config["default"] || config; // UMD packaging wraps things oddly, so for example MotionPathHelper becomes {MotionPathHelper:MotionPathHelper, default:MotionPathHelper}. 2194 2195 if (_windowExists() || config.headless) { 2196 // edge case: some build tools may pass in a null/undefined value 2197 var name = config.name, 2198 isFunc = _isFunction(config), 2199 Plugin = name && !isFunc && config.init ? function () { 2200 this._props = []; 2201 } : config, 2202 //in case someone passes in an object that's not a plugin, like CustomEase 2203 instanceDefaults = { 2204 init: _emptyFunc, 2205 render: _renderPropTweens, 2206 add: _addPropTween, 2207 kill: _killPropTweensOf, 2208 modifier: _addPluginModifier, 2209 rawVars: 0 2210 }, 2211 statics = { 2212 targetTest: 0, 2213 get: 0, 2214 getSetter: _getSetter, 2215 aliases: {}, 2216 register: 0 2217 }; 2218 2219 _wake(); 2220 2221 if (config !== Plugin) { 2222 if (_plugins[name]) { 2223 return; 2224 } 2225 2226 _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics)); //static methods 2227 2228 2229 _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics))); //instance methods 2230 2231 2232 _plugins[Plugin.prop = name] = Plugin; 2233 2234 if (config.targetTest) { 2235 _harnessPlugins.push(Plugin); 2236 2237 _reservedProps[name] = 1; 2238 } 2239 2240 name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin"; //for the global name. "motionPath" should become MotionPathPlugin 2241 } 2242 2243 _addGlobal(name, Plugin); 2244 2245 config.register && config.register(gsap, Plugin, PropTween); 2246 } else { 2247 _registerPluginQueue.push(config); 2248 } 2249}, 2250 2251/* 2252 * -------------------------------------------------------------------------------------- 2253 * COLORS 2254 * -------------------------------------------------------------------------------------- 2255 */ 2256_255 = 255, 2257 _colorLookup = { 2258 aqua: [0, _255, _255], 2259 lime: [0, _255, 0], 2260 silver: [192, 192, 192], 2261 black: [0, 0, 0], 2262 maroon: [128, 0, 0], 2263 teal: [0, 128, 128], 2264 blue: [0, 0, _255], 2265 navy: [0, 0, 128], 2266 white: [_255, _255, _255], 2267 olive: [128, 128, 0], 2268 yellow: [_255, _255, 0], 2269 orange: [_255, 165, 0], 2270 gray: [128, 128, 128], 2271 purple: [128, 0, 128], 2272 green: [0, 128, 0], 2273 red: [_255, 0, 0], 2274 pink: [_255, 192, 203], 2275 cyan: [0, _255, _255], 2276 transparent: [_255, _255, _255, 0] 2277}, 2278 // possible future idea to replace the hard-coded color name values - put this in the ticker.wake() where we set the _doc: 2279// let ctx = _doc.createElement("canvas").getContext("2d"); 2280// _forEachName("aqua,lime,silver,black,maroon,teal,blue,navy,white,olive,yellow,orange,gray,purple,green,red,pink,cyan", color => {ctx.fillStyle = color; _colorLookup[color] = splitColor(ctx.fillStyle)}); 2281_hue = function _hue(h, m1, m2) { 2282 h += h < 0 ? 1 : h > 1 ? -1 : 0; 2283 return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6 : h < .5 ? m2 : h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * _255 + .5 | 0; 2284}, 2285 splitColor = function splitColor(v, toHSL, forceAlpha) { 2286 var a = !v ? _colorLookup.black : _isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255] : 0, 2287 r, 2288 g, 2289 b, 2290 h, 2291 s, 2292 l, 2293 max, 2294 min, 2295 d, 2296 wasHSL; 2297 2298 if (!a) { 2299 if (v.substr(-1) === ",") { 2300 //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. 2301 v = v.substr(0, v.length - 1); 2302 } 2303 2304 if (_colorLookup[v]) { 2305 a = _colorLookup[v]; 2306 } else if (v.charAt(0) === "#") { 2307 if (v.length < 6) { 2308 //for shorthand like #9F0 or #9F0F (could have alpha) 2309 r = v.charAt(1); 2310 g = v.charAt(2); 2311 b = v.charAt(3); 2312 v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : ""); 2313 } 2314 2315 if (v.length === 9) { 2316 // hex with alpha, like #fd5e53ff 2317 a = parseInt(v.substr(1, 6), 16); 2318 return [a >> 16, a >> 8 & _255, a & _255, parseInt(v.substr(7), 16) / 255]; 2319 } 2320 2321 v = parseInt(v.substr(1), 16); 2322 a = [v >> 16, v >> 8 & _255, v & _255]; 2323 } else if (v.substr(0, 3) === "hsl") { 2324 a = wasHSL = v.match(_strictNumExp); 2325 2326 if (!toHSL) { 2327 h = +a[0] % 360 / 360; 2328 s = +a[1] / 100; 2329 l = +a[2] / 100; 2330 g = l <= .5 ? l * (s + 1) : l + s - l * s; 2331 r = l * 2 - g; 2332 a.length > 3 && (a[3] *= 1); //cast as number 2333 2334 a[0] = _hue(h + 1 / 3, r, g); 2335 a[1] = _hue(h, r, g); 2336 a[2] = _hue(h - 1 / 3, r, g); 2337 } else if (~v.indexOf("=")) { 2338 //if relative values are found, just return the raw strings with the relative prefixes in place. 2339 a = v.match(_numExp); 2340 forceAlpha && a.length < 4 && (a[3] = 1); 2341 return a; 2342 } 2343 } else { 2344 a = v.match(_strictNumExp) || _colorLookup.transparent; 2345 } 2346 2347 a = a.map(Number); 2348 } 2349 2350 if (toHSL && !wasHSL) { 2351 r = a[0] / _255; 2352 g = a[1] / _255; 2353 b = a[2] / _255; 2354 max = Math.max(r, g, b); 2355 min = Math.min(r, g, b); 2356 l = (max + min) / 2; 2357 2358 if (max === min) { 2359 h = s = 0; 2360 } else { 2361 d = max - min; 2362 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 2363 h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4; 2364 h *= 60; 2365 } 2366 2367 a[0] = ~~(h + .5); 2368 a[1] = ~~(s * 100 + .5); 2369 a[2] = ~~(l * 100 + .5); 2370 } 2371 2372 forceAlpha && a.length < 4 && (a[3] = 1); 2373 return a; 2374}, 2375 _colorOrderData = function _colorOrderData(v) { 2376 // strips out the colors from the string, finds all the numeric slots (with units) and returns an array of those. The Array also has a "c" property which is an Array of the index values where the colors belong. This is to help work around issues where there's a mis-matched order of color/numeric data like drop-shadow(#f00 0px 1px 2px) and drop-shadow(0x 1px 2px #f00). This is basically a helper function used in _formatColors() 2377 var values = [], 2378 c = [], 2379 i = -1; 2380 v.split(_colorExp).forEach(function (v) { 2381 var a = v.match(_numWithUnitExp) || []; 2382 values.push.apply(values, a); 2383 c.push(i += a.length + 1); 2384 }); 2385 values.c = c; 2386 return values; 2387}, 2388 _formatColors = function _formatColors(s, toHSL, orderMatchData) { 2389 var result = "", 2390 colors = (s + result).match(_colorExp), 2391 type = toHSL ? "hsla(" : "rgba(", 2392 i = 0, 2393 c, 2394 shell, 2395 d, 2396 l; 2397 2398 if (!colors) { 2399 return s; 2400 } 2401 2402 colors = colors.map(function (color) { 2403 return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")"; 2404 }); 2405 2406 if (orderMatchData) { 2407 d = _colorOrderData(s); 2408 c = orderMatchData.c; 2409 2410 if (c.join(result) !== d.c.join(result)) { 2411 shell = s.replace(_colorExp, "1").split(_numWithUnitExp); 2412 l = shell.length - 1; 2413 2414 for (; i < l; i++) { 2415 result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift()); 2416 } 2417 } 2418 } 2419 2420 if (!shell) { 2421 shell = s.split(_colorExp); 2422 l = shell.length - 1; 2423 2424 for (; i < l; i++) { 2425 result += shell[i] + colors[i]; 2426 } 2427 } 2428 2429 return result + shell[l]; 2430}, 2431 _colorExp = function () { 2432 var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b", 2433 //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc., 2434 p; 2435 2436 for (p in _colorLookup) { 2437 s += "|" + p + "\\b"; 2438 } 2439 2440 return new RegExp(s + ")", "gi"); 2441}(), 2442 _hslExp = /hsl[a]?\(/, 2443 _colorStringFilter = function _colorStringFilter(a) { 2444 var combined = a.join(" "), 2445 toHSL; 2446 _colorExp.lastIndex = 0; 2447 2448 if (_colorExp.test(combined)) { 2449 toHSL = _hslExp.test(combined); 2450 a[1] = _formatColors(a[1], toHSL); 2451 a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1])); // make sure the order of numbers/colors match with the END value. 2452 2453 return true; 2454 } 2455}, 2456 2457/* 2458 * -------------------------------------------------------------------------------------- 2459 * TICKER 2460 * -------------------------------------------------------------------------------------- 2461 */ 2462_tickerActive, 2463 _ticker = function () { 2464 var _getTime = Date.now, 2465 _lagThreshold = 500, 2466 _adjustedLag = 33, 2467 _startTime = _getTime(), 2468 _lastUpdate = _startTime, 2469 _gap = 1000 / 240, 2470 _nextTime = _gap, 2471 _listeners = [], 2472 _id, 2473 _req, 2474 _raf, 2475 _self, 2476 _delta, 2477 _i, 2478 _tick = function _tick(v) { 2479 var elapsed = _getTime() - _lastUpdate, 2480 manual = v === true, 2481 overlap, 2482 dispatch, 2483 time, 2484 frame; 2485 2486 (elapsed > _lagThreshold || elapsed < 0) && (_startTime += elapsed - _adjustedLag); 2487 _lastUpdate += elapsed; 2488 time = _lastUpdate - _startTime; 2489 overlap = time - _nextTime; 2490 2491 if (overlap > 0 || manual) { 2492 frame = ++_self.frame; 2493 _delta = time - _self.time * 1000; 2494 _self.time = time = time / 1000; 2495 _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap); 2496 dispatch = 1; 2497 } 2498 2499 manual || (_id = _req(_tick)); //make sure the request is made before we dispatch the "tick" event so that timing is maintained. Otherwise, if processing the "tick" requires a bunch of time (like 15ms) and we're using a setTimeout() that's based on 16.7ms, it'd technically take 31.7ms between frames otherwise. 2500 2501 if (dispatch) { 2502 for (_i = 0; _i < _listeners.length; _i++) { 2503 // use _i and check _listeners.length instead of a variable because a listener could get removed during the loop, and if that happens to an element less than the current index, it'd throw things off in the loop. 2504 _listeners[_i](time, _delta, frame, v); 2505 } 2506 } 2507 }; 2508 2509 _self = { 2510 time: 0, 2511 frame: 0, 2512 tick: function tick() { 2513 _tick(true); 2514 }, 2515 deltaRatio: function deltaRatio(fps) { 2516 return _delta / (1000 / (fps || 60)); 2517 }, 2518 wake: function wake() { 2519 if (_coreReady) { 2520 if (!_coreInitted && _windowExists()) { 2521 _win = _coreInitted = window; 2522 _doc = _win.document || {}; 2523 _globals.gsap = gsap; 2524 (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version); 2525 2526 _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {}); 2527 2528 _registerPluginQueue.forEach(_createPlugin); 2529 } 2530 2531 _raf = typeof requestAnimationFrame !== "undefined" && requestAnimationFrame; 2532 _id && _self.sleep(); 2533 2534 _req = _raf || function (f) { 2535 return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0); 2536 }; 2537 2538 _tickerActive = 1; 2539 2540 _tick(2); 2541 } 2542 }, 2543 sleep: function sleep() { 2544 (_raf ? cancelAnimationFrame : clearTimeout)(_id); 2545 _tickerActive = 0; 2546 _req = _emptyFunc; 2547 }, 2548 lagSmoothing: function lagSmoothing(threshold, adjustedLag) { 2549 _lagThreshold = threshold || Infinity; // zero should be interpreted as basically unlimited 2550 2551 _adjustedLag = Math.min(adjustedLag || 33, _lagThreshold); 2552 }, 2553 fps: function fps(_fps) { 2554 _gap = 1000 / (_fps || 240); 2555 _nextTime = _self.time * 1000 + _gap; 2556 }, 2557 add: function add(callback, once, prioritize) { 2558 var func = once ? function (t, d, f, v) { 2559 callback(t, d, f, v); 2560 2561 _self.remove(func); 2562 } : callback; 2563 2564 _self.remove(callback); 2565 2566 _listeners[prioritize ? "unshift" : "push"](func); 2567 2568 _wake(); 2569 2570 return func; 2571 }, 2572 remove: function remove(callback, i) { 2573 ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--; 2574 }, 2575 _listeners: _listeners 2576 }; 2577 return _self; 2578}(), 2579 _wake = function _wake() { 2580 return !_tickerActive && _ticker.wake(); 2581}, 2582 //also ensures the core classes are initialized. 2583 2584/* 2585* ------------------------------------------------- 2586* EASING 2587* ------------------------------------------------- 2588*/ 2589_easeMap = {}, 2590 _customEaseExp = /^[\d.\-M][\d.\-,\s]/, 2591 _quotesExp = /["']/g, 2592 _parseObjectInString = function _parseObjectInString(value) { 2593 //takes a string like "{wiggles:10, type:anticipate})" and turns it into a real object. Notice it ends in ")" and includes the {} wrappers. This is because we only use this function for parsing ease configs and prioritized optimization rather than reusability. 2594 var obj = {}, 2595 split = value.substr(1, value.length - 3).split(":"), 2596 key = split[0], 2597 i = 1, 2598 l = split.length, 2599 index, 2600 val, 2601 parsedVal; 2602 2603 for (; i < l; i++) { 2604 val = split[i]; 2605 index = i !== l - 1 ? val.lastIndexOf(",") : val.length; 2606 parsedVal = val.substr(0, index); 2607 obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal; 2608 key = val.substr(index + 1).trim(); 2609 } 2610 2611 return obj; 2612}, 2613 _valueInParentheses = function _valueInParentheses(value) { 2614 var open = value.indexOf("(") + 1, 2615 close = value.indexOf(")"), 2616 nested = value.indexOf("(", open); 2617 return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close); 2618}, 2619 _configEaseFromString = function _configEaseFromString(name) { 2620 //name can be a string like "elastic.out(1,0.5)", and pass in _easeMap as obj and it'll parse it out and call the actual function like _easeMap.Elastic.easeOut.config(1,0.5). It will also parse custom ease strings as long as CustomEase is loaded and registered (internally as _easeMap._CE). 2621 var split = (name + "").split("("), 2622 ease = _easeMap[split[0]]; 2623 return ease && split.length > 1 && ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [_parseObjectInString(split[1])] : _valueInParentheses(name).split(",").map(_numericIfPossible)) : _easeMap._CE && _customEaseExp.test(name) ? _easeMap._CE("", name) : ease; 2624}, 2625 _invertEase = function _invertEase(ease) { 2626 return function (p) { 2627 return 1 - ease(1 - p); 2628 }; 2629}, 2630
vendor: 4,279 bytes, lines 2630-2758
2630// allow yoyoEase to be set in children and have those affected when the parent/ancestor timeline yoyos. 2631_propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) { 2632 var child = timeline._first, 2633 ease; 2634 2635 while (child) { 2636 if (child instanceof Timeline) { 2637 _propagateYoyoEase(child, isYoyo); 2638 } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) { 2639 if (child.timeline) { 2640 _propagateYoyoEase(child.timeline, isYoyo); 2641 } else { 2642 ease = child._ease; 2643 child._ease = child._yEase; 2644 child._yEase = ease; 2645 child._yoyo = isYoyo; 2646 } 2647 } 2648 2649 child = child._next; 2650 } 2651}, 2652 _parseEase = function _parseEase(ease, defaultEase) { 2653 return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase; 2654}, 2655 _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) { 2656 if (easeOut === void 0) { 2657 easeOut = function easeOut(p) { 2658 return 1 - easeIn(1 - p); 2659 }; 2660 } 2661 2662 if (easeInOut === void 0) { 2663 easeInOut = function easeInOut(p) { 2664 return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2; 2665 }; 2666 } 2667 2668 var ease = { 2669 easeIn: easeIn, 2670 easeOut: easeOut, 2671 easeInOut: easeInOut 2672 }, 2673 lowercaseName; 2674 2675 _forEachName(names, function (name) { 2676 _easeMap[name] = _globals[name] = ease; 2677 _easeMap[lowercaseName = name.toLowerCase()] = easeOut; 2678 2679 for (var p in ease) { 2680 _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p]; 2681 } 2682 }); 2683 2684 return ease; 2685}, 2686 _easeInOutFromOut = function _easeInOutFromOut(easeOut) { 2687 return function (p) { 2688 return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2; 2689 }; 2690}, 2691 _configElastic = function _configElastic(type, amplitude, period) { 2692 var p1 = amplitude >= 1 ? amplitude : 1, 2693 //note: if amplitude is < 1, we simply adjust the period for a more natural feel. Otherwise the math doesn't work right and the curve starts at 1. 2694 p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1), 2695 p3 = p2 / _2PI * (Math.asin(1 / p1) || 0), 2696 easeOut = function easeOut(p) { 2697 return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1; 2698 }, 2699 ease = type === "out" ? easeOut : type === "in" ? function (p) { 2700 return 1 - easeOut(1 - p); 2701 } : _easeInOutFromOut(easeOut); 2702 2703 p2 = _2PI / p2; //precalculate to optimize 2704 2705 ease.config = function (amplitude, period) { 2706 return _configElastic(type, amplitude, period); 2707 }; 2708 2709 return ease; 2710}, 2711 _configBack = function _configBack(type, overshoot) { 2712 if (overshoot === void 0) { 2713 overshoot = 1.70158; 2714 } 2715 2716 var easeOut = function easeOut(p) { 2717 return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0; 2718 }, 2719 ease = type === "out" ? easeOut : type === "in" ? function (p) { 2720 return 1 - easeOut(1 - p); 2721 } : _easeInOutFromOut(easeOut); 2722 2723 ease.config = function (overshoot) { 2724 return _configBack(type, overshoot); 2725 }; 2726 2727 return ease; 2728}; // a cheaper (kb and cpu) but more mild way to get a parameterized weighted ease by feeding in a value between -1 (easeIn) and 1 (easeOut) where 0 is linear. 2729// _weightedEase = ratio => { 2730// let y = 0.5 + ratio / 2; 2731// return p => (2 * (1 - p) * p * y + p * p); 2732// }, 2733// a stronger (but more expensive kb/cpu) parameterized weighted ease that lets you feed in a value between -1 (easeIn) and 1 (easeOut) where 0 is linear. 2734// _weightedEaseStrong = ratio => { 2735// ratio = .5 + ratio / 2; 2736// let o = 1 / 3 * (ratio < .5 ? ratio : 1 - ratio), 2737// b = ratio - o, 2738// c = ratio + o; 2739// return p => p === 1 ? p : 3 * b * (1 - p) * (1 - p) * p + 3 * c * (1 - p) * p * p + p * p * p; 2740// }; 2741 2742 2743_forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function (name, i) { 2744 var power = i < 5 ? i + 1 : i; 2745 2746 _insertEase(name + ",Power" + (power - 1), i ? function (p) { 2747 return Math.pow(p, power); 2748 } : function (p) { 2749 return p; 2750 }, function (p) { 2751 return 1 - Math.pow(1 - p, power); 2752 }, function (p) { 2753 return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2; 2754 }); 2755}); 2756 2757_easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn; 2758
vendor: 4,115 bytes, lines 2759-2893
2759_insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic()); 2760 2761(function (n, c) { 2762 var n1 = 1 / c, 2763 n2 = 2 * n1, 2764 n3 = 2.5 * n1, 2765 easeOut = function easeOut(p) { 2766 return p < n1 ? n * p * p : p < n2 ? n * Math.pow(p - 1.5 / c, 2) + .75 : p < n3 ? n * (p -= 2.25 / c) * p + .9375 : n * Math.pow(p - 2.625 / c, 2) + .984375; 2767 }; 2768 2769 _insertEase("Bounce", function (p) { 2770 return 1 - easeOut(1 - p); 2771 }, easeOut); 2772})(7.5625, 2.75); 2773 2774_insertEase("Expo", function (p) { 2775 return p ? Math.pow(2, 10 * (p - 1)) : 0; 2776}); 2777 2778_insertEase("Circ", function (p) { 2779 return -(_sqrt(1 - p * p) - 1); 2780}); 2781 2782_insertEase("Sine", function (p) { 2783 return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1; 2784}); 2785 2786_insertEase("Back", _configBack("in"), _configBack("out"), _configBack()); 2787 2788_easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = { 2789 config: function config(steps, immediateStart) { 2790 if (steps === void 0) { 2791 steps = 1; 2792 } 2793 2794 var p1 = 1 / steps, 2795 p2 = steps + (immediateStart ? 0 : 1), 2796 p3 = immediateStart ? 1 : 0, 2797 max = 1 - _tinyNum; 2798 return function (p) { 2799 return ((p2 * _clamp(0, max, p) | 0) + p3) * p1; 2800 }; 2801 } 2802}; 2803_defaults.ease = _easeMap["quad.out"]; 2804 2805_forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function (name) { 2806 return _callbackNames += name + "," + name + "Params,"; 2807}); 2808/* 2809 * -------------------------------------------------------------------------------------- 2810 * CACHE 2811 * -------------------------------------------------------------------------------------- 2812 */ 2813 2814 2815var GSCache = function GSCache(target, harness) { 2816 this.id = _gsID++; 2817 target._gsap = this; 2818 this.target = target; 2819 this.harness = harness; 2820 this.get = harness ? harness.get : _getProperty; 2821 this.set = harness ? harness.getSetter : _getSetter; 2822}; 2823/* 2824 * -------------------------------------------------------------------------------------- 2825 * ANIMATION 2826 * -------------------------------------------------------------------------------------- 2827 */ 2828 2829var Animation = /*#__PURE__*/function () { 2830 function Animation(vars) { 2831 this.vars = vars; 2832 this._delay = +vars.delay || 0; 2833 2834 if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) { 2835 // TODO: repeat: Infinity on a timeline's children must flag that timeline internally and affect its totalDuration, otherwise it'll stop in the negative direction when reaching the start. 2836 this._rDelay = vars.repeatDelay || 0; 2837 this._yoyo = !!vars.yoyo || !!vars.yoyoEase; 2838 } 2839 2840 this._ts = 1; 2841 2842 _setDuration(this, +vars.duration, 1, 1); 2843 2844 this.data = vars.data; 2845 2846 if (_context) { 2847 this._ctx = _context; 2848 2849 _context.data.push(this); 2850 } 2851 2852 _tickerActive || _ticker.wake(); 2853 } 2854 2855 var _proto = Animation.prototype; 2856 2857 _proto.delay = function delay(value) { 2858 if (value || value === 0) { 2859 this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay); 2860 this._delay = value; 2861 return this; 2862 } 2863 2864 return this._delay; 2865 }; 2866 2867 _proto.duration = function duration(value) { 2868 return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur; 2869 }; 2870 2871 _proto.totalDuration = function totalDuration(value) { 2872 if (!arguments.length) { 2873 return this._tDur; 2874 } 2875 2876 this._dirty = 0; 2877 return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1)); 2878 }; 2879 2880 _proto.totalTime = function totalTime(_totalTime, suppressEvents) { 2881 _wake(); 2882 2883 if (!arguments.length) { 2884 return this._tTime; 2885 } 2886 2887 var parent = this._dp; 2888 2889 if (parent && parent.smoothChildTiming && this._ts) { 2890 _alignPlayhead(this, _totalTime); 2891 2892 !parent._dp || parent.parent || _postAddChecks(parent, this); // edge case: if this is a child of a timeline that already completed, for example, we must re-activate the parent. 2893 //in case any of the ancestor timelines had completed but should now be enabled, we should reset the
vendor: 9,142 bytes, lines 2893-3044
2893ir totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The start of that child would get pushed out, but one of the ancestors may have completed. 2894 2895 while (parent && parent.parent) { 2896 if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) { 2897 parent.totalTime(parent._tTime, true); 2898 } 2899 2900 parent = parent.parent; 2901 } 2902 2903 if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) { 2904 //if the animation doesn't have a parent, put it back into its last parent (recorded as _dp for exactly cases like this). Limit to parents with autoRemoveChildren (like globalTimeline) so that if the user manually removes an animation from a timeline and then alters its playhead, it doesn't get added back in. 2905 _addToTimeline(this._dp, this, this._start - this._delay); 2906 } 2907 } 2908 2909 if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) { 2910 // check for _ptLookup on a Tween instance to ensure it has actually finished being instantiated, otherwise if this.reverse() gets called in the Animation constructor, it could trigger a render() here even though the _targets weren't populated, thus when _init() is called there won't be any PropTweens (it'll act like the tween is non-functional) 2911 this._ts || (this._pTime = _totalTime); // otherwise, if an animation is paused, then the playhead is moved back to zero, then resumed, it'd revert back to the original time at the pause 2912 //if (!this._lock) { // avoid endless recursion (not sure we need this yet or if it's worth the performance hit) 2913 // this._lock = 1; 2914 2915 _lazySafeRender(this, _totalTime, suppressEvents); // this._lock = 0; 2916 //} 2917 2918 } 2919 2920 return this; 2921 }; 2922 2923 _proto.time = function time(value, suppressEvents) { 2924 return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time; // note: if the modulus results in 0, the playhead could be exactly at the end or the beginning, and we always defer to the END with a non-zero value, otherwise if you set the time() to the very end (duration()), it would render at the START! 2925 }; 2926 2927 _proto.totalProgress = function totalProgress(value, suppressEvents) { 2928 return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.rawTime() > 0 ? 1 : 0; 2929 }; 2930 2931 _proto.progress = function progress(value, suppressEvents) { 2932 return arguments.length ? this.totalTime(this.duration() * (this._yoyo && !(this.iteration() & 1) ? 1 - value : value) + _elapsedCycleDuration(this), suppressEvents) : this.duration() ? Math.min(1, this._time / this._dur) : this.rawTime() > 0 ? 1 : 0; 2933 }; 2934 2935 _proto.iteration = function iteration(value, suppressEvents) { 2936 var cycleDuration = this.duration() + this._rDelay; 2937 2938 return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1; 2939 } // potential future addition: 2940 // isPlayingBackwards() { 2941 // let animation = this, 2942 // orientation = 1; // 1 = forward, -1 = backward 2943 // while (animation) { 2944 // orientation *= animation.reversed() || (animation.repeat() && !(animation.iteration() & 1)) ? -1 : 1; 2945 // animation = animation.parent; 2946 // } 2947 // return orientation < 0; 2948 // } 2949 ; 2950 2951 _proto.timeScale = function timeScale(value, suppressEvents) { 2952 if (!arguments.length) { 2953 return this._rts === -_tinyNum ? 0 : this._rts; // recorded timeScale. Special case: if someone calls reverse() on an animation with timeScale of 0, we assign it -_tinyNum to remember it's reversed. 2954 } 2955 2956 if (this._rts === value) { 2957 return this; 2958 } 2959 2960 var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime; // make sure to do the parentToChildTotalTime() BEFORE setting the new _ts because the old one must be used in that calculation. 2961 // future addition? Up side: fast and minimal file size. Down side: only works on this animation; if a timeline is reversed, for example, its childrens' onReverse wouldn't get called. 2962 //(+value < 0 && this._rts >= 0) && _callback(this, "onReverse", true); 2963 // prioritize rendering where the parent's playhead lines up instead of this._tTime because there could be a tween that's animating another tween's timeScale in the same rendering loop (same parent), thus if the timeScale tween renders first, it would alter _start BEFORE _tTime was set on that tick (in the rendering loop), effectively freezing it until the timeScale tween finishes. 2964 2965 this._rts = +value || 0; 2966 this._ts = this._ps || value === -_tinyNum ? 0 : this._rts; // _ts is the functional timeScale which would be 0 if the animation is paused. 2967 2968 this.totalTime(_clamp(-Math.abs(this._delay), this._tDur, tTime), suppressEvents !== false); 2969 2970 _setEnd(this); // if parent.smoothChildTiming was false, the end time didn't get updated in the _alignPlayhead() method, so do it here. 2971 2972 2973 return _recacheAncestors(this); 2974 }; 2975 2976 _proto.paused = function paused(value) { 2977 if (!arguments.length) { 2978 return this._ps; 2979 } 2980 2981 if (this._ps !== value) { 2982 this._ps = value; 2983 2984 if (value) { 2985 this._pTime = this._tTime || Math.max(-this._delay, this.rawTime()); // if the pause occurs during the delay phase, make sure that's factored in when resuming. 2986 2987 this._ts = this._act = 0; // _ts is the functional timeScale, so a paused tween would effectively have a timeScale of 0. We record the "real" timeScale as _rts (recorded time scale) 2988 } else { 2989 _wake(); 2990 2991 this._ts = this._rts; //only defer to _pTime (pauseTime) if tTime is zero. Remember, someone could pause() an animation, then scrub the playhead and resume(). If the parent doesn't have smoothChildTiming, we render at the rawTime() because the startTime won't get updated. 2992 2993 this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum)); // edge case: animation.progress(1).pause().play() wouldn't render again because the playhead is already at the end, but the call to totalTime() below will add it back to its parent...and not remove it again (since removing only happens upon rendering at a new time). Offsetting the _tTime slightly is done simply to cause the final render in totalTime() that'll pop it off its timeline (if autoRemoveChildren is true, of course). Check to make sure _zTime isn't -_tinyNum to avoid an edge case where the playhead is pushed to the end but INSIDE a tween/callback, the timeline itself is paused thus halting rendering and leaving a few unrendered. When resuming, it wouldn't render those otherwise. 2994 } 2995 } 2996 2997 return this; 2998 }; 2999 3000 _proto.startTime = function startTime(value) { 3001 if (arguments.length) { 3002 this._start = value; 3003 var parent = this.parent || this._dp; 3004 parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay); 3005 return this; 3006 } 3007 3008 return this._start; 3009 }; 3010 3011 _proto.endTime = function endTime(includeRepeats) { 3012 return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1); 3013 }; 3014 3015 _proto.rawTime = function rawTime(wrapRepeats) { 3016 var parent = this.parent || this._dp; // _dp = detached parent 3017 3018 return !parent ? this._tTime : wrapRepeats && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : !this._ts ? this._tTime : _parentToChildTotalTime(parent.rawTime(wrapRepeats), this); 3019 }; 3020 3021 _proto.revert = function revert(config) { 3022 if (config === void 0) { 3023 config = _revertConfig; 3024 } 3025 3026 var prevIsReverting = _reverting; 3027 _reverting = config; 3028 3029 if (this._initted || this._startAt) { 3030 this.timeline && this.timeline.revert(config); 3031 this.totalTime(-0.01, config.suppressEvents); 3032 } 3033 3034 this.data !== "nested" && config.kill !== false && this.kill(); 3035 _reverting = prevIsReverting; 3036 return this; 3037 }; 3038 3039 _proto.globalTime = function globalTime(rawTime) { 3040 var animation = this, 3041 time = arguments.length ? rawTime : animation.rawTime(); 3042 3043 while (animation) { 3044 time = animation._start + time / (Math.abs(animation._ts) || 1
vendor: 2,328 bytes, lines 3044-3118
3044); 3045 animation = animation._dp; 3046 } 3047 3048 return !this.parent && this._sat ? this._sat.globalTime(rawTime) : time; // the _startAt tweens for .fromTo() and .from() that have immediateRender should always be FIRST in the timeline (important for context.revert()). "_sat" stands for _startAtTween, referring to the parent tween that created the _startAt. We must discern if that tween had immediateRender so that we can know whether or not to prioritize it in revert(). 3049 }; 3050 3051 _proto.repeat = function repeat(value) { 3052 if (arguments.length) { 3053 this._repeat = value === Infinity ? -2 : value; 3054 return _onUpdateTotalDuration(this); 3055 } 3056 3057 return this._repeat === -2 ? Infinity : this._repeat; 3058 }; 3059 3060 _proto.repeatDelay = function repeatDelay(value) { 3061 if (arguments.length) { 3062 var time = this._time; 3063 this._rDelay = value; 3064 3065 _onUpdateTotalDuration(this); 3066 3067 return time ? this.time(time) : this; 3068 } 3069 3070 return this._rDelay; 3071 }; 3072 3073 _proto.yoyo = function yoyo(value) { 3074 if (arguments.length) { 3075 this._yoyo = value; 3076 return this; 3077 } 3078 3079 return this._yoyo; 3080 }; 3081 3082 _proto.seek = function seek(position, suppressEvents) { 3083 return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents)); 3084 }; 3085 3086 _proto.restart = function restart(includeDelay, suppressEvents) { 3087 return this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents)); 3088 }; 3089 3090 _proto.play = function play(from, suppressEvents) { 3091 from != null && this.seek(from, suppressEvents); 3092 return this.reversed(false).paused(false); 3093 }; 3094 3095 _proto.reverse = function reverse(from, suppressEvents) { 3096 from != null && this.seek(from || this.totalDuration(), suppressEvents); 3097 return this.reversed(true).paused(false); 3098 }; 3099 3100 _proto.pause = function pause(atTime, suppressEvents) { 3101 atTime != null && this.seek(atTime, suppressEvents); 3102 return this.paused(true); 3103 }; 3104 3105 _proto.resume = function resume() { 3106 return this.paused(false); 3107 }; 3108 3109 _proto.reversed = function reversed(value) { 3110 if (arguments.length) { 3111 !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0)); // in case timeScale is zero, reversing would have no effect so we use _tinyNum. 3112 3113 return this; 3114 } 3115 3116 return this._rts < 0; 3117 }; 3118
vendor: 9,408 bytes, lines 3119-3357
3119 _proto.invalidate = function invalidate() { 3120 this._initted = this._act = 0; 3121 this._zTime = -_tinyNum; 3122 return this; 3123 }; 3124 3125 _proto.isActive = function isActive() { 3126 var parent = this.parent || this._dp, 3127 start = this._start, 3128 rawTime; 3129 return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum); 3130 }; 3131 3132 _proto.eventCallback = function eventCallback(type, callback, params) { 3133 var vars = this.vars; 3134 3135 if (arguments.length > 1) { 3136 if (!callback) { 3137 delete vars[type]; 3138 } else { 3139 vars[type] = callback; 3140 params && (vars[type + "Params"] = params); 3141 type === "onUpdate" && (this._onUpdate = callback); 3142 } 3143 3144 return this; 3145 } 3146 3147 return vars[type]; 3148 }; 3149 3150 _proto.then = function then(onFulfilled) { 3151 var self = this; 3152 return new Promise(function (resolve) { 3153 var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough, 3154 _resolve = function _resolve() { 3155 var _then = self.then; 3156 self.then = null; // temporarily null the then() method to avoid an infinite loop (see https://github.com/greensock/GSAP/issues/322) 3157 3158 _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then); 3159 resolve(f); 3160 self.then = _then; 3161 }; 3162 3163 if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) { 3164 _resolve(); 3165 } else { 3166 self._prom = _resolve; 3167 } 3168 }); 3169 }; 3170 3171 _proto.kill = function kill() { 3172 _interrupt(this); 3173 }; 3174 3175 return Animation; 3176}(); 3177 3178_setDefaults(Animation.prototype, { 3179 _time: 0, 3180 _start: 0, 3181 _end: 0, 3182 _tTime: 0, 3183 _tDur: 0, 3184 _dirty: 0, 3185 _repeat: 0, 3186 _yoyo: false, 3187 parent: null, 3188 _initted: false, 3189 _rDelay: 0, 3190 _ts: 1, 3191 _dp: 0, 3192 ratio: 0, 3193 _zTime: -_tinyNum, 3194 _prom: 0, 3195 _ps: false, 3196 _rts: 1 3197}); 3198/* 3199 * ------------------------------------------------- 3200 * TIMELINE 3201 * ------------------------------------------------- 3202 */ 3203 3204 3205var Timeline = /*#__PURE__*/function (_Animation) { 3206 _inheritsLoose(Timeline, _Animation); 3207 3208 function Timeline(vars, position) { 3209 var _this; 3210 3211 if (vars === void 0) { 3212 vars = {}; 3213 } 3214 3215 _this = _Animation.call(this, vars) || this; 3216 _this.labels = {}; 3217 _this.smoothChildTiming = !!vars.smoothChildTiming; 3218 _this.autoRemoveChildren = !!vars.autoRemoveChildren; 3219 _this._sort = _isNotFalse(vars.sortChildren); 3220 _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position); 3221 vars.reversed && _this.reverse(); 3222 vars.paused && _this.paused(true); 3223 vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger); 3224 return _this; 3225 } 3226 3227 var _proto2 = Timeline.prototype; 3228 3229 _proto2.to = function to(targets, vars, position) { 3230 _createTweenType(0, arguments, this); 3231 3232 return this; 3233 }; 3234 3235 _proto2.from = function from(targets, vars, position) { 3236 _createTweenType(1, arguments, this); 3237 3238 return this; 3239 }; 3240 3241 _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) { 3242 _createTweenType(2, arguments, this); 3243 3244 return this; 3245 }; 3246 3247 _proto2.set = function set(targets, vars, position) { 3248 vars.duration = 0; 3249 vars.parent = this; 3250 _inheritDefaults(vars).repeatDelay || (vars.repeat = 0); 3251 vars.immediateRender = !!vars.immediateRender; 3252 new Tween(targets, vars, _parsePosition(this, position), 1); 3253 return this; 3254 }; 3255 3256 _proto2.call = function call(callback, params, position) { 3257 return _addToTimeline(this, Tween.delayedCall(0, callback, params), position); 3258 } //ONLY for backward compatibility! Maybe delete? 3259 ; 3260 3261 _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 3262 vars.duration = duration; 3263 vars.stagger = vars.stagger || stagger; 3264 vars.onComplete = onCompleteAll; 3265 vars.onCompleteParams = onCompleteAllParams; 3266 vars.parent = this; 3267 new Tween(targets, vars, _parsePosition(this, position)); 3268 return this; 3269 }; 3270 3271 _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 3272 vars.runBackwards = 1; 3273 _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender); 3274 return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams); 3275 }; 3276 3277 _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) { 3278 toVars.startAt = fromVars; 3279 _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender); 3280 return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams); 3281 }; 3282 3283 _proto2.render = function render(totalTime, suppressEvents, force) { 3284 var prevTime = this._time, 3285 tDur = this._dirty ? this.totalDuration() : this._tDur, 3286 dur = this._dur, 3287 tTime = totalTime <= 0 ? 0 : _roundPrecise(totalTime), 3288 // if a paused timeline is resumed (or its _start is updated for another reason...which rounds it), that could result in the playhead shifting a **tiny** amount and a zero-duration child at that spot may get rendered at a different ratio, like its totalTime in render() may be 1e-17 instead of 0, for example. 3289 crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur), 3290 time, 3291 child, 3292 next, 3293 iteration, 3294 cycleDuration, 3295 prevPaused, 3296 pauseTween, 3297 timeScale, 3298 prevStart, 3299 prevIteration, 3300 yoyo, 3301 isYoyo; 3302 this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur); 3303 3304 if (tTime !== this._tTime || force || crossingStart) { 3305 if (prevTime !== this._time && dur) { 3306 //if totalDuration() finds a child with a negative startTime and smoothChildTiming is true, things get shifted around internally so we need to adjust the time accordingly. For example, if a tween starts at -30 we must shift EVERYTHING forward 30 seconds and move this timeline's startTime backward by 30 seconds so that things align with the playhead (no jump). 3307 tTime += this._time - prevTime; 3308 totalTime += this._time - prevTime; 3309 } 3310 3311 time = tTime; 3312 prevStart = this._start; 3313 timeScale = this._ts; 3314 prevPaused = !timeScale; 3315 3316 if (crossingStart) { 3317 dur || (prevTime = this._zTime); //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. 3318 3319 (totalTime || !suppressEvents) && (this._zTime = totalTime); 3320 } 3321 3322 if (this._repeat) { 3323 //adjust the time for repeats and yoyos 3324 yoyo = this._yoyo; 3325 cycleDuration = dur + this._rDelay; 3326 3327 if (this._repeat < -1 && totalTime < 0) { 3328 return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 3329 } 3330 3331 time = _roundPrecise(tTime % cycleDuration); //round to avoid floating point errors. (4 % 0.8 should be 0 but some browsers report it as 0.79999999!) 3332 3333 if (tTime === tDur) { 3334 // the tDur === tTime is for edge cases where there's a lengthy decimal on the duration and it may reach the very end but the time is rendered as not-quite-there (remember, tDur is rounded to 4 decimals whereas dur isn't) 3335 iteration = this._repeat; 3336 time = dur; 3337 } else { 3338 iteration = ~~(tTime / cycleDuration); 3339 3340 if (iteration && iteration === tTime / cycleDuration) { 3341 time = dur; 3342 iteration--; 3343 } 3344 3345 time > dur && (time = dur); 3346 } 3347 3348 prevIteration = _animationCycle(this._tTime, cycleDuration); 3349 !prevTime && this._tTime && prevIteration !== iteration && this._tTime - prevIteration * cycleDuration - this._dur <= 0 && (prevIteration = iteration); // edge case - if someone does addPause() at the very beginning of a repeating timeline, that pause is technically at the same spot as the end which causes this._time to get set to 0 when the totalTime would normally place the playhead at the end. See https://gsap.com/forums/topic/23823-closing-nav-animation-not-working-on-ie-and-iphone-6-maybe-other-older-browser/?tab=comments#comment-113005 also, this._tTime - prevIteration * cycleDuration - this._dur <= 0 just checks to make sure it wasn't previously in the "repeatDelay" portion 3350 3351 if (yoyo && iteration & 1) { 3352 time = dur - time; 3353 isYoyo = 1; 3354 } 3355 /* 3356 make sure children at the end/beginning of the timeline are rendered properly. If, for example, 3357 a 3-second long timeline rendered at 2.9 seconds previously, and now renders at 3.2 seconds (which
3358 would get translated to 2.8 seconds if the timeline yoyos or 0.2 seconds if it just repeats), there 3359 could be a callback or a short tween that's at 2.95 or 3 seconds in which wouldn't render. So 3360 we need to push the timeline to the end (and/or beginning depending on its yoyo value). Also we must 3361 ensure that zero-duration tweens at the very beginning or end of the Timeline work. 3362 */ 3363 3364 3365 if (iteration !== prevIteration && !this._lock) { 3366 var rewinding = yoyo && prevIteration & 1, 3367 doesWrap = rewinding === (yoyo && iteration & 1); 3368 iteration < prevIteration && (rewinding = !rewinding); 3369 prevTime = rewinding ? 0 : tTime % dur ? dur : tTime; // if the playhead is landing exactly at the end of an iteration, use that totalTime rather than only the duration, otherwise it'll skip the 2nd render since it's effectively at the same time. 3370 3371 this._lock = 1; 3372 this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0; 3373 this._tTime = tTime; // if a user gets the iteration() inside the onRepeat, for example, it should be accurate. 3374 3375 !suppressEvents && this.parent && _callback(this, "onRepeat"); 3376 this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1); 3377 3378 if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) { 3379 // if prevTime is 0 and we render at the very end, _time will be the end, thus won't match. So in this edge case, prevTime won't match _time but that's okay. If it gets killed in the onRepeat, eject as well. 3380 return this; 3381 } 3382 3383 dur = this._dur; // in case the duration changed in the onRepeat 3384 3385 tDur = this._tDur; 3386 3387 if (doesWrap) { 3388 this._lock = 2; 3389 prevTime = rewinding ? dur : -0.0001; 3390 this.render(prevTime, true); 3391 this.vars.repeatRefresh && !isYoyo && this.invalidate(); 3392 } 3393 3394 this._lock = 0; 3395 3396 if (!this._ts && !prevPaused) { 3397 return this; 3398 } //in order for yoyoEase to work properly when there's a stagger, we must swap out the ease in each sub-tween. 3399 3400 3401 _propagateYoyoEase(this, isYoyo); 3402 } 3403 } 3404 3405 if (this._hasPause && !this._forcing && this._lock < 2) { 3406 pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time)); 3407 3408 if (pauseTween) { 3409 tTime -= time - (time = pauseTween._start); 3410 } 3411 } 3412 3413 this._tTime = tTime; 3414 this._time = time; 3415 this._act = !timeScale; //as long as it's not paused, force it to be active so that if the user renders independent of the parent timeline, it'll be forced to re-render on the next tick. 3416 3417 if (!this._initted) { 3418 this._onUpdate = this.vars.onUpdate; 3419 this._initted = 1; 3420 this._zTime = totalTime; 3421 prevTime = 0; // upon init, the playhead should always go forward;
3421 someone could invalidate() a completed timeline and then if they restart(), that would make child tweens render in reverse order which could lock in the wrong starting values if they build on each other, like tl.to(obj, {x: 100}).to(obj, {x: 0}). 3422 } 3423 3424 if (!prevTime && time && !suppressEvents && !iteration) { 3425 _callback(this, "onStart"); 3426 3427 if (this._tTime !== tTime) { 3428 // in case the onStart triggered a render at a different spot, eject. Like if someone did animation.pause(0.5) or something inside the onStart. 3429 return this; 3430 } 3431 } 3432 3433 if (time >= prevTime && totalTime >= 0) { 3434 child = this._first; 3435 3436 while (child) { 3437 next = child._next; 3438 3439 if ((child._act || time >= child._start) && child._ts && pauseTween !== child) { 3440 if (child.parent !== this) { 3441 // an extreme edge case - the child's render could do something like kill() the "next" one in the linked list, or reparent it. In that case we must re-initiate the whole render to be safe. 3442 return this.render(totalTime, suppressEvents, force); 3443 } 3444 3445 child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force); 3446 3447 if (time !== this._time || !this._ts && !prevPaused) { 3448 //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete 3449 pauseTween = 0; 3450 next && (tTime += this._zTime = -_tinyNum); // it didn't finish rendering, so flag zTime as negative so that so that the next time render() is called it'll be forced (to render any remaining children) 3451 3452 break; 3453 } 3454 } 3455 3456 child = next; 3457 } 3458 } else { 3459 child = this._last; 3460 var adjustedTime = totalTime < 0 ? totalTime : time; //when the playhead goes backward beyond the start of this timeline, we must pass that information down to the child animations so that zero-duration tweens know whether to render their starting or ending values. 3461 3462 while (child) { 3463 next = child._prev; 3464 3465 if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) { 3466 if (child.parent !== this) { 3467 // an extreme edge case - the child's render could do something like kill() the "next" one in the linked list, or reparent it. In that case we must re-initiate the whole render to be safe. 3468 return this.render(totalTime, suppressEvents, force); 3469 } 3470 3471 child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force || _reverting && (child._initted || child._startAt)); // if reverting, we should always force renders of initted tweens (but remember that .fromTo() or .from() may have a _startAt but not _initted yet). If, for example, a .fromTo() tween with a stagger (which creates an internal timeline) gets reverted BEFORE some of its child tweens render for the first time, it may not properly trigger them to revert. 3472 3473 if (time !== this._time || !this._ts && !prevPaused) { 3474 //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete 3475 pauseTween = 0; 3476 next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum); // it didn't finish rendering, so adjust zTime so that so that the next time render() is called it'll be forced (to render any remaining children) 3477 3478 break; 3479 } 3480 } 3481 3482 child = next; 3483 } 3484 } 3485 3486 if (pauseTween && !suppressEvents) { 3487 this.pause(); 3488 pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1; 3489 3490 if (this._ts) { 3491 //the callback resumed playback! So since we may have held back the playhead due to where the pause is positioned, go ahead and jump to where it's SUPPOSED to be (if no pause happened). 3492 this._start = prevStart; //if the pause was at an earlier time and the user resumed in the callback, it could reposition the timeline (changing its startTime), throwing things off slightly, so we make sure the _start doesn't shift. 3493 3494 _setEnd(this); 3495 3496 return this.render(totalTime, suppressEvents, force); 3497 } 3498 } 3499
vendor: 5,377 bytes, lines 3500-3677
3500 this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true); 3501 if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) if (!this._lock) { 3502 // remember, a child's callback may alter this timeline's playhead or timeScale which is why we need to add some of these checks. 3503 (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); // don't remove if the timeline is reversed and the playhead isn't at 0, otherwise tl.progress(1).reverse() won't work. Only remove if the playhead is at the end and timeScale is positive, or if the playhead is at 0 and the timeScale is negative. 3504 3505 if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) { 3506 _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true); 3507 3508 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 3509 } 3510 } 3511 } 3512 3513 return this; 3514 }; 3515 3516 _proto2.add = function add(child, position) { 3517 var _this2 = this; 3518 3519 _isNumber(position) || (position = _parsePosition(this, position, child)); 3520 3521 if (!(child instanceof Animation)) { 3522 if (_isArray(child)) { 3523 child.forEach(function (obj) { 3524 return _this2.add(obj, position); 3525 }); 3526 return this; 3527 } 3528 3529 if (_isString(child)) { 3530 return this.addLabel(child, position); 3531 } 3532 3533 if (_isFunction(child)) { 3534 child = Tween.delayedCall(0, child); 3535 } else { 3536 return this; 3537 } 3538 } 3539 3540 return this !== child ? _addToTimeline(this, child, position) : this; //don't allow a timeline to be added to itself as a child! 3541 }; 3542 3543 _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) { 3544 if (nested === void 0) { 3545 nested = true; 3546 } 3547 3548 if (tweens === void 0) { 3549 tweens = true; 3550 } 3551 3552 if (timelines === void 0) { 3553 timelines = true; 3554 } 3555 3556 if (ignoreBeforeTime === void 0) { 3557 ignoreBeforeTime = -_bigNum; 3558 } 3559 3560 var a = [], 3561 child = this._first; 3562 3563 while (child) { 3564 if (child._start >= ignoreBeforeTime) { 3565 if (child instanceof Tween) { 3566 tweens && a.push(child); 3567 } else { 3568 timelines && a.push(child); 3569 nested && a.push.apply(a, child.getChildren(true, tweens, timelines)); 3570 } 3571 } 3572 3573 child = child._next; 3574 } 3575 3576 return a; 3577 }; 3578 3579 _proto2.getById = function getById(id) { 3580 var animations = this.getChildren(1, 1, 1), 3581 i = animations.length; 3582 3583 while (i--) { 3584 if (animations[i].vars.id === id) { 3585 return animations[i]; 3586 } 3587 } 3588 }; 3589 3590 _proto2.remove = function remove(child) { 3591 if (_isString(child)) { 3592 return this.removeLabel(child); 3593 } 3594 3595 if (_isFunction(child)) { 3596 return this.killTweensOf(child); 3597 } 3598 3599 _removeLinkedListItem(this, child); 3600 3601 if (child === this._recent) { 3602 this._recent = this._last; 3603 } 3604 3605 return _uncache(this); 3606 }; 3607 3608 _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) { 3609 if (!arguments.length) { 3610 return this._tTime; 3611 } 3612 3613 this._forcing = 1; 3614 3615 if (!this._dp && this._ts) { 3616 //special case for the global timeline (or any other that has no parent or detached parent). 3617 this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts)); 3618 } 3619 3620 _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents); 3621 3622 this._forcing = 0; 3623 return this; 3624 }; 3625 3626 _proto2.addLabel = function addLabel(label, position) { 3627 this.labels[label] = _parsePosition(this, position); 3628 return this; 3629 }; 3630 3631 _proto2.removeLabel = function removeLabel(label) { 3632 delete this.labels[label]; 3633 return this; 3634 }; 3635 3636 _proto2.addPause = function addPause(position, callback, params) { 3637 var t = Tween.delayedCall(0, callback || _emptyFunc, params); 3638 t.data = "isPause"; 3639 this._hasPause = 1; 3640 return _addToTimeline(this, t, _parsePosition(this, position)); 3641 }; 3642 3643 _proto2.removePause = function removePause(position) { 3644 var child = this._first; 3645 position = _parsePosition(this, position); 3646 3647 while (child) { 3648 if (child._start === position && child.data === "isPause") { 3649 _removeFromParent(child); 3650 } 3651 3652 child = child._next; 3653 } 3654 }; 3655 3656 _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) { 3657 var tweens = this.getTweensOf(targets, onlyActive), 3658 i = tweens.length; 3659 3660 while (i--) { 3661 _overwritingTween !== tweens[i] && tweens[i].kill(targets, props); 3662 } 3663 3664 return this; 3665 }; 3666 3667 _proto2.getTweensOf = function getTweensOf(targets, onlyActive) { 3668 var a = [], 3669 parsedTargets = toArray(targets), 3670 child = this._first, 3671 isGlobalTime = _isNumber(onlyActive), 3672 // a number is interpreted as a global time. If the animation spans 3673 children; 3674 3675 while (child) { 3676 if (child instanceof Tween) { 3677 if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) {
vendor: 3,291 bytes, lines 3678-3791
3678 // note: if this is for overwriting, it should only be for tweens that aren't paused and are initted. 3679 a.push(child); 3680 } 3681 } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) { 3682 a.push.apply(a, children); 3683 } 3684 3685 child = child._next; 3686 } 3687 3688 return a; 3689 } // potential future feature - targets() on timelines 3690 // targets() { 3691 // let result = []; 3692 // this.getChildren(true, true, false).forEach(t => result.push(...t.targets())); 3693 // return result.filter((v, i) => result.indexOf(v) === i); 3694 // } 3695 ; 3696 3697 _proto2.tweenTo = function tweenTo(position, vars) { 3698 vars = vars || {}; 3699 3700 var tl = this, 3701 endTime = _parsePosition(tl, position), 3702 _vars = vars, 3703 startAt = _vars.startAt, 3704 _onStart = _vars.onStart, 3705 onStartParams = _vars.onStartParams, 3706 immediateRender = _vars.immediateRender, 3707 initted, 3708 tween = Tween.to(tl, _setDefaults({ 3709 ease: vars.ease || "none", 3710 lazy: false, 3711 immediateRender: false, 3712 time: endTime, 3713 overwrite: "auto", 3714 duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum, 3715 onStart: function onStart() { 3716 tl.pause(); 3717 3718 if (!initted) { 3719 var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()); 3720 tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true); 3721 initted = 1; 3722 } 3723 3724 _onStart && _onStart.apply(tween, onStartParams || []); //in case the user had an onStart in the vars - we don't want to overwrite it. 3725 } 3726 }, vars)); 3727 3728 return immediateRender ? tween.render(0) : tween; 3729 }; 3730 3731 _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) { 3732 return this.tweenTo(toPosition, _setDefaults({ 3733 startAt: { 3734 time: _parsePosition(this, fromPosition) 3735 } 3736 }, vars)); 3737 }; 3738 3739 _proto2.recent = function recent() { 3740 return this._recent; 3741 }; 3742 3743 _proto2.nextLabel = function nextLabel(afterTime) { 3744 if (afterTime === void 0) { 3745 afterTime = this._time; 3746 } 3747 3748 return _getLabelInDirection(this, _parsePosition(this, afterTime)); 3749 }; 3750 3751 _proto2.previousLabel = function previousLabel(beforeTime) { 3752 if (beforeTime === void 0) { 3753 beforeTime = this._time; 3754 } 3755 3756 return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1); 3757 }; 3758 3759 _proto2.currentLabel = function currentLabel(value) { 3760 return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum); 3761 }; 3762 3763 _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) { 3764 if (ignoreBeforeTime === void 0) { 3765 ignoreBeforeTime = 0; 3766 } 3767 3768 var child = this._first, 3769 labels = this.labels, 3770 p; 3771 3772 while (child) { 3773 if (child._start >= ignoreBeforeTime) { 3774 child._start += amount; 3775 child._end += amount; 3776 } 3777 3778 child = child._next; 3779 } 3780 3781 if (adjustLabels) { 3782 for (p in labels) { 3783 if (labels[p] >= ignoreBeforeTime) { 3784 labels[p] += amount; 3785 } 3786 } 3787 } 3788 3789 return _uncache(this); 3790 }; 3791
vendor: 2,164 bytes, lines 3792-3860
3792 _proto2.invalidate = function invalidate(soft) { 3793 var child = this._first; 3794 this._lock = 0; 3795 3796 while (child) { 3797 child.invalidate(soft); 3798 child = child._next; 3799 } 3800 3801 return _Animation.prototype.invalidate.call(this, soft); 3802 }; 3803 3804 _proto2.clear = function clear(includeLabels) { 3805 if (includeLabels === void 0) { 3806 includeLabels = true; 3807 } 3808 3809 var child = this._first, 3810 next; 3811 3812 while (child) { 3813 next = child._next; 3814 this.remove(child); 3815 child = next; 3816 } 3817 3818 this._dp && (this._time = this._tTime = this._pTime = 0); 3819 includeLabels && (this.labels = {}); 3820 return _uncache(this); 3821 }; 3822 3823 _proto2.totalDuration = function totalDuration(value) { 3824 var max = 0, 3825 self = this, 3826 child = self._last, 3827 prevStart = _bigNum, 3828 prev, 3829 start, 3830 parent; 3831 3832 if (arguments.length) { 3833 return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value)); 3834 } 3835 3836 if (self._dirty) { 3837 parent = self.parent; 3838 3839 while (child) { 3840 prev = child._prev; //record it here in case the tween changes position in the sequence... 3841 3842 child._dirty && child.totalDuration(); //could change the tween._startTime, so make sure the animation's cache is clean before analyzing it. 3843 3844 start = child._start; 3845 3846 if (start > prevStart && self._sort && child._ts && !self._lock) { 3847 //in case one of the tweens shifted out of order, it needs to be re-inserted into the correct position in the sequence 3848 self._lock = 1; //prevent endless recursive calls - there are methods that get triggered that check duration/totalDuration when we add(). 3849 3850 _addToTimeline(self, child, start - child._delay, 1)._lock = 0; 3851 } else { 3852 prevStart = start; 3853 } 3854 3855 if (start < 0 && child._ts) { 3856 //children aren't allowed to have negative startTimes unless smoothChildTiming is true, so adjust here if one is found. 3857 max -= start; 3858 3859 if (!parent && !self._dp || parent && parent.smoothChildTiming) { 3860 self._start += start / self._ts
vendor: 8,055 bytes, lines 3860-4072
3860; 3861 self._time -= start; 3862 self._tTime -= start; 3863 } 3864 3865 self.shiftChildren(-start, false, -1e999); 3866 prevStart = 0; 3867 } 3868 3869 child._end > max && child._ts && (max = child._end); 3870 child = prev; 3871 } 3872 3873 _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1); 3874 3875 self._dirty = 0; 3876 } 3877 3878 return self._tDur; 3879 }; 3880 3881 Timeline.updateRoot = function updateRoot(time) { 3882 if (_globalTimeline._ts) { 3883 _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline)); 3884 3885 _lastRenderedFrame = _ticker.frame; 3886 } 3887 3888 if (_ticker.frame >= _nextGCFrame) { 3889 _nextGCFrame += _config.autoSleep || 120; 3890 var child = _globalTimeline._first; 3891 if (!child || !child._ts) if (_config.autoSleep && _ticker._listeners.length < 2) { 3892 while (child && !child._ts) { 3893 child = child._next; 3894 } 3895 3896 child || _ticker.sleep(); 3897 } 3898 } 3899 }; 3900 3901 return Timeline; 3902}(Animation); 3903 3904_setDefaults(Timeline.prototype, { 3905 _lock: 0, 3906 _hasPause: 0, 3907 _forcing: 0 3908}); 3909 3910var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) { 3911 //note: we call _addComplexStringPropTween.call(tweenInstance...) to ensure that it's scoped properly. We may call it from within a plugin too, thus "this" would refer to the plugin. 3912 var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter), 3913 index = 0, 3914 matchIndex = 0, 3915 result, 3916 startNums, 3917 color, 3918 endNum, 3919 chunk, 3920 startNum, 3921 hasRandom, 3922 a; 3923 pt.b = start; 3924 pt.e = end; 3925 start += ""; //ensure values are strings 3926 3927 end += ""; 3928 3929 if (hasRandom = ~end.indexOf("random(")) { 3930 end = _replaceRandom(end); 3931 } 3932 3933 if (stringFilter) { 3934 a = [start, end]; 3935 stringFilter(a, target, prop); //pass an array with the starting and ending values and let the filter do whatever it needs to the values. 3936 3937 start = a[0]; 3938 end = a[1]; 3939 } 3940 3941 startNums = start.match(_complexStringNumExp) || []; 3942 3943 while (result = _complexStringNumExp.exec(end)) { 3944 endNum = result[0]; 3945 chunk = end.substring(index, result.index); 3946 3947 if (color) { 3948 color = (color + 1) % 5; 3949 } else if (chunk.substr(-5) === "rgba(") { 3950 color = 1; 3951 } 3952 3953 if (endNum !== startNums[matchIndex++]) { 3954 startNum = parseFloat(startNums[matchIndex - 1]) || 0; //these nested PropTweens are handled in a special way - we'll never actually call a render or setter method on them. We'll just loop through them in the parent complex string PropTween's render method. 3955 3956 pt._pt = { 3957 _next: pt._pt, 3958 p: chunk || matchIndex === 1 ? chunk : ",", 3959 //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case. 3960 s: startNum, 3961 c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum, 3962 m: color && color < 4 ? Math.round : 0 3963 }; 3964 index = _complexStringNumExp.lastIndex; 3965 } 3966 } 3967 3968 pt.c = index < end.length ? end.substring(index, end.length) : ""; //we use the "c" of the PropTween to store the final part of the string (after the last number) 3969 3970 pt.fp = funcParam; 3971 3972 if (_relExp.test(end) || hasRandom) { 3973 pt.e = 0; //if the end string contains relative values or dynamic random(...) values, delete the end it so that on the final render we don't actually set it to the string with += or -= characters (forces it to use the calculated value). 3974 } 3975 3976 this._pt = pt; //start the linked list with this new PropTween. Remember, we call _addComplexStringPropTween.call(tweenInstance...) to ensure that it's scoped properly. We may call it from within a plugin too, thus "this" would refer to the plugin. 3977 3978 return pt; 3979}, 3980 _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam, optional) { 3981 _isFunction(end) && (end = end(index || 0, target, targets)); 3982 var currentValue = target[prop], 3983 parsedStart = start !== "get" ? start : !_isFunction(currentValue) ? currentValue : funcParam ? target[prop.indexOf("set") || !_isFunction(target["get" + prop.substr(3)]) ? prop : "get" + prop.substr(3)](funcParam) : target[prop](), 3984 setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc, 3985 pt; 3986 3987 if (_isString(end)) { 3988 if (~end.indexOf("random(")) { 3989 end = _replaceRandom(end); 3990 } 3991 3992 if (end.charAt(1) === "=") { 3993 pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0); 3994 3995 if (pt || pt === 0) { 3996 // to avoid isNaN, like if someone passes in a value like "!= whatever" 3997 end = pt; 3998 } 3999 } 4000 } 4001 4002 if (!optional || parsedStart !== end || _forceAllPropTweens) { 4003 if (!isNaN(parsedStart * end) && end !== "") { 4004 // fun fact: any number multiplied by "" is evaluated as the number 0! 4005 pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter); 4006 funcParam && (pt.fp = funcParam); 4007 modifier && pt.modifier(modifier, this, target); 4008 return this._pt = pt; 4009 } 4010 4011 !currentValue && !(prop in target) && _missingPlugin(prop, end); 4012 return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam); 4013 } 4014}, 4015 //creates a copy of the vars object and processes any function-based values (putting the resulting values directly into the copy) as well as strings with "random()" in them. It does NOT process relative values. 4016_processVars = function _processVars(vars, index, target, targets, tween) { 4017 _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets)); 4018 4019 if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) { 4020 return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars; 4021 } 4022 4023 var copy = {}, 4024 p; 4025 4026 for (p in vars) { 4027 copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets); 4028 } 4029 4030 return copy; 4031}, 4032 _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) { 4033 var plugin, pt, ptLookup, i; 4034 4035 if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) { 4036 tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority); 4037 4038 if (tween !== _quickTween) { 4039 ptLookup = tween._ptLookup[tween._targets.indexOf(target)]; //note: we can't use tween._ptLookup[index] because for staggered tweens, the index from the fullTargets array won't match what it is in each individual tween that spawns from the stagger. 4040 4041 i = plugin._props.length; 4042 4043 while (i--) { 4044 ptLookup[plugin._props[i]] = pt; 4045 } 4046 } 4047 } 4048 4049 return plugin; 4050}, 4051 _overwritingTween, 4052 //store a reference temporarily so we can avoid overwriting itself. 4053_forceAllPropTweens, 4054 _initTween = function _initTween(tween, time, tTime) { 4055 var vars = tween.vars, 4056 ease = vars.ease, 4057 startAt = vars.startAt, 4058 immediateRender = vars.immediateRender, 4059 lazy = vars.lazy, 4060 onUpdate = vars.onUpdate, 4061 runBackwards = vars.runBackwards, 4062 yoyoEase = vars.yoyoEase, 4063 keyframes = vars.keyframes, 4064 autoRevert = vars.autoRevert, 4065 dur = tween._dur, 4066 prevStartAt = tween._startAt, 4067 targets = tween._targets, 4068 parent = tween.parent, 4069 fullTargets = parent && parent.data === "nested" ? parent.vars.targets : targets, 4070 autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites, 4071 tl = tween.timeline, 4072
vendor: 3,914 bytes, lines 4072-4144
4072cleanVars, 4073 i, 4074 p, 4075 pt, 4076 target, 4077 hasPriority, 4078 gsData, 4079 harness, 4080 plugin, 4081 ptLookup, 4082 index, 4083 harnessVars, 4084 overwritten; 4085 tl && (!keyframes || !ease) && (ease = "none"); 4086 tween._ease = _parseEase(ease, _defaults.ease); 4087 tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0; 4088 4089 if (yoyoEase && tween._yoyo && !tween._repeat) { 4090 //there must have been a parent timeline with yoyo:true that is currently in its yoyo phase, so flip the eases. 4091 yoyoEase = tween._yEase; 4092 tween._yEase = tween._ease; 4093 tween._ease = yoyoEase; 4094 } 4095 4096 tween._from = !tl && !!vars.runBackwards; //nested timelines should never run backwards - the backwards-ness is in the child tweens. 4097 4098 if (!tl || keyframes && !vars.stagger) { 4099 //if there's an internal timeline, skip all the parsing because we passed that task down the chain. 4100 harness = targets[0] ? _getCache(targets[0]).harness : 0; 4101 harnessVars = harness && vars[harness.prop]; //someone may need to specify CSS-specific values AND non-CSS values, like if the element has an "x" property plus it's a standard DOM element. We allow people to distinguish by wrapping plugin-specific stuff in a css:{} object for example. 4102 4103 cleanVars = _copyExcluding(vars, _reservedProps); 4104 4105 if (prevStartAt) { 4106 prevStartAt._zTime < 0 && prevStartAt.progress(1); // in case it's a lazy startAt that hasn't rendered yet. 4107 4108 time < 0 && runBackwards && immediateRender && !autoRevert ? prevStartAt.render(-1, true) : prevStartAt.revert(runBackwards && dur ? _revertConfigNoKill : _startAtRevertConfig); // if it's a "startAt" (not "from()" or runBackwards: true), we only need to do a shallow revert (keep transforms cached in CSSPlugin) 4109 // don't just _removeFromParent(prevStartAt.render(-1, true)) because that'll leave inline styles. We're creating a new _startAt for "startAt" tweens that re-capture things to ensure that if the pre-tween values changed since the tween was created, they're recorded. 4110 4111 prevStartAt._lazy = 0; 4112 } 4113 4114 if (startAt) { 4115 _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({ 4116 data: "isStart", 4117 overwrite: false, 4118 parent: parent, 4119 immediateRender: true, 4120 lazy: !prevStartAt && _isNotFalse(lazy), 4121 startAt: null, 4122 delay: 0, 4123 onUpdate: onUpdate && function () { 4124 return _callback(tween, "onUpdate"); 4125 }, 4126 stagger: 0 4127 }, startAt))); //copy the properties/values into a new object to avoid collisions, like var to = {x:0}, from = {x:500}; timeline.fromTo(e, from, to).fromTo(e, to, from); 4128 4129 4130 tween._startAt._dp = 0; // don't allow it to get put back into root timeline! Like when revert() is called and totalTime() gets set. 4131 4132 tween._startAt._sat = tween; // used in globalTime(). _sat stands for _startAtTween 4133 4134 time < 0 && (_reverting || !immediateRender && !autoRevert) && tween._startAt.revert(_revertConfigNoKill); // rare edge case, like if a render is forced in the negative direction of a non-initted tween. 4135 4136 if (immediateRender) { 4137 if (dur && time <= 0 && tTime <= 0) { 4138 // check tTime here because in the case of a yoyo tween whose playhead gets pushed to the end like tween.progress(1), we should allow it through so that the onComplete gets fired properly. 4139 time && (tween._zTime = time); 4140 return; //we skip initialization here so that overwriting doesn't occur until the tween actually begins. Otherwise, if you create several immediateRender:true tweens of the same target/properties to drop into a Timeline, the last one created would overwrite the first ones because they didn't get placed into the timeline yet before the first render occurs and kicks in overwriting. 4141 } 4142 } 4143 } else if (runBackwards && dur) { 4144 //
vendor: 7,258 bytes, lines 4144-4269
4144from() tweens must be handled uniquely: their beginning values must be rendered but we don't want overwriting to occur yet (when time is still 0). Wait until the tween actually begins before doing all the routines like overwriting. At that time, we should render at the END of the tween to ensure that things initialize correctly (remember, from() tweens go backwards) 4145 if (!prevStartAt) { 4146 time && (immediateRender = false); //in rare cases (like if a from() tween runs and then is invalidate()-ed), immediateRender could be true but the initial forced-render gets skipped, so there's no need to force the render in this context when the _time is greater than 0 4147 4148 p = _setDefaults({ 4149 overwrite: false, 4150 data: "isFromStart", 4151 //we tag the tween with as "isFromStart" so that if [inside a plugin] we need to only do something at the very END of a tween, we have a way of identifying this tween as merely the one that's setting the beginning values for a "from()" tween. For example, clearProps in CSSPlugin should only get applied at the very END of a tween and without this tag, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in. 4152 lazy: immediateRender && !prevStartAt && _isNotFalse(lazy), 4153 immediateRender: immediateRender, 4154 //zero-duration tweens render immediately by default, but if we're not specifically instructed to render this tween immediately, we should skip this and merely _init() to record the starting values (rendering them immediately would push them to completion which is wasteful in that case - we'd have to render(-1) immediately after) 4155 stagger: 0, 4156 parent: parent //ensures that nested tweens that had a stagger are handled properly, like gsap.from(".class", {y: gsap.utils.wrap([-100,100]), stagger: 0.5}) 4157 4158 }, cleanVars); 4159 harnessVars && (p[harness.prop] = harnessVars); // in case someone does something like .from(..., {css:{}}) 4160 4161 _removeFromParent(tween._startAt = Tween.set(targets, p)); 4162 4163 tween._startAt._dp = 0; // don't allow it to get put back into root timeline! 4164 4165 tween._startAt._sat = tween; // used in globalTime() 4166 4167 time < 0 && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween._startAt.render(-1, true)); 4168 tween._zTime = time; 4169 4170 if (!immediateRender) { 4171 _initTween(tween._startAt, _tinyNum, _tinyNum); //ensures that the initial values are recorded 4172 4173 } else if (!time) { 4174 return; 4175 } 4176 } 4177 } 4178 4179 tween._pt = tween._ptCache = 0; 4180 lazy = dur && _isNotFalse(lazy) || lazy && !dur; 4181 4182 for (i = 0; i < targets.length; i++) { 4183 target = targets[i]; 4184 gsData = target._gsap || _harness(targets)[i]._gsap; 4185 tween._ptLookup[i] = ptLookup = {}; 4186 _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender(); //if other tweens of the same target have recently initted but haven't rendered yet, we've got to force the render so that the starting values are correct (imagine populating a timeline with a bunch of sequential tweens and then jumping to the end) 4187 4188 index = fullTargets === targets ? i : fullTargets.indexOf(target); 4189 4190 if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) { 4191 tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority); 4192 4193 plugin._props.forEach(function (name) { 4194 ptLookup[name] = pt; 4195 }); 4196 4197 plugin.priority && (hasPriority = 1); 4198 } 4199 4200 if (!harness || harnessVars) { 4201 for (p in cleanVars) { 4202 if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) { 4203 plugin.priority && (hasPriority = 1); 4204 } else { 4205 ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter); 4206 } 4207 } 4208 } 4209 4210 tween._op && tween._op[i] && tween.kill(target, tween._op[i]); 4211 4212 if (autoOverwrite && tween._pt) { 4213 _overwritingTween = tween; 4214 4215 _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time)); // make sure the overwriting doesn't overwrite THIS tween!!! 4216 4217 4218 overwritten = !tween.parent; 4219 _overwritingTween = 0; 4220 } 4221 4222 tween._pt && lazy && (_lazyLookup[gsData.id] = 1); 4223 } 4224 4225 hasPriority && _sortPropTweensByPriority(tween); 4226 tween._onInit && tween._onInit(tween); //plugins like RoundProps must wait until ALL of the PropTweens are instantiated. In the plugin's init() function, it sets the _onInit on the tween instance. May not be pretty/intuitive, but it's fast and keeps file size down. 4227 } 4228 4229 tween._onUpdate = onUpdate; 4230 tween._initted = (!tween._op || tween._pt) && !overwritten; // if overwrittenProps resulted in the entire tween being killed, do NOT flag it as initted or else it may render for one tick. 4231 4232 keyframes && time <= 0 && tl.render(_bigNum, true, true); // if there's a 0% keyframe, it'll render in the "before" state for any staggered/delayed animations thus when the following tween initializes, it'll use the "before" state instead of the "after" state as the initial values. 4233}, 4234 _updatePropTweens = function _updatePropTweens(tween, property, value, start, startIsRelative, ratio, time, skipRecursion) { 4235 var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property], 4236 pt, 4237 rootPT, 4238 lookup, 4239 i; 4240 4241 if (!ptCache) { 4242 ptCache = tween._ptCache[property] = []; 4243 lookup = tween._ptLookup; 4244 i = tween._targets.length; 4245 4246 while (i--) { 4247 pt = lookup[i][property]; 4248 4249 if (pt && pt.d && pt.d._pt) { 4250 // it's a plugin, so find the nested PropTween 4251 pt = pt.d._pt; 4252 4253 while (pt && pt.p !== property && pt.fp !== property) { 4254 // "fp" is functionParam for things like setting CSS variables which require .setProperty("--var-name", value) 4255 pt = pt._next; 4256 } 4257 } 4258 4259 if (!pt) { 4260 // there is no PropTween associated with that property, so we must FORCE one to be created and ditch out of this 4261 // if the tween has other properties that already rendered at new positions, we'd normally have to rewind to put them back like tween.render(0, true) before forcing an _initTween(), but that can create another edge case like tweening a timeline's progress would trigger onUpdates to fire which could move other things around. It's better to just inform users that .resetTo() should ONLY be used for tweens that already have that property. For example, you can't gsap.to(...{ y: 0 }) and then tween.restTo("x", 200) for example. 4262 _forceAllPropTweens = 1; // otherwise, when we _addPropTween() and it finds no change between the start and end values, it skips creating a PropTween (for efficiency...why tween when there's no difference?) but in this case we NEED that PropTween created so we can edit it. 4263 4264 tween.vars[property] = "+=0"; 4265 4266 _initTween(tween, time); 4267 4268 _forceAllPropTweens = 0; 4269 return skipRecursion ? _warn(property + " not eligible for reset
vendor: 6,526 bytes, lines 4269-4434
4269") : 1; // if someone tries to do a quickTo() on a special property like borderRadius which must get split into 4 different properties, that's not eligible for .resetTo(). 4270 } 4271 4272 ptCache.push(pt); 4273 } 4274 } 4275 4276 i = ptCache.length; 4277 4278 while (i--) { 4279 rootPT = ptCache[i]; 4280 pt = rootPT._pt || rootPT; // complex values may have nested PropTweens. We only accommodate the FIRST value. 4281 4282 pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c; 4283 pt.c = value - pt.s; 4284 rootPT.e && (rootPT.e = _round(value) + getUnit(rootPT.e)); // mainly for CSSPlugin (end value) 4285 4286 rootPT.b && (rootPT.b = pt.s + getUnit(rootPT.b)); // (beginning value) 4287 } 4288}, 4289 _addAliasesToVars = function _addAliasesToVars(targets, vars) { 4290 var harness = targets[0] ? _getCache(targets[0]).harness : 0, 4291 propertyAliases = harness && harness.aliases, 4292 copy, 4293 p, 4294 i, 4295 aliases; 4296 4297 if (!propertyAliases) { 4298 return vars; 4299 } 4300 4301 copy = _merge({}, vars); 4302 4303 for (p in propertyAliases) { 4304 if (p in copy) { 4305 aliases = propertyAliases[p].split(","); 4306 i = aliases.length; 4307 4308 while (i--) { 4309 copy[aliases[i]] = copy[p]; 4310 } 4311 } 4312 } 4313 4314 return copy; 4315}, 4316 // parses multiple formats, like {"0%": {x: 100}, {"50%": {x: -20}} and { x: {"0%": 100, "50%": -20} }, and an "ease" can be set on any object. We populate an "allProps" object with an Array for each property, like {x: [{}, {}], y:[{}, {}]} with data for each property tween. The objects have a "t" (time), "v", (value), and "e" (ease) property. This allows us to piece together a timeline later. 4317_parseKeyframe = function _parseKeyframe(prop, obj, allProps, easeEach) { 4318 var ease = obj.ease || easeEach || "power1.inOut", 4319 p, 4320 a; 4321 4322 if (_isArray(obj)) { 4323 a = allProps[prop] || (allProps[prop] = []); // t = time (out of 100), v = value, e = ease 4324 4325 obj.forEach(function (value, i) { 4326 return a.push({ 4327 t: i / (obj.length - 1) * 100, 4328 v: value, 4329 e: ease 4330 }); 4331 }); 4332 } else { 4333 for (p in obj) { 4334 a = allProps[p] || (allProps[p] = []); 4335 p === "ease" || a.push({ 4336 t: parseFloat(prop), 4337 v: obj[p], 4338 e: ease 4339 }); 4340 } 4341 } 4342}, 4343 _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) { 4344 return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value; 4345}, 4346 _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert", 4347 _staggerPropsToSkip = {}; 4348 4349_forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function (name) { 4350 return _staggerPropsToSkip[name] = 1; 4351}); 4352/* 4353 * -------------------------------------------------------------------------------------- 4354 * TWEEN 4355 * -------------------------------------------------------------------------------------- 4356 */ 4357 4358 4359var Tween = /*#__PURE__*/function (_Animation2) { 4360 _inheritsLoose(Tween, _Animation2); 4361 4362 function Tween(targets, vars, position, skipInherit) { 4363 var _this3; 4364 4365 if (typeof vars === "number") { 4366 position.duration = vars; 4367 vars = position; 4368 position = null; 4369 } 4370 4371 _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this; 4372 var _this3$vars = _this3.vars, 4373 duration = _this3$vars.duration, 4374 delay = _this3$vars.delay, 4375 immediateRender = _this3$vars.immediateRender, 4376 stagger = _this3$vars.stagger, 4377 overwrite = _this3$vars.overwrite, 4378 keyframes = _this3$vars.keyframes, 4379 defaults = _this3$vars.defaults, 4380 scrollTrigger = _this3$vars.scrollTrigger, 4381 yoyoEase = _this3$vars.yoyoEase, 4382 parent = vars.parent || _globalTimeline, 4383 parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [targets] : toArray(targets), 4384 tl, 4385 i, 4386 copy, 4387 l, 4388 p, 4389 curTarget, 4390 staggerFunc, 4391 staggerVarsToMerge; 4392 _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://gsap.com", !_config.nullTargetWarn) || []; 4393 _this3._ptLookup = []; //PropTween lookup. An array containing an object for each target, having keys for each tweening property 4394 4395 _this3._overwrite = overwrite; 4396 4397 if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 4398 vars = _this3.vars; 4399 tl = _this3.timeline = new Timeline({ 4400 data: "nested", 4401 defaults: defaults || {}, 4402 targets: parent && parent.data === "nested" ? parent.vars.targets : parsedTargets 4403 }); // we need to store the targets because for staggers and keyframes, we end up creating an individual tween for each but function-based values need to know the index and the whole Array of targets. 4404 4405 tl.kill(); 4406 tl.parent = tl._dp = _assertThisInitialized(_this3); 4407 tl._start = 0; 4408 4409 if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 4410 l = parsedTargets.length; 4411 staggerFunc = stagger && distribute(stagger); 4412 4413 if (_isObject(stagger)) { 4414 //users can pass in callbacks like onStart/onComplete in the stagger object. These should fire with each individual tween. 4415 for (p in stagger) { 4416 if (~_staggerTweenProps.indexOf(p)) { 4417 staggerVarsToMerge || (staggerVarsToMerge = {}); 4418 staggerVarsToMerge[p] = stagger[p]; 4419 } 4420 } 4421 } 4422 4423 for (i = 0; i < l; i++) { 4424 copy = _copyExcluding(vars, _staggerPropsToSkip); 4425 copy.stagger = 0; 4426 yoyoEase && (copy.yoyoEase = yoyoEase); 4427 staggerVarsToMerge && _merge(copy, staggerVarsToMerge); 4428 curTarget = parsedTargets[i]; //don't just copy duration or delay because if they're a string or function, we'd end up in an infinite loop because _isFuncOrString() would evaluate as true in the child tweens, entering this loop, etc. So we parse the value straight from vars and default to 0. 4429 4430 copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets); 4431 copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay; 4432 4433 if (!stagger && l === 1 && copy.delay) { 4434 // if someone does delay:"random(1, 5)", repeat:-1, for example, the delay
vendor: 10,315 bytes, lines 4434-4676
4434shouldn't be inside the repeat. 4435 _this3._delay = delay = copy.delay; 4436 _this3._start += delay; 4437 copy.delay = 0; 4438 } 4439 4440 tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0); 4441 tl._ease = _easeMap.none; 4442 } 4443 4444 tl.duration() ? duration = delay = 0 : _this3.timeline = 0; // if the timeline's duration is 0, we don't need a timeline internally! 4445 } else if (keyframes) { 4446 _inheritDefaults(_setDefaults(tl.vars.defaults, { 4447 ease: "none" 4448 })); 4449 4450 tl._ease = _parseEase(keyframes.ease || vars.ease || "none"); 4451 var time = 0, 4452 a, 4453 kf, 4454 v; 4455 4456 if (_isArray(keyframes)) { 4457 keyframes.forEach(function (frame) { 4458 return tl.to(parsedTargets, frame, ">"); 4459 }); 4460 tl.duration(); // to ensure tl._dur is cached because we tap into it for performance purposes in the render() method. 4461 } else { 4462 copy = {}; 4463 4464 for (p in keyframes) { 4465 p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach); 4466 } 4467 4468 for (p in copy) { 4469 a = copy[p].sort(function (a, b) { 4470 return a.t - b.t; 4471 }); 4472 time = 0; 4473 4474 for (i = 0; i < a.length; i++) { 4475 kf = a[i]; 4476 v = { 4477 ease: kf.e, 4478 duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration 4479 }; 4480 v[p] = kf.v; 4481 tl.to(parsedTargets, v, time); 4482 time += v.duration; 4483 } 4484 } 4485 4486 tl.duration() < duration && tl.to({}, { 4487 duration: duration - tl.duration() 4488 }); // in case keyframes didn't go to 100% 4489 } 4490 } 4491 4492 duration || _this3.duration(duration = tl.duration()); 4493 } else { 4494 _this3.timeline = 0; //speed optimization, faster lookups (no going up the prototype chain) 4495 } 4496 4497 if (overwrite === true && !_suppressOverwrites) { 4498 _overwritingTween = _assertThisInitialized(_this3); 4499 4500 _globalTimeline.killTweensOf(parsedTargets); 4501 4502 _overwritingTween = 0; 4503 } 4504 4505 _addToTimeline(parent, _assertThisInitialized(_this3), position); 4506 4507 vars.reversed && _this3.reverse(); 4508 vars.paused && _this3.paused(true); 4509 4510 if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") { 4511 _this3._tTime = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render) 4512 4513 _this3.render(Math.max(0, -delay) || 0); //in case delay is negative 4514 4515 } 4516 4517 scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger); 4518 return _this3; 4519 } 4520 4521 var _proto3 = Tween.prototype; 4522 4523 _proto3.render = function render(totalTime, suppressEvents, force) { 4524 var prevTime = this._time, 4525 tDur = this._tDur, 4526 dur = this._dur, 4527 isNegative = totalTime < 0, 4528 tTime = totalTime > tDur - _tinyNum && !isNegative ? tDur : totalTime < _tinyNum ? 0 : totalTime, 4529 time, 4530 pt, 4531 iteration, 4532 cycleDuration, 4533 prevIteration, 4534 isYoyo, 4535 ratio, 4536 timeline, 4537 yoyoEase; 4538 4539 if (!dur) { 4540 _renderZeroDurationTween(this, totalTime, suppressEvents, force); 4541 } else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== isNegative) { 4542 //this senses if we're crossing over the start time, in which case we must record _zTime and force the render, but we do it in this lengthy conditional way for performance reasons (usually we can skip the calculations): this._initted && (this._zTime < 0) !== (totalTime < 0) 4543 time = tTime; 4544 timeline = this.timeline; 4545 4546 if (this._repeat) { 4547 //adjust the time for repeats and yoyos 4548 cycleDuration = dur + this._rDelay; 4549 4550 if (this._repeat < -1 && isNegative) { 4551 return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 4552 } 4553 4554 time = _roundPrecise(tTime % cycleDuration); //round to avoid floating point errors. (4 % 0.8 should be 0 but some browsers report it as 0.79999999!) 4555 4556 if (tTime === tDur) { 4557 // the tDur === tTime is for edge cases where there's a lengthy decimal on the duration and it may reach the very end but the time is rendered as not-quite-there (remember, tDur is rounded to 4 decimals whereas dur isn't) 4558 iteration = this._repeat; 4559 time = dur; 4560 } else { 4561 iteration = ~~(tTime / cycleDuration); 4562 4563 if (iteration && iteration === _roundPrecise(tTime / cycleDuration)) { 4564 time = dur; 4565 iteration--; 4566 } 4567 4568 time > dur && (time = dur); 4569 } 4570 4571 isYoyo = this._yoyo && iteration & 1; 4572 4573 if (isYoyo) { 4574 yoyoEase = this._yEase; 4575 time = dur - time; 4576 } 4577 4578 prevIteration = _animationCycle(this._tTime, cycleDuration); 4579 4580 if (time === prevTime && !force && this._initted && iteration === prevIteration) { 4581 //could be during the repeatDelay part. No need to render and fire callbacks. 4582 this._tTime = tTime; 4583 return this; 4584 } 4585 4586 if (iteration !== prevIteration) { 4587 timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo); //repeatRefresh functionality 4588 4589 if (this.vars.repeatRefresh && !isYoyo && !this._lock && this._time !== cycleDuration && this._initted) { 4590 // this._time will === cycleDuration when we render at EXACTLY the end of an iteration. Without this condition, it'd often do the repeatRefresh render TWICE (again on the very next tick). 4591 this._lock = force = 1; //force, otherwise if lazy is true, the _attemptInitTween() will return and we'll jump out and get caught bouncing on each tick. 4592 4593 this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0; 4594 } 4595 } 4596 } 4597 4598 if (!this._initted) { 4599 if (_attemptInitTween(this, isNegative ? totalTime : time, force, suppressEvents, tTime)) { 4600 this._tTime = 0; // in constructor if immediateRender is true, we set _tTime to -_tinyNum to have the playhead cross the starting point but we can't leave _tTime as a negative number. 4601 4602 return this; 4603 } 4604 4605 if (prevTime !== this._time && !(force && this.vars.repeatRefresh && iteration !== prevIteration)) { 4606 // rare edge case - during initialization, an onUpdate in the _startAt (.fromTo()) might force this tween to render at a different spot in which case we should ditch this render() call so that it doesn't revert the values. But we also don't want to dump if we're doing a repeatRefresh render! 4607 return this; 4608 } 4609 4610 if (dur !== this._dur) { 4611 // while initting, a plugin like InertiaPlugin might alter the duration, so rerun from the start to ensure everything renders as it should. 4612 return this.render(totalTime, suppressEvents, force); 4613 } 4614 } 4615 4616 this._tTime = tTime; 4617 this._time = time; 4618 4619 if (!this._act && this._ts) { 4620 this._act = 1; //as long as it's not paused, force it to be active so that if the user renders independent of the parent timeline, it'll be forced to re-render on the next tick. 4621 4622 this._lazy = 0; 4623 } 4624 4625 this.ratio = ratio = (yoyoEase || this._ease)(time / dur); 4626 4627 if (this._from) { 4628 this.ratio = ratio = 1 - ratio; 4629 } 4630 4631 if (time && !prevTime && !suppressEvents && !iteration) { 4632 _callback(this, "onStart"); 4633 4634 if (this._tTime !== tTime) { 4635 // in case the onStart triggered a render at a different spot, eject. Like if someone did animation.pause(0.5) or something inside the onStart. 4636 return this; 4637 } 4638 } 4639 4640 pt = this._pt; 4641 4642 while (pt) { 4643 pt.r(ratio, pt.d); 4644 pt = pt._next; 4645 } 4646 4647 timeline && timeline.render(totalTime < 0 ? totalTime : timeline._dur * timeline._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime); 4648 4649 if (this._onUpdate && !suppressEvents) { 4650 isNegative && _rewindStartAt(this, totalTime, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete. 4651 4652 _callback(this, "onUpdate"); 4653 } 4654 4655 this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat"); 4656 4657 if ((tTime === this._tDur || !tTime) && this._tTime === tTime) { 4658 isNegative && !this._onUpdate && _rewindStartAt(this, totalTime, true, true); 4659 (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); // don't remove if we're rendering at exactly a time of 0, as there could be autoRevert values that should get set on the next tick (if the playhead goes backward beyond the startTime, negative totalTime). Don't remove if the timeline is reversed and the playhead isn't at 0, otherwise tl.progress(1).reverse() won't work. Only remove if the playhead is at the end and timeScale is positive, or if the playhead is at 0 and the timeScale is negative. 4660 4661 if (!suppressEvents && !(isNegative && !prevTime) && (tTime || prevTime || isYoyo)) { 4662 // if prevTime and tTime are zero, we shouldn't fire the onReverseComplete. This could happen if you gsap.to(... {paused:true}).play(); 4663 _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true); 4664 4665 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 4666 } 4667 } 4668 } 4669 4670 return this; 4671 }; 4672 4673 _proto3.targets = function targets() { 4674 return this._targets; 4675 }; 4676
vendor: 2,804 bytes, lines 4677-4720
4677 _proto3.invalidate = function invalidate(soft) { 4678 // "soft" gives us a way to clear out everything EXCEPT the recorded pre-"from" portion of from() tweens. Otherwise, for example, if you tween.progress(1).render(0, true true).invalidate(), the "from" values would persist and then on the next render, the from() tweens would initialize and the current value would match the "from" values, thus animate from the same value to the same value (no animation). We tap into this in ScrollTrigger's refresh() where we must push a tween to completion and then back again but honor its init state in case the tween is dependent on another tween further up on the page. 4679 (!soft || !this.vars.runBackwards) && (this._startAt = 0); 4680 this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0; 4681 this._ptLookup = []; 4682 this.timeline && this.timeline.invalidate(soft); 4683 return _Animation2.prototype.invalidate.call(this, soft); 4684 }; 4685 4686 _proto3.resetTo = function resetTo(property, value, start, startIsRelative, skipRecursion) { 4687 _tickerActive || _ticker.wake(); 4688 this._ts || this.play(); 4689 var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts), 4690 ratio; 4691 this._initted || _initTween(this, time); 4692 ratio = this._ease(time / this._dur); // don't just get tween.ratio because it may not have rendered yet. 4693 // possible future addition to allow an object with multiple values to update, like tween.resetTo({x: 100, y: 200}); At this point, it doesn't seem worth the added kb given the fact that most users will likely opt for the convenient gsap.quickTo() way of interacting with this method. 4694 // if (_isObject(property)) { // performance optimization 4695 // for (p in property) { 4696 // if (_updatePropTweens(this, p, property[p], value ? value[p] : null, start, ratio, time)) { 4697 // return this.resetTo(property, value, start, startIsRelative); // if a PropTween wasn't found for the property, it'll get forced with a re-initialization so we need to jump out and start over again. 4698 // } 4699 // } 4700 // } else { 4701 4702 if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time, skipRecursion)) { 4703 return this.resetTo(property, value, start, startIsRelative, 1); // if a PropTween wasn't found for the property, it'll get forced with a re-initialization so we need to jump out and start over again. 4704 } //} 4705 4706 4707 _alignPlayhead(this, 0); 4708 4709 this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0); 4710 return this.render(0); 4711 }; 4712 4713 _proto3.kill = function kill(targets, vars) { 4714 if (vars === void 0) { 4715 vars = "all"; 4716 } 4717 4718 if (!targets && (!vars || vars === "all")) { 4719 this._lazy = this._pt = 0; 4720 return this.parent ? _interrupt(this) :
vendor: 8,666 bytes, lines 4720-4991
4720 this; 4721 } 4722 4723 if (this.timeline) { 4724 var tDur = this.timeline.totalDuration(); 4725 this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this); // if nothing is left tweening, interrupt. 4726 4727 this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1); // if a nested tween is killed that changes the duration, it should affect this tween's duration. We must use the ratio, though, because sometimes the internal timeline is stretched like for keyframes where they don't all add up to whatever the parent tween's duration was set to. 4728 4729 return this; 4730 } 4731 4732 var parsedTargets = this._targets, 4733 killingTargets = targets ? toArray(targets) : parsedTargets, 4734 propTweenLookup = this._ptLookup, 4735 firstPT = this._pt, 4736 overwrittenProps, 4737 curLookup, 4738 curOverwriteProps, 4739 props, 4740 p, 4741 pt, 4742 i; 4743 4744 if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) { 4745 vars === "all" && (this._pt = 0); 4746 return _interrupt(this); 4747 } 4748 4749 overwrittenProps = this._op = this._op || []; 4750 4751 if (vars !== "all") { 4752 //so people can pass in a comma-delimited list of property names 4753 if (_isString(vars)) { 4754 p = {}; 4755 4756 _forEachName(vars, function (name) { 4757 return p[name] = 1; 4758 }); 4759 4760 vars = p; 4761 } 4762 4763 vars = _addAliasesToVars(parsedTargets, vars); 4764 } 4765 4766 i = parsedTargets.length; 4767 4768 while (i--) { 4769 if (~killingTargets.indexOf(parsedTargets[i])) { 4770 curLookup = propTweenLookup[i]; 4771 4772 if (vars === "all") { 4773 overwrittenProps[i] = vars; 4774 props = curLookup; 4775 curOverwriteProps = {}; 4776 } else { 4777 curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {}; 4778 props = vars; 4779 } 4780 4781 for (p in props) { 4782 pt = curLookup && curLookup[p]; 4783 4784 if (pt) { 4785 if (!("kill" in pt.d) || pt.d.kill(p) === true) { 4786 _removeLinkedListItem(this, pt, "_pt"); 4787 } 4788 4789 delete curLookup[p]; 4790 } 4791 4792 if (curOverwriteProps !== "all") { 4793 curOverwriteProps[p] = 1; 4794 } 4795 } 4796 } 4797 } 4798 4799 this._initted && !this._pt && firstPT && _interrupt(this); //if all tweening properties are killed, kill the tween. Without this line, if there's a tween with multiple targets and then you killTweensOf() each target individually, the tween would technically still remain active and fire its onComplete even though there aren't any more properties tweening. 4800 4801 return this; 4802 }; 4803 4804 Tween.to = function to(targets, vars) { 4805 return new Tween(targets, vars, arguments[2]); 4806 }; 4807 4808 Tween.from = function from(targets, vars) { 4809 return _createTweenType(1, arguments); 4810 }; 4811 4812 Tween.delayedCall = function delayedCall(delay, callback, params, scope) { 4813 return new Tween(callback, 0, { 4814 immediateRender: false, 4815 lazy: false, 4816 overwrite: false, 4817 delay: delay, 4818 onComplete: callback, 4819 onReverseComplete: callback, 4820 onCompleteParams: params, 4821 onReverseCompleteParams: params, 4822 callbackScope: scope 4823 }); // we must use onReverseComplete too for things like timeline.add(() => {...}) which should be triggered in BOTH directions (forward and reverse) 4824 }; 4825 4826 Tween.fromTo = function fromTo(targets, fromVars, toVars) { 4827 return _createTweenType(2, arguments); 4828 }; 4829 4830 Tween.set = function set(targets, vars) { 4831 vars.duration = 0; 4832 vars.repeatDelay || (vars.repeat = 0); 4833 return new Tween(targets, vars); 4834 }; 4835 4836 Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) { 4837 return _globalTimeline.killTweensOf(targets, props, onlyActive); 4838 }; 4839 4840 return Tween; 4841}(Animation); 4842 4843_setDefaults(Tween.prototype, { 4844 _targets: [], 4845 _lazy: 0, 4846 _startAt: 0, 4847 _op: 0, 4848 _onInit: 0 4849}); //add the pertinent timeline methods to Tween instances so that users can chain conveniently and create a timeline automatically. (removed due to concerns that it'd ultimately add to more confusion especially for beginners) 4850// _forEachName("to,from,fromTo,set,call,add,addLabel,addPause", name => { 4851// Tween.prototype[name] = function() { 4852// let tl = new Timeline(); 4853// return _addToTimeline(tl, this)[name].apply(tl, toArray(arguments)); 4854// } 4855// }); 4856//for backward compatibility. Leverage the timeline calls. 4857 4858 4859_forEachName("staggerTo,staggerFrom,staggerFromTo", function (name) { 4860 Tween[name] = function () { 4861 var tl = new Timeline(), 4862 params = _slice.call(arguments, 0); 4863 4864 params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0); 4865 return tl[name].apply(tl, params); 4866 }; 4867}); 4868/* 4869 * -------------------------------------------------------------------------------------- 4870 * PROPTWEEN 4871 * -------------------------------------------------------------------------------------- 4872 */ 4873 4874 4875var _setterPlain = function _setterPlain(target, property, value) { 4876 return target[property] = value; 4877}, 4878 _setterFunc = function _setterFunc(target, property, value) { 4879 return target[property](value); 4880}, 4881 _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) { 4882 return target[property](data.fp, value); 4883}, 4884 _setterAttribute = function _setterAttribute(target, property, value) { 4885 return target.setAttribute(property, value); 4886}, 4887 _getSetter = function _getSetter(target, property) { 4888 return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain; 4889}, 4890 _renderPlain = function _renderPlain(ratio, data) { 4891 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1000000) / 1000000, data); 4892}, 4893 _renderBoolean = function _renderBoolean(ratio, data) { 4894 return data.set(data.t, data.p, !!(data.s + data.c * ratio), data); 4895}, 4896 _renderComplexString = function _renderComplexString(ratio, data) { 4897 var pt = data._pt, 4898 s = ""; 4899 4900 if (!ratio && data.b) { 4901 //b = beginning string 4902 s = data.b; 4903 } else if (ratio === 1 && data.e) { 4904 //e = ending string 4905 s = data.e; 4906 } else { 4907 while (pt) { 4908 s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s; //we use the "p" property for the text inbetween (like a suffix). And in the context of a complex string, the modifier (m) is typically just Math.round(), like for RGB colors. 4909 4910 pt = pt._next; 4911 } 4912 4913 s += data.c; //we use the "c" of the PropTween to store the final chunk of non-numeric text. 4914 } 4915 4916 data.set(data.t, data.p, s, data); 4917}, 4918 _renderPropTweens = function _renderPropTweens(ratio, data) { 4919 var pt = data._pt; 4920 4921 while (pt) { 4922 pt.r(ratio, pt.d); 4923 pt = pt._next; 4924 } 4925}, 4926 _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) { 4927 var pt = this._pt, 4928 next; 4929 4930 while (pt) { 4931 next = pt._next; 4932 pt.p === property && pt.modifier(modifier, tween, target); 4933 pt = next; 4934 } 4935}, 4936 _killPropTweensOf = function _killPropTweensOf(property) { 4937 var pt = this._pt, 4938 hasNonDependentRemaining, 4939 next; 4940 4941 while (pt) { 4942 next = pt._next; 4943 4944 if (pt.p === property && !pt.op || pt.op === property) { 4945 _removeLinkedListItem(this, pt, "_pt"); 4946 } else if (!pt.dep) { 4947 hasNonDependentRemaining = 1; 4948 } 4949 4950 pt = next; 4951 } 4952 4953 return !hasNonDependentRemaining; 4954}, 4955 _setterWithModifier = function _setterWithModifier(target, property, value, data) { 4956 data.mSet(target, property, data.m.call(data.tween, value, data.mt), data); 4957}, 4958 _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) { 4959 var pt = parent._pt, 4960 next, 4961 pt2, 4962 first, 4963 last; //sorts the PropTween linked list in order of priority because some plugins need to do their work after ALL of the PropTweens were created (like RoundPropsPlugin and ModifiersPlugin) 4964 4965 while (pt) { 4966 next = pt._next; 4967 pt2 = first; 4968 4969 while (pt2 && pt2.pr > pt.pr) { 4970 pt2 = pt2._next; 4971 } 4972 4973 if (pt._prev = pt2 ? pt2._prev : last) { 4974 pt._prev._next = pt; 4975 } else { 4976 first = pt; 4977 } 4978 4979 if (pt._next = pt2) { 4980 pt2._prev = pt; 4981 } else { 4982 last = pt; 4983 } 4984 4985 pt = next; 4986 } 4987 4988 parent._pt = first; 4989}; //PropTween key: t = target, p = prop, r = renderer, d = data, s = start, c = change, op = overwriteProperty (ONLY populated when it's different than p), pr = priority, _next/_prev for the linked list siblings, set = setter, m = modifier, mSet = modifierSetter (the original setter, before a modifier was added) 4990 4991
4992var PropTween = /*#__PURE__*/function () { 4993 function PropTween(next, target, prop, start, change, renderer, data, setter, priority) { 4994 this.t = target; 4995 this.s = start; 4996 this.c = change; 4997 this.p = prop; 4998 this.r = renderer || _renderPlain; 4999 this.d = data || this; 5000 this.set = setter || _setterPlain; 5001 this.pr = priority || 0; 5002 this._next = next; 5003 5004 if (next) { 5005 next._prev = this; 5006 } 5007 } 5008 5009 var _proto4 = PropTween.prototype; 5010 5011 _proto4.modifier = function modifier(func, tween, target) { 5012 this.mSet = this.mSet || this.set; //in case it was already set (a PropTween can only have one modifier) 5013 5014 this.set = _setterWithModifier; 5015 this.m = func; 5016 this.mt = target; //modifier target 5017 5018 this.tween = tween; 5019 }; 5020 5021 return PropTween; 5022}(); //Initialization tasks 5023 5024_forEachName(_callbackNames + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger
vendor: 6,568 bytes, lines 5024-5232
5024", function (name) { 5025 return _reservedProps[name] = 1; 5026}); 5027 5028_globals.TweenMax = _globals.TweenLite = Tween; 5029_globals.TimelineLite = _globals.TimelineMax = Timeline; 5030_globalTimeline = new Timeline({ 5031 sortChildren: false, 5032 defaults: _defaults, 5033 autoRemoveChildren: true, 5034 id: "root", 5035 smoothChildTiming: true 5036}); 5037_config.stringFilter = _colorStringFilter; 5038 5039var _media = [], 5040 _listeners = {}, 5041 _emptyArray = [], 5042 _lastMediaTime = 0, 5043 _contextID = 0, 5044 _dispatch = function _dispatch(type) { 5045 return (_listeners[type] || _emptyArray).map(function (f) { 5046 return f(); 5047 }); 5048}, 5049 _onMediaChange = function _onMediaChange() { 5050 var time = Date.now(), 5051 matches = []; 5052 5053 if (time - _lastMediaTime > 2) { 5054 _dispatch("matchMediaInit"); 5055 5056 _media.forEach(function (c) { 5057 var queries = c.queries, 5058 conditions = c.conditions, 5059 match, 5060 p, 5061 anyMatch, 5062 toggled; 5063 5064 for (p in queries) { 5065 match = _win.matchMedia(queries[p]).matches; // Firefox doesn't update the "matches" property of the MediaQueryList object correctly - it only does so as it calls its change handler - so we must re-create a media query here to ensure it's accurate. 5066 5067 match && (anyMatch = 1); 5068 5069 if (match !== conditions[p]) { 5070 conditions[p] = match; 5071 toggled = 1; 5072 } 5073 } 5074 5075 if (toggled) { 5076 c.revert(); 5077 anyMatch && matches.push(c); 5078 } 5079 }); 5080 5081 _dispatch("matchMediaRevert"); 5082 5083 matches.forEach(function (c) { 5084 return c.onMatch(c, function (func) { 5085 return c.add(null, func); 5086 }); 5087 }); 5088 _lastMediaTime = time; 5089 5090 _dispatch("matchMedia"); 5091 } 5092}; 5093 5094var Context = /*#__PURE__*/function () { 5095 function Context(func, scope) { 5096 this.selector = scope && selector(scope); 5097 this.data = []; 5098 this._r = []; // returned/cleanup functions 5099 5100 this.isReverted = false; 5101 this.id = _contextID++; // to work around issues that frameworks like Vue cause by making things into Proxies which make it impossible to do something like _media.indexOf(this) because "this" would no longer refer to the Context instance itself - it'd refer to a Proxy! We needed a way to identify the context uniquely 5102 5103 func && this.add(func); 5104 } 5105 5106 var _proto5 = Context.prototype; 5107 5108 _proto5.add = function add(name, func, scope) { 5109 // possible future addition if we need the ability to add() an animation to a context and for whatever reason cannot create that animation inside of a context.add(() => {...}) function. 5110 // if (name && _isFunction(name.revert)) { 5111 // this.data.push(name); 5112 // return (name._ctx = this); 5113 // } 5114 if (_isFunction(name)) { 5115 scope = func; 5116 func = name; 5117 name = _isFunction; 5118 } 5119 5120 var self = this, 5121 f = function f() { 5122 var prev = _context, 5123 prevSelector = self.selector, 5124 result; 5125 prev && prev !== self && prev.data.push(self); 5126 scope && (self.selector = selector(scope)); 5127 _context = self; 5128 result = func.apply(self, arguments); 5129 _isFunction(result) && self._r.push(result); 5130 _context = prev; 5131 self.selector = prevSelector; 5132 self.isReverted = false; 5133 return result; 5134 }; 5135 5136 self.last = f; 5137 return name === _isFunction ? f(self, function (func) { 5138 return self.add(null, func); 5139 }) : name ? self[name] = f : f; 5140 }; 5141 5142 _proto5.ignore = function ignore(func) { 5143 var prev = _context; 5144 _context = null; 5145 func(this); 5146 _context = prev; 5147 }; 5148 5149 _proto5.getTweens = function getTweens() { 5150 var a = []; 5151 this.data.forEach(function (e) { 5152 return e instanceof Context ? a.push.apply(a, e.getTweens()) : e instanceof Tween && !(e.parent && e.parent.data === "nested") && a.push(e); 5153 }); 5154 return a; 5155 }; 5156 5157 _proto5.clear = function clear() { 5158 this._r.length = this.data.length = 0; 5159 }; 5160 5161 _proto5.kill = function kill(revert, matchMedia) { 5162 var _this4 = this; 5163 5164 if (revert) { 5165 (function () { 5166 var tweens = _this4.getTweens(), 5167 i = _this4.data.length, 5168 t; 5169 5170 while (i--) { 5171 // Flip plugin tweens are very different in that they should actually be pushed to their end. The plugin replaces the timeline's .revert() method to do exactly that. But we also need to remove any of those nested tweens inside the flip timeline so that they don't get individually reverted. 5172 t = _this4.data[i]; 5173 5174 if (t.data === "isFlip") { 5175 t.revert(); 5176 t.getChildren(true, true, false).forEach(function (tween) { 5177 return tweens.splice(tweens.indexOf(tween), 1); 5178 }); 5179 } 5180 } // save as an object so that we can cache the globalTime for each tween to optimize performance during the sort 5181 5182 5183 tweens.map(function (t) { 5184 return { 5185 g: t._dur || t._delay || t._sat && !t._sat.vars.immediateRender ? t.globalTime(0) : -Infinity, 5186 t: t 5187 }; 5188 }).sort(function (a, b) { 5189 return b.g - a.g || -Infinity; 5190 }).forEach(function (o) { 5191 return o.t.revert(revert); 5192 }); // note: all of the _startAt tweens should be reverted in reverse order that they were created, and they'll all have the same globalTime (-1) so the " || -1" in the sort keeps the order properly. 5193 5194 i = _this4.data.length; 5195 5196 while (i--) { 5197 // make sure we loop backwards so that, for example, SplitTexts that were created later on the same element get reverted first 5198 t = _this4.data[i]; 5199 5200 if (t instanceof Timeline) { 5201 if (t.data !== "nested") { 5202 t.scrollTrigger && t.scrollTrigger.revert(); 5203 t.kill(); // don't revert() the timeline because that's duplicating efforts since we already reverted all the tweens 5204 } 5205 } else { 5206 !(t instanceof Tween) && t.revert && t.revert(revert); 5207 } 5208 } 5209 5210 _this4._r.forEach(function (f) { 5211 return f(revert, _this4); 5212 }); 5213 5214 _this4.isReverted = true; 5215 })(); 5216 } else { 5217 this.data.forEach(function (e) { 5218 return e.kill && e.kill(); 5219 }); 5220 } 5221 5222 this.clear(); 5223 5224 if (matchMedia) { 5225 var i = _media.length; 5226 5227 while (i--) { 5228 // previously, we checked _media.indexOf(this), but some frameworks like Vue enforce Proxy objects that make it impossible to get the proper result that way, so we must use a unique ID number instead. 5229 _media[i].id === this.id && _media.splice(i, 1); 5230 } 5231 } 5232 }
vendor: 4,392 bytes, lines 5232-5378
5232; 5233 5234 _proto5.revert = function revert(config) { 5235 this.kill(config || {}); 5236 }; 5237 5238 return Context; 5239}(); 5240 5241var MatchMedia = /*#__PURE__*/function () { 5242 function MatchMedia(scope) { 5243 this.contexts = []; 5244 this.scope = scope; 5245 _context && _context.data.push(this); 5246 } 5247 5248 var _proto6 = MatchMedia.prototype; 5249 5250 _proto6.add = function add(conditions, func, scope) { 5251 _isObject(conditions) || (conditions = { 5252 matches: conditions 5253 }); 5254 var context = new Context(0, scope || this.scope), 5255 cond = context.conditions = {}, 5256 mq, 5257 p, 5258 active; 5259 _context && !context.selector && (context.selector = _context.selector); // in case a context is created inside a context. Like a gsap.matchMedia() that's inside a scoped gsap.context() 5260 5261 this.contexts.push(context); 5262 func = context.add("onMatch", func); 5263 context.queries = conditions; 5264 5265 for (p in conditions) { 5266 if (p === "all") { 5267 active = 1; 5268 } else { 5269 mq = _win.matchMedia(conditions[p]); 5270 5271 if (mq) { 5272 _media.indexOf(context) < 0 && _media.push(context); 5273 (cond[p] = mq.matches) && (active = 1); 5274 mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange); 5275 } 5276 } 5277 } 5278 5279 active && func(context, function (f) { 5280 return context.add(null, f); 5281 }); 5282 return this; 5283 } // refresh() { 5284 // let time = _lastMediaTime, 5285 // media = _media; 5286 // _lastMediaTime = -1; 5287 // _media = this.contexts; 5288 // _onMediaChange(); 5289 // _lastMediaTime = time; 5290 // _media = media; 5291 // } 5292 ; 5293 5294 _proto6.revert = function revert(config) { 5295 this.kill(config || {}); 5296 }; 5297 5298 _proto6.kill = function kill(revert) { 5299 this.contexts.forEach(function (c) { 5300 return c.kill(revert, true); 5301 }); 5302 }; 5303 5304 return MatchMedia; 5305}(); 5306/* 5307 * -------------------------------------------------------------------------------------- 5308 * GSAP 5309 * -------------------------------------------------------------------------------------- 5310 */ 5311 5312 5313var _gsap = { 5314 registerPlugin: function registerPlugin() { 5315 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 5316 args[_key2] = arguments[_key2]; 5317 } 5318 5319 args.forEach(function (config) { 5320 return _createPlugin(config); 5321 }); 5322 }, 5323 timeline: function timeline(vars) { 5324 return new Timeline(vars); 5325 }, 5326 getTweensOf: function getTweensOf(targets, onlyActive) { 5327 return _globalTimeline.getTweensOf(targets, onlyActive); 5328 }, 5329 getProperty: function getProperty(target, property, unit, uncache) { 5330 _isString(target) && (target = toArray(target)[0]); //in case selector text or an array is passed in 5331 5332 var getter = _getCache(target || {}).get, 5333 format = unit ? _passThrough : _numericIfPossible; 5334 5335 unit === "native" && (unit = ""); 5336 return !target ? target : !property ? function (property, unit, uncache) { 5337 return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 5338 } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 5339 }, 5340 quickSetter: function quickSetter(target, property, unit) { 5341 target = toArray(target); 5342 5343 if (target.length > 1) { 5344 var setters = target.map(function (t) { 5345 return gsap.quickSetter(t, property, unit); 5346 }), 5347 l = setters.length; 5348 return function (value) { 5349 var i = l; 5350 5351 while (i--) { 5352 setters[i](value); 5353 } 5354 }; 5355 } 5356 5357 target = target[0] || {}; 5358 5359 var Plugin = _plugins[property], 5360 cache = _getCache(target), 5361 p = cache.harness && (cache.harness.aliases || {})[property] || property, 5362 // in case it's an alias, like "rotate" for "rotation". 5363 setter = Plugin ? function (value) { 5364 var p = new Plugin(); 5365 _quickTween._pt = 0; 5366 p.init(target, unit ? value + unit : value, _quickTween, 0, [target]); 5367 p.render(1, p); 5368 _quickTween._pt && _renderPropTweens(1, _quickTween); 5369 } : cache.set(target, p); 5370 5371 return Plugin ? setter : function (value) { 5372 return setter(target, p, unit ? value + unit : value, cache, 1); 5373 }; 5374 }, 5375 quickTo: function quickTo(target, property, vars) { 5376 var _merge2; 5377 5378 var tween = gsap.to(target, _merge((_merge2 = {}, _merge2[property] = "+=0.1", _merge2.paused = true, _merge
vendor: 5,536 bytes, lines 5378-5582
53782), vars || {})), 5379 func = function func(value, start, startIsRelative) { 5380 return tween.resetTo(property, value, start, startIsRelative); 5381 }; 5382 5383 func.tween = tween; 5384 return func; 5385 }, 5386 isTweening: function isTweening(targets) { 5387 return _globalTimeline.getTweensOf(targets, true).length > 0; 5388 }, 5389 defaults: function defaults(value) { 5390 value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease)); 5391 return _mergeDeep(_defaults, value || {}); 5392 }, 5393 config: function config(value) { 5394 return _mergeDeep(_config, value || {}); 5395 }, 5396 registerEffect: function registerEffect(_ref3) { 5397 var name = _ref3.name, 5398 effect = _ref3.effect, 5399 plugins = _ref3.plugins, 5400 defaults = _ref3.defaults, 5401 extendTimeline = _ref3.extendTimeline; 5402 (plugins || "").split(",").forEach(function (pluginName) { 5403 return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin."); 5404 }); 5405 5406 _effects[name] = function (targets, vars, tl) { 5407 return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl); 5408 }; 5409 5410 if (extendTimeline) { 5411 Timeline.prototype[name] = function (targets, vars, position) { 5412 return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position); 5413 }; 5414 } 5415 }, 5416 registerEase: function registerEase(name, ease) { 5417 _easeMap[name] = _parseEase(ease); 5418 }, 5419 parseEase: function parseEase(ease, defaultEase) { 5420 return arguments.length ? _parseEase(ease, defaultEase) : _easeMap; 5421 }, 5422 getById: function getById(id) { 5423 return _globalTimeline.getById(id); 5424 }, 5425 exportRoot: function exportRoot(vars, includeDelayedCalls) { 5426 if (vars === void 0) { 5427 vars = {}; 5428 } 5429 5430 var tl = new Timeline(vars), 5431 child, 5432 next; 5433 tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming); 5434 5435 _globalTimeline.remove(tl); 5436 5437 tl._dp = 0; //otherwise it'll get re-activated when adding children and be re-introduced into _globalTimeline's linked list (then added to itself). 5438 5439 tl._time = tl._tTime = _globalTimeline._time; 5440 child = _globalTimeline._first; 5441 5442 while (child) { 5443 next = child._next; 5444 5445 if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) { 5446 _addToTimeline(tl, child, child._start - child._delay); 5447 } 5448 5449 child = next; 5450 } 5451 5452 _addToTimeline(_globalTimeline, tl, 0); 5453 5454 return tl; 5455 }, 5456 context: function context(func, scope) { 5457 return func ? new Context(func, scope) : _context; 5458 }, 5459 matchMedia: function matchMedia(scope) { 5460 return new MatchMedia(scope); 5461 }, 5462 matchMediaRefresh: function matchMediaRefresh() { 5463 return _media.forEach(function (c) { 5464 var cond = c.conditions, 5465 found, 5466 p; 5467 5468 for (p in cond) { 5469 if (cond[p]) { 5470 cond[p] = false; 5471 found = 1; 5472 } 5473 } 5474 5475 found && c.revert(); 5476 }) || _onMediaChange(); 5477 }, 5478 addEventListener: function addEventListener(type, callback) { 5479 var a = _listeners[type] || (_listeners[type] = []); 5480 ~a.indexOf(callback) || a.push(callback); 5481 }, 5482 removeEventListener: function removeEventListener(type, callback) { 5483 var a = _listeners[type], 5484 i = a && a.indexOf(callback); 5485 i >= 0 && a.splice(i, 1); 5486 }, 5487 utils: { 5488 wrap: wrap, 5489 wrapYoyo: wrapYoyo, 5490 distribute: distribute, 5491 random: random, 5492 snap: snap, 5493 normalize: normalize, 5494 getUnit: getUnit, 5495 clamp: clamp, 5496 splitColor: splitColor, 5497 toArray: toArray, 5498 selector: selector, 5499 mapRange: mapRange, 5500 pipe: pipe, 5501 unitize: unitize, 5502 interpolate: interpolate, 5503 shuffle: shuffle 5504 }, 5505 install: _install, 5506 effects: _effects, 5507 ticker: _ticker, 5508 updateRoot: Timeline.updateRoot, 5509 plugins: _plugins, 5510 globalTimeline: _globalTimeline, 5511 core: { 5512 PropTween: PropTween, 5513 globals: _addGlobal, 5514 Tween: Tween, 5515 Timeline: Timeline, 5516 Animation: Animation, 5517 getCache: _getCache, 5518 _removeLinkedListItem: _removeLinkedListItem, 5519 reverting: function reverting() { 5520 return _reverting; 5521 }, 5522 context: function context(toAdd) { 5523 if (toAdd && _context) { 5524 _context.data.push(toAdd); 5525 5526 toAdd._ctx = _context; 5527 } 5528 5529 return _context; 5530 }, 5531 suppressOverwrites: function suppressOverwrites(value) { 5532 return _suppressOverwrites = value; 5533 } 5534 } 5535}; 5536 5537_forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function (name) { 5538 return _gsap[name] = Tween[name]; 5539}); 5540 5541_ticker.add(Timeline.updateRoot); 5542 5543_quickTween = _gsap.to({}, { 5544 duration: 0 5545}); // ---- EXTRA PLUGINS -------------------------------------------------------- 5546 5547var _getPluginPropTween = function _getPluginPropTween(plugin, prop) { 5548 var pt = plugin._pt; 5549 5550 while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) { 5551 pt = pt._next; 5552 } 5553 5554 return pt; 5555}, 5556 _addModifiers = function _addModifiers(tween, modifiers) { 5557 var targets = tween._targets, 5558 p, 5559 i, 5560 pt; 5561 5562 for (p in modifiers) { 5563 i = targets.length; 5564 5565 while (i--) { 5566 pt = tween._ptLookup[i][p]; 5567 5568 if (pt && (pt = pt.d)) { 5569 if (pt._pt) { 5570 // is a plugin 5571 pt = _getPluginPropTween(pt, p); 5572 } 5573 5574 pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p); 5575 } 5576 } 5577 } 5578}, 5579 _buildModifierPlugin = function _buildModifierPlugin(name, modifier) { 5580 return { 5581 name: name, 5582
vendor: 18,808 bytes, lines 5582-6063
5582rawVars: 1, 5583 //don't pre-process function-based values or "random()" strings. 5584 init: function init(target, vars, tween) { 5585 tween._onInit = function (tween) { 5586 var temp, p; 5587 5588 if (_isString(vars)) { 5589 temp = {}; 5590 5591 _forEachName(vars, function (name) { 5592 return temp[name] = 1; 5593 }); //if the user passes in a comma-delimited list of property names to roundProps, like "x,y", we round to whole numbers. 5594 5595 5596 vars = temp; 5597 } 5598 5599 if (modifier) { 5600 temp = {}; 5601 5602 for (p in vars) { 5603 temp[p] = modifier(vars[p]); 5604 } 5605 5606 vars = temp; 5607 } 5608 5609 _addModifiers(tween, vars); 5610 }; 5611 } 5612 }; 5613}; //register core plugins 5614 5615 5616var gsap = _gsap.registerPlugin({ 5617 name: "attr", 5618 init: function init(target, vars, tween, index, targets) { 5619 var p, pt, v; 5620 this.tween = tween; 5621 5622 for (p in vars) { 5623 v = target.getAttribute(p) || ""; 5624 pt = this.add(target, "setAttribute", (v || 0) + "", vars[p], index, targets, 0, 0, p); 5625 pt.op = p; 5626 pt.b = v; // record the beginning value so we can revert() 5627 5628 this._props.push(p); 5629 } 5630 }, 5631 render: function render(ratio, data) { 5632 var pt = data._pt; 5633 5634 while (pt) { 5635 _reverting ? pt.set(pt.t, pt.p, pt.b, pt) : pt.r(ratio, pt.d); // if reverting, go back to the original (pt.b) 5636 5637 pt = pt._next; 5638 } 5639 } 5640}, { 5641 name: "endArray", 5642 init: function init(target, value) { 5643 var i = value.length; 5644 5645 while (i--) { 5646 this.add(target, i, target[i] || 0, value[i], 0, 0, 0, 0, 0, 1); 5647 } 5648 } 5649}, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap; //to prevent the core plugins from being dropped via aggressive tree shaking, we must include them in the variable declaration in this way. 5650 5651Tween.version = Timeline.version = gsap.version = "3.12.5"; 5652_coreReady = 1; 5653_windowExists() && _wake(); 5654var Power0 = _easeMap.Power0, 5655 Power1 = _easeMap.Power1, 5656 Power2 = _easeMap.Power2, 5657 Power3 = _easeMap.Power3, 5658 Power4 = _easeMap.Power4, 5659 Linear = _easeMap.Linear, 5660 Quad = _easeMap.Quad, 5661 Cubic = _easeMap.Cubic, 5662 Quart = _easeMap.Quart, 5663 Quint = _easeMap.Quint, 5664 Strong = _easeMap.Strong, 5665 Elastic = _easeMap.Elastic, 5666 Back = _easeMap.Back, 5667 SteppedEase = _easeMap.SteppedEase, 5668 Bounce = _easeMap.Bounce, 5669 Sine = _easeMap.Sine, 5670 Expo = _easeMap.Expo, 5671 Circ = _easeMap.Circ; 5672 5673 //export some internal methods/orojects for use in CSSPlugin so that we can externalize that file and allow custom builds that exclude it. 5674 5675 5676;// CONCATENATED MODULE: ./node_modules/gsap/CSSPlugin.js 5677/*! 5678 * CSSPlugin 3.12.5 5679 * https://gsap.com 5680 * 5681 * Copyright 2008-2024, GreenSock. All rights reserved. 5682 * Subject to the terms at https://gsap.com/standard-license or for 5683 * Club GSAP members, the agreement issued with that membership. 5684 * @author: Jack Doyle, [email protected] 5685*/ 5686 5687/* eslint-disable */ 5688 5689 5690var CSSPlugin_win, 5691 CSSPlugin_doc, 5692 _docElement, 5693 _pluginInitted, 5694 _tempDiv, 5695 _tempDivStyler, 5696 _recentSetterPlugin, 5697 CSSPlugin_reverting, 5698 CSSPlugin_windowExists = function _windowExists() { 5699 return typeof window !== "undefined"; 5700}, 5701 _transformProps = {}, 5702 _RAD2DEG = 180 / Math.PI, 5703 _DEG2RAD = Math.PI / 180, 5704 _atan2 = Math.atan2, 5705 CSSPlugin_bigNum = 1e8, 5706 _capsExp = /([A-Z])/g, 5707 _horizontalExp = /(left|right|width|margin|padding|x)/i, 5708 _complexExp = /[\s,\(]\S/, 5709 _propertyAliases = { 5710 autoAlpha: "opacity,visibility", 5711 scale: "scaleX,scaleY", 5712 alpha: "opacity" 5713}, 5714 _renderCSSProp = function _renderCSSProp(ratio, data) { 5715 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); 5716}, 5717 _renderPropWithEnd = function _renderPropWithEnd(ratio, data) { 5718 return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); 5719}, 5720 _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) { 5721 return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u : data.b, data); 5722}, 5723 //if units change, we need a way to render the original unit/value when the tween goes all the way back to the beginning (ratio:0) 5724_renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) { 5725 var value = data.s + data.c * ratio; 5726 data.set(data.t, data.p, ~~(value + (value < 0 ? -.5 : .5)) + data.u, data); 5727}, 5728 _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) { 5729 return data.set(data.t, data.p, ratio ? data.e : data.b, data); 5730}, 5731 _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) { 5732 return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data); 5733}, 5734 _setterCSSStyle = function _setterCSSStyle(target, property, value) { 5735 return target.style[property] = value; 5736}, 5737 _setterCSSProp = function _setterCSSProp(target, property, value) { 5738 return target.style.setProperty(property, value); 5739}, 5740 _setterTransform = function _setterTransform(target, property, value) { 5741 return target._gsap[property] = value; 5742}, 5743 _setterScale = function _setterScale(target, property, value) { 5744 return target._gsap.scaleX = target._gsap.scaleY = value; 5745}, 5746 _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) { 5747 var cache = target._gsap; 5748 cache.scaleX = cache.scaleY = value; 5749 cache.renderTransform(ratio, cache); 5750}, 5751 _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) { 5752 var cache = target._gsap; 5753 cache[property] = value; 5754 cache.renderTransform(ratio, cache); 5755}, 5756 _transformProp = "transform", 5757 _transformOriginProp = _transformProp + "Origin", 5758 _saveStyle = function _saveStyle(property, isNotCSS) { 5759 var _this = this; 5760 5761 var target = this.target, 5762 style = target.style, 5763 cache = target._gsap; 5764 5765 if (property in _transformProps && style) { 5766 this.tfm = this.tfm || {}; 5767 5768 if (property !== "transform") { 5769 property = _propertyAliases[property] || property; 5770 ~property.indexOf(",") ? property.split(",").forEach(function (a) { 5771 return _this.tfm[a] = _get(target, a); 5772 }) : this.tfm[property] = cache.x ? cache[property] : _get(target, property); // note: scale would map to "scaleX,scaleY", thus we loop and apply them both. 5773 5774 property === _transformOriginProp && (this.tfm.zOrigin = cache.zOrigin); 5775 } else { 5776 return _propertyAliases.transform.split(",").forEach(function (p) { 5777 return _saveStyle.call(_this, p, isNotCSS); 5778 }); 5779 } 5780 5781 if (this.props.indexOf(_transformProp) >= 0) { 5782 return; 5783 } 5784 5785 if (cache.svg) { 5786 this.svgo = target.getAttribute("data-svg-origin"); 5787 this.props.push(_transformOriginProp, isNotCSS, ""); 5788 } 5789 5790 property = _transformProp; 5791 } 5792 5793 (style || isNotCSS) && this.props.push(property, isNotCSS, style[property]); 5794}, 5795 _removeIndependentTransforms = function _removeIndependentTransforms(style) { 5796 if (style.translate) { 5797 style.removeProperty("translate"); 5798 style.removeProperty("scale"); 5799 style.removeProperty("rotate"); 5800 } 5801}, 5802 _revertStyle = function _revertStyle() { 5803 var props = this.props, 5804 target = this.target, 5805 style = target.style, 5806 cache = target._gsap, 5807 i, 5808 p; 5809 5810 for (i = 0; i < props.length; i += 3) { 5811 // stored like this: property, isNotCSS, value 5812 props[i + 1] ? target[props[i]] = props[i + 2] : props[i + 2] ? style[props[i]] = props[i + 2] : style.removeProperty(props[i].substr(0, 2) === "--" ? props[i] : props[i].replace(_capsExp, "-$1").toLowerCase()); 5813 } 5814 5815 if (this.tfm) { 5816 for (p in this.tfm) { 5817 cache[p] = this.tfm[p]; 5818 } 5819 5820 if (cache.svg) { 5821 cache.renderTransform(); 5822 target.setAttribute("data-svg-origin", this.svgo || ""); 5823 } 5824 5825 i = CSSPlugin_reverting(); 5826 5827 if ((!i || !i.isStart) && !style[_transformProp]) { 5828 _removeIndependentTransforms(style); 5829 5830 if (cache.zOrigin && style[_transformOriginProp]) { 5831 style[_transformOriginProp] += " " + cache.zOrigin + "px"; // since we're uncaching, we must put the zOrigin back into the transformOrigin so that we can pull it out accurately when we parse again. Otherwise, we'd lose the z portion of the origin since we extract it to protect from Safari bugs. 5832 5833 cache.zOrigin = 0; 5834 cache.renderTransform(); 5835 } 5836 5837 cache.uncache = 1; // if it's a startAt that's being reverted in the _initTween() of the core, we don't need to uncache transforms. This is purely a performance optimization. 5838 } 5839 } 5840}, 5841 _getStyleSaver = function _getStyleSaver(target, properties) { 5842 var saver = { 5843 target: target, 5844 props: [], 5845 revert: _revertStyle, 5846 save: _saveStyle 5847 }; 5848 target._gsap || gsap.core.getCache(target); // just make sure there's a _gsap cache defined because we read from it in _saveStyle() and it's more efficient to just check it here once. 5849 5850 properties && properties.split(",").forEach(function (p) { 5851 return saver.save(p); 5852 }); 5853 return saver; 5854}, 5855 _supports3D, 5856 _createElement = function _createElement(type, ns) { 5857 var e = CSSPlugin_doc.createElementNS ? CSSPlugin_doc.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : CSSPlugin_doc.createElement(type); //some servers swap in https for http in the namespace which can break things, making "style" inaccessible. 5858 5859 return e && e.style ? e : CSSPlugin_doc.createElement(type); //some environments won't allow access to the element's style when created with a namespace in which case we default to the standard createElement() to work around the issue. Also note that when GSAP is embedded directly inside an SVG file, createElement() won't allow access to the style object in Firefox (see https://gsap.com/forums/topic/20215-problem-using-tweenmax-in-standalone-self-containing-svg-file-err-cannot-set-property-csstext-of-undefined/). 5860}, 5861 _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) { 5862 var cs = getComputedStyle(target); 5863 return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || ""; //css variables may not need caps swapped out for dashes and lowercase. 5864}, 5865 _prefixes = "O,Moz,ms,Ms,Webkit".split(","), 5866 _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) { 5867 var e = element || _tempDiv, 5868 s = e.style, 5869 i = 5; 5870 5871 if (property in s && !preferPrefix) { 5872 return property; 5873 } 5874 5875 property = property.charAt(0).toUpperCase() + property.substr(1); 5876 5877 while (i-- && !(_prefixes[i] + property in s)) {} 5878 5879 return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property; 5880}, 5881 _initCore = function _initCore() { 5882 if (CSSPlugin_windowExists() && window.document) { 5883 CSSPlugin_win = window; 5884 CSSPlugin_doc = CSSPlugin_win.document; 5885 _docElement = CSSPlugin_doc.documentElement; 5886 _tempDiv = _createElement("div") || { 5887 style: {} 5888 }; 5889 _tempDivStyler = _createElement("div"); 5890 _transformProp = _checkPropPrefix(_transformProp); 5891 _transformOriginProp = _transformProp + "Origin"; 5892 _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0"; //make sure to override certain properties that may contaminate measurements, in case the user has overreaching style sheets. 5893 5894 _supports3D = !!_checkPropPrefix("perspective"); 5895 CSSPlugin_reverting = gsap.core.reverting; 5896 _pluginInitted = 1; 5897 } 5898}, 5899 _getBBoxHack = function _getBBoxHack(swapIfPossible) { 5900 //works around issues in some browsers (like Firefox) that don't correctly report getBBox() on SVG elements inside a <defs> element and/or <mask>. We try creating an SVG, adding it to the documentElement and toss the element in there so that it's definitely part of the rendering tree, then grab the bbox and if it works, we actually swap out the original getBBox() method for our own that does these extra steps whenever getBBox is needed. This helps ensure that performance is optimal (only do all these extra steps when absolutely necessary...most elements don't need it). 5901 var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), 5902 oldParent = this.parentNode, 5903 oldSibling = this.nextSibling, 5904 oldCSS = this.style.cssText, 5905 bbox; 5906 5907 _docElement.appendChild(svg); 5908 5909 svg.appendChild(this); 5910 this.style.display = "block"; 5911 5912 if (swapIfPossible) { 5913 try { 5914 bbox = this.getBBox(); 5915 this._gsapBBox = this.getBBox; //store the original 5916 5917 this.getBBox = _getBBoxHack; 5918 } catch (e) {} 5919 } else if (this._gsapBBox) { 5920 bbox = this._gsapBBox(); 5921 } 5922 5923 if (oldParent) { 5924 if (oldSibling) { 5925 oldParent.insertBefore(this, oldSibling); 5926 } else { 5927 oldParent.appendChild(this); 5928 } 5929 } 5930 5931 _docElement.removeChild(svg); 5932 5933 this.style.cssText = oldCSS; 5934 return bbox; 5935}, 5936 _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) { 5937 var i = attributesArray.length; 5938 5939 while (i--) { 5940 if (target.hasAttribute(attributesArray[i])) { 5941 return target.getAttribute(attributesArray[i]); 5942 } 5943 } 5944}, 5945 _getBBox = function _getBBox(target) { 5946 var bounds; 5947 5948 try { 5949 bounds = target.getBBox(); //Firefox throws errors if you try calling getBBox() on an SVG element that's not rendered (like in a <symbol> or <defs>). https://bugzilla.mozilla.org/show_bug.cgi?id=612118 5950 } catch (error) { 5951 bounds = _getBBoxHack.call(target, true); 5952 } 5953 5954 bounds && (bounds.width || bounds.height) || target.getBBox === _getBBoxHack || (bounds = _getBBoxHack.call(target, true)); //some browsers (like Firefox) misreport the bounds if the element has zero width and height (it just assumes it's at x:0, y:0), thus we need to manually grab the position in that case. 5955 5956 return bounds && !bounds.width && !bounds.x && !bounds.y ? { 5957 x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0, 5958 y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0, 5959 width: 0, 5960 height: 0 5961 } : bounds; 5962}, 5963 _isSVG = function _isSVG(e) { 5964 return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e)); 5965}, 5966 //reports if the element is an SVG on which getBBox() actually works 5967_removeProperty = function _removeProperty(target, property) { 5968 if (property) { 5969 var style = target.style, 5970 first2Chars; 5971 5972 if (property in _transformProps && property !== _transformOriginProp) { 5973 property = _transformProp; 5974 } 5975 5976 if (style.removeProperty) { 5977 first2Chars = property.substr(0, 2); 5978 5979 if (first2Chars === "ms" || property.substr(0, 6) === "webkit") { 5980 //Microsoft and some Webkit browsers don't conform to the standard of capitalizing the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example) 5981 property = "-" + property; 5982 } 5983 5984 style.removeProperty(first2Chars === "--" ? property : property.replace(_capsExp, "-$1").toLowerCase()); 5985 } else { 5986 //note: old versions of IE use "removeAttribute()" instead of "removeProperty()" 5987 style.removeAttribute(property); 5988 } 5989 } 5990}, 5991 _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) { 5992 var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue); 5993 plugin._pt = pt; 5994 pt.b = beginning; 5995 pt.e = end; 5996 5997 plugin._props.push(property); 5998 5999 return pt; 6000}, 6001 _nonConvertibleUnits = { 6002 deg: 1, 6003 rad: 1, 6004 turn: 1 6005}, 6006 _nonStandardLayouts = { 6007 grid: 1, 6008 flex: 1 6009}, 6010 //takes a single value like 20px and converts it to the unit specified, like "%", returning only the numeric amount. 6011_convertToUnit = function _convertToUnit(target, property, value, unit) { 6012 var curValue = parseFloat(value) || 0, 6013 curUnit = (value + "").trim().substr((curValue + "").length) || "px", 6014 // some browsers leave extra whitespace at the beginning of CSS variables, hence the need to trim() 6015 style = _tempDiv.style, 6016 horizontal = _horizontalExp.test(property), 6017 isRootSVG = target.tagName.toLowerCase() === "svg", 6018 measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"), 6019 amount = 100, 6020 toPixels = unit === "px", 6021 toPercent = unit === "%", 6022 px, 6023 parent, 6024 cache, 6025 isSVG; 6026 6027 if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) { 6028 return curValue; 6029 } 6030 6031 curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px")); 6032 isSVG = target.getCTM && _isSVG(target); 6033 6034 if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) { 6035 px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty]; 6036 return _round(toPercent ? curValue / px * amount : curValue / 100 * px); 6037 } 6038 6039 style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit); 6040 parent = ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode; 6041 6042 if (isSVG) { 6043 parent = (target.ownerSVGElement || {}).parentNode; 6044 } 6045 6046 if (!parent || parent === CSSPlugin_doc || !parent.appendChild) { 6047 parent = CSSPlugin_doc.body; 6048 } 6049 6050 cache = parent._gsap; 6051 6052 if (cache && toPercent && cache.width && horizontal && cache.time === _ticker.time && !cache.uncache) { 6053 return _round(curValue / cache.width * amount); 6054 } else { 6055 if (toPercent && (property === "height" || property === "width")) { 6056 // if we're dealing with width/height that's inside a container with padding and/or it's a flexbox/grid container, we must apply it to the target itself rather than the _tempDiv in order to ensure complete accuracy, factoring in the parent's padding. 6057 var v = target.style[property]; 6058 target.style[property] = amount + unit; 6059 px = target[measureProperty]; 6060 v ? target.style[property] = v : _removeProperty(target, property); 6061 } else { 6062 (toPercent || curUnit === "%") && !_nonStandardLayouts[_getComputedProperty(parent, "display")] && (style.position = _getComputedProperty(target, "position")); 6063 parent === target && (style.position = "static"); // like for borderRadius, if it's a % we must have it relative to the target itself but that may not have position: relative or position: absolute in
vendor: 8,368 bytes, lines 6063-6270
6063which case it'd go up the chain until it finds its offsetParent (bad). position: static protects against that. 6064 6065 parent.appendChild(_tempDiv); 6066 px = _tempDiv[measureProperty]; 6067 parent.removeChild(_tempDiv); 6068 style.position = "absolute"; 6069 } 6070 6071 if (horizontal && toPercent) { 6072 cache = _getCache(parent); 6073 cache.time = _ticker.time; 6074 cache.width = parent[measureProperty]; 6075 } 6076 } 6077 6078 return _round(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0); 6079}, 6080 _get = function _get(target, property, unit, uncache) { 6081 var value; 6082 _pluginInitted || _initCore(); 6083 6084 if (property in _propertyAliases && property !== "transform") { 6085 property = _propertyAliases[property]; 6086 6087 if (~property.indexOf(",")) { 6088 property = property.split(",")[0]; 6089 } 6090 } 6091 6092 if (_transformProps[property] && property !== "transform") { 6093 value = _parseTransform(target, uncache); 6094 value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px"; 6095 } else { 6096 value = target.style[property]; 6097 6098 if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) { 6099 value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0); // note: some browsers, like Firefox, don't report borderRadius correctly! Instead, it only reports every corner like borderTopLeftRadius 6100 } 6101 } 6102 6103 return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value; 6104}, 6105 _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) { 6106 // note: we call _tweenComplexCSSString.call(pluginInstance...) to ensure that it's scoped properly. We may call it from within a plugin too, thus "this" would refer to the plugin. 6107 if (!start || start === "none") { 6108 // some browsers like Safari actually PREFER the prefixed property and mis-report the unprefixed value like clipPath (BUG). In other words, even though clipPath exists in the style ("clipPath" in target.style) and it's set in the CSS properly (along with -webkit-clip-path), Safari reports clipPath as "none" whereas WebkitClipPath reports accurately like "ellipse(100% 0% at 50% 0%)", so in this case we must SWITCH to using the prefixed property instead. See https://gsap.com/forums/topic/18310-clippath-doesnt-work-on-ios/ 6109 var p = _checkPropPrefix(prop, target, 1), 6110 s = p && _getComputedProperty(target, p, 1); 6111 6112 if (s && s !== start) { 6113 prop = p; 6114 start = s; 6115 } else if (prop === "borderColor") { 6116 start = _getComputedProperty(target, "borderTopColor"); // Firefox bug: always reports "borderColor" as "", so we must fall back to borderTopColor. See https://gsap.com/forums/topic/24583-how-to-return-colors-that-i-had-after-reverse/ 6117 } 6118 } 6119 6120 var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString), 6121 index = 0, 6122 matchIndex = 0, 6123 a, 6124 result, 6125 startValues, 6126 startNum, 6127 color, 6128 startValue, 6129 endValue, 6130 endNum, 6131 chunk, 6132 endUnit, 6133 startUnit, 6134 endValues; 6135 pt.b = start; 6136 pt.e = end; 6137 start += ""; // ensure values are strings 6138 6139 end += ""; 6140 6141 if (end === "auto") { 6142 startValue = target.style[prop]; 6143 target.style[prop] = end; 6144 end = _getComputedProperty(target, prop) || end; 6145 startValue ? target.style[prop] = startValue : _removeProperty(target, prop); 6146 } 6147 6148 a = [start, end]; 6149 6150 _colorStringFilter(a); // pass an array with the starting and ending values and let the filter do whatever it needs to the values. If colors are found, it returns true and then we must match where the color shows up order-wise because for things like boxShadow, sometimes the browser provides the computed values with the color FIRST, but the user provides it with the color LAST, so flip them if necessary. Same for drop-shadow(). 6151 6152 6153 start = a[0]; 6154 end = a[1]; 6155 startValues = start.match(_numWithUnitExp) || []; 6156 endValues = end.match(_numWithUnitExp) || []; 6157 6158 if (endValues.length) { 6159 while (result = _numWithUnitExp.exec(end)) { 6160 endValue = result[0]; 6161 chunk = end.substring(index, result.index); 6162 6163 if (color) { 6164 color = (color + 1) % 5; 6165 } else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") { 6166 color = 1; 6167 } 6168 6169 if (endValue !== (startValue = startValues[matchIndex++] || "")) { 6170 startNum = parseFloat(startValue) || 0; 6171 startUnit = startValue.substr((startNum + "").length); 6172 endValue.charAt(1) === "=" && (endValue = _parseRelative(startNum, endValue) + startUnit); 6173 endNum = parseFloat(endValue); 6174 endUnit = endValue.substr((endNum + "").length); 6175 index = _numWithUnitExp.lastIndex - endUnit.length; 6176 6177 if (!endUnit) { 6178 //if something like "perspective:300" is passed in and we must add a unit to the end 6179 endUnit = endUnit || _config.units[prop] || startUnit; 6180 6181 if (index === end.length) { 6182 end += endUnit; 6183 pt.e += endUnit; 6184 } 6185 } 6186 6187 if (startUnit !== endUnit) { 6188 startNum = _convertToUnit(target, prop, startValue, endUnit) || 0; 6189 } // these nested PropTweens are handled in a special way - we'll never actually call a render or setter method on them. We'll just loop through them in the parent complex string PropTween's render method. 6190 6191 6192 pt._pt = { 6193 _next: pt._pt, 6194 p: chunk || matchIndex === 1 ? chunk : ",", 6195 //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case. 6196 s: startNum, 6197 c: endNum - startNum, 6198 m: color && color < 4 || prop === "zIndex" ? Math.round : 0 6199 }; 6200 } 6201 } 6202 6203 pt.c = index < end.length ? end.substring(index, end.length) : ""; //we use the "c" of the PropTween to store the final part of the string (after the last number) 6204 } else { 6205 pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue; 6206 } 6207 6208 _relExp.test(end) && (pt.e = 0); //if the end string contains relative values or dynamic random(...) values, delete the end it so that on the final render we don't actually set it to the string with += or -= characters (forces it to use the calculated value). 6209 6210 this._pt = pt; //start the linked list with this new PropTween. Remember, we call _tweenComplexCSSString.call(pluginInstance...) to ensure that it's scoped properly. We may call it from within another plugin too, thus "this" would refer to the plugin. 6211 6212 return pt; 6213}, 6214 _keywordToPercent = { 6215 top: "0%", 6216 bottom: "100%", 6217 left: "0%", 6218 right: "100%", 6219 center: "50%" 6220}, 6221 _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) { 6222 var split = value.split(" "), 6223 x = split[0], 6224 y = split[1] || "50%"; 6225 6226 if (x === "top" || x === "bottom" || y === "left" || y === "right") { 6227 //the user provided them in the wrong order, so flip them 6228 value = x; 6229 x = y; 6230 y = value; 6231 } 6232 6233 split[0] = _keywordToPercent[x] || x; 6234 split[1] = _keywordToPercent[y] || y; 6235 return split.join(" "); 6236}, 6237 _renderClearProps = function _renderClearProps(ratio, data) { 6238 if (data.tween && data.tween._time === data.tween._dur) { 6239 var target = data.t, 6240 style = target.style, 6241 props = data.u, 6242 cache = target._gsap, 6243 prop, 6244 clearTransforms, 6245 i; 6246 6247 if (props === "all" || props === true) { 6248 style.cssText = ""; 6249 clearTransforms = 1; 6250 } else { 6251 props = props.split(","); 6252 i = props.length; 6253 6254 while (--i > -1) { 6255 prop = props[i]; 6256 6257 if (_transformProps[prop]) { 6258 clearTransforms = 1; 6259 prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp; 6260 } 6261 6262 _removeProperty(target, prop); 6263 } 6264 } 6265 6266 if (clearTransforms) { 6267 _removeProperty(target, _transformProp); 6268 6269 if (cache) { 6270 cache.svg && target.removeAttribute("transform")
vendor: 5,807 bytes, lines 6270-6398
6270; 6271 6272 _parseTransform(target, 1); // force all the cached values back to "normal"/identity, otherwise if there's another tween that's already set to render transforms on this element, it could display the wrong values. 6273 6274 6275 cache.uncache = 1; 6276 6277 _removeIndependentTransforms(style); 6278 } 6279 } 6280 } 6281}, 6282 // note: specialProps should return 1 if (and only if) they have a non-zero priority. It indicates we need to sort the linked list. 6283_specialProps = { 6284 clearProps: function clearProps(plugin, target, property, endValue, tween) { 6285 if (tween.data !== "isFromStart") { 6286 var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps); 6287 pt.u = endValue; 6288 pt.pr = -10; 6289 pt.tween = tween; 6290 6291 plugin._props.push(property); 6292 6293 return 1; 6294 } 6295 } 6296 /* className feature (about 0.4kb gzipped). 6297 , className(plugin, target, property, endValue, tween) { 6298 let _renderClassName = (ratio, data) => { 6299 data.css.render(ratio, data.css); 6300 if (!ratio || ratio === 1) { 6301 let inline = data.rmv, 6302 target = data.t, 6303 p; 6304 target.setAttribute("class", ratio ? data.e : data.b); 6305 for (p in inline) { 6306 _removeProperty(target, p); 6307 } 6308 } 6309 }, 6310 _getAllStyles = (target) => { 6311 let styles = {}, 6312 computed = getComputedStyle(target), 6313 p; 6314 for (p in computed) { 6315 if (isNaN(p) && p !== "cssText" && p !== "length") { 6316 styles[p] = computed[p]; 6317 } 6318 } 6319 _setDefaults(styles, _parseTransform(target, 1)); 6320 return styles; 6321 }, 6322 startClassList = target.getAttribute("class"), 6323 style = target.style, 6324 cssText = style.cssText, 6325 cache = target._gsap, 6326 classPT = cache.classPT, 6327 inlineToRemoveAtEnd = {}, 6328 data = {t:target, plugin:plugin, rmv:inlineToRemoveAtEnd, b:startClassList, e:(endValue.charAt(1) !== "=") ? endValue : startClassList.replace(new RegExp("(?:\\s|^)" + endValue.substr(2) + "(?![\\w-])"), "") + ((endValue.charAt(0) === "+") ? " " + endValue.substr(2) : "")}, 6329 changingVars = {}, 6330 startVars = _getAllStyles(target), 6331 transformRelated = /(transform|perspective)/i, 6332 endVars, p; 6333 if (classPT) { 6334 classPT.r(1, classPT.d); 6335 _removeLinkedListItem(classPT.d.plugin, classPT, "_pt"); 6336 } 6337 target.setAttribute("class", data.e); 6338 endVars = _getAllStyles(target, true); 6339 target.setAttribute("class", startClassList); 6340 for (p in endVars) { 6341 if (endVars[p] !== startVars[p] && !transformRelated.test(p)) { 6342 changingVars[p] = endVars[p]; 6343 if (!style[p] && style[p] !== "0") { 6344 inlineToRemoveAtEnd[p] = 1; 6345 } 6346 } 6347 } 6348 cache.classPT = plugin._pt = new PropTween(plugin._pt, target, "className", 0, 0, _renderClassName, data, 0, -11); 6349 if (style.cssText !== cssText) { //only apply if things change. Otherwise, in cases like a background-image that's pulled dynamically, it could cause a refresh. See https://gsap.com/forums/topic/20368-possible-gsap-bug-switching-classnames-in-chrome/. 6350 style.cssText = cssText; //we recorded cssText before we swapped classes and ran _getAllStyles() because in cases when a className tween is overwritten, we remove all the related tweening properties from that class change (otherwise class-specific stuff can't override properties we've directly set on the target's style object due to specificity). 6351 } 6352 _parseTransform(target, true); //to clear the caching of transforms 6353 data.css = new gsap.plugins.css(); 6354 data.css.init(target, changingVars, tween); 6355 plugin._props.push(...data.css._props); 6356 return 1; 6357 } 6358 */ 6359 6360}, 6361 6362/* 6363 * -------------------------------------------------------------------------------------- 6364 * TRANSFORMS 6365 * -------------------------------------------------------------------------------------- 6366 */ 6367_identity2DMatrix = [1, 0, 0, 1, 0, 0], 6368 _rotationalProperties = {}, 6369 _isNullTransform = function _isNullTransform(value) { 6370 return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value; 6371}, 6372 _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) { 6373 var matrixString = _getComputedProperty(target, _transformProp); 6374 6375 return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp).map(_round); 6376}, 6377 _getMatrix = function _getMatrix(target, force2D) { 6378 var cache = target._gsap || _getCache(target), 6379 style = target.style, 6380 matrix = _getComputedTransformMatrixAsArray(target), 6381 parent, 6382 nextSibling, 6383 temp, 6384 addedToDOM; 6385 6386 if (cache.svg && target.getAttribute("transform")) { 6387 temp = target.transform.baseVal.consolidate().matrix; //ensures that even complex values like "translate(50,60) rotate(135,0,0)" are parsed because it mashes it into a matrix. 6388 6389 matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f]; 6390 return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix; 6391 } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) { 6392 //note: if offsetParent is null, that means the element isn't in the normal document flow, like if it has display:none or one of its ancestors has display:none). Firefox returns null for getComputedStyle() if the element is in an iframe that has display:none. https://bugzilla.mozilla.org/show_bug.cgi?id=548397 6393 //browsers don't report transforms accurately unless the element is in the DOM and has a display value that's not "none". Firefox and Microsoft browsers have a partial bug where they'll report transforms even if display:none BUT not any percentage-based values like translate(-50%, 8px) will be reported as if it's translate(0, 8px). 6394 temp = style.display; 6395 style.display = "block"; 6396 parent = target.parentNode; 6397 6398 if (!parent || !target.offsetParent
6398) { 6399 // note: in 3.3.0 we switched target.offsetParent to _doc.body.contains(target) to avoid [sometimes unnecessary] MutationObserver calls but that wasn't adequate because there are edge cases where nested position: fixed elements need to get reparented to accurately sense transforms. See https://github.com/greensock/GSAP/issues/388 and https://github.com/greensock/GSAP/issues/375
vendor: 17,320 bytes, lines 6399-6895
6399 6400 addedToDOM = 1; //flag 6401 6402 nextSibling = target.nextElementSibling; 6403 6404 _docElement.appendChild(target); //we must add it to the DOM in order to get values properly 6405 6406 } 6407 6408 matrix = _getComputedTransformMatrixAsArray(target); 6409 temp ? style.display = temp : _removeProperty(target, "display"); 6410 6411 if (addedToDOM) { 6412 nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target); 6413 } 6414 } 6415 6416 return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix; 6417}, 6418 _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) { 6419 var cache = target._gsap, 6420 matrix = matrixArray || _getMatrix(target, true), 6421 xOriginOld = cache.xOrigin || 0, 6422 yOriginOld = cache.yOrigin || 0, 6423 xOffsetOld = cache.xOffset || 0, 6424 yOffsetOld = cache.yOffset || 0, 6425 a = matrix[0], 6426 b = matrix[1], 6427 c = matrix[2], 6428 d = matrix[3], 6429 tx = matrix[4], 6430 ty = matrix[5], 6431 originSplit = origin.split(" "), 6432 xOrigin = parseFloat(originSplit[0]) || 0, 6433 yOrigin = parseFloat(originSplit[1]) || 0, 6434 bounds, 6435 determinant, 6436 x, 6437 y; 6438 6439 if (!originIsAbsolute) { 6440 bounds = _getBBox(target); 6441 xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width : xOrigin); 6442 yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin); // if (!("xOrigin" in cache) && (xOrigin || yOrigin)) { // added in 3.12.3, reverted in 3.12.4; requires more exploration 6443 // xOrigin -= bounds.x; 6444 // yOrigin -= bounds.y; 6445 // } 6446 } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) { 6447 //if it's zero (like if scaleX and scaleY are zero), skip it to avoid errors with dividing by zero. 6448 x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant; 6449 y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant; 6450 xOrigin = x; 6451 yOrigin = y; // theory: we only had to do this for smoothing and it assumes that the previous one was not originIsAbsolute. 6452 } 6453 6454 if (smooth || smooth !== false && cache.smooth) { 6455 tx = xOrigin - xOriginOld; 6456 ty = yOrigin - yOriginOld; 6457 cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx; 6458 cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty; 6459 } else { 6460 cache.xOffset = cache.yOffset = 0; 6461 } 6462 6463 cache.xOrigin = xOrigin; 6464 cache.yOrigin = yOrigin; 6465 cache.smooth = !!smooth; 6466 cache.origin = origin; 6467 cache.originIsAbsolute = !!originIsAbsolute; 6468 target.style[_transformOriginProp] = "0px 0px"; //otherwise, if someone sets an origin via CSS, it will likely interfere with the SVG transform attribute ones (because remember, we're baking the origin into the matrix() value). 6469 6470 if (pluginToAddPropTweensTo) { 6471 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin); 6472 6473 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin); 6474 6475 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset); 6476 6477 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset); 6478 } 6479 6480 target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin); 6481}, 6482 _parseTransform = function _parseTransform(target, uncache) { 6483 var cache = target._gsap || new GSCache(target); 6484 6485 if ("x" in cache && !uncache && !cache.uncache) { 6486 return cache; 6487 } 6488 6489 var style = target.style, 6490 invertedScaleX = cache.scaleX < 0, 6491 px = "px", 6492 deg = "deg", 6493 cs = getComputedStyle(target), 6494 origin = _getComputedProperty(target, _transformOriginProp) || "0", 6495 x, 6496 y, 6497 z, 6498 scaleX, 6499 scaleY, 6500 rotation, 6501 rotationX, 6502 rotationY, 6503 skewX, 6504 skewY, 6505 perspective, 6506 xOrigin, 6507 yOrigin, 6508 matrix, 6509 angle, 6510 cos, 6511 sin, 6512 a, 6513 b, 6514 c, 6515 d, 6516 a12, 6517 a22, 6518 t1, 6519 t2, 6520 t3, 6521 a13, 6522 a23, 6523 a33, 6524 a42, 6525 a43, 6526 a32; 6527 x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0; 6528 scaleX = scaleY = 1; 6529 cache.svg = !!(target.getCTM && _isSVG(target)); 6530 6531 if (cs.translate) { 6532 // accommodate independent transforms by combining them into normal ones. 6533 if (cs.translate !== "none" || cs.scale !== "none" || cs.rotate !== "none") { 6534 style[_transformProp] = (cs.translate !== "none" ? "translate3d(" + (cs.translate + " 0 0").split(" ").slice(0, 3).join(", ") + ") " : "") + (cs.rotate !== "none" ? "rotate(" + cs.rotate + ") " : "") + (cs.scale !== "none" ? "scale(" + cs.scale.split(" ").join(",") + ") " : "") + (cs[_transformProp] !== "none" ? cs[_transformProp] : ""); 6535 } 6536 6537 style.scale = style.rotate = style.translate = "none"; 6538 } 6539 6540 matrix = _getMatrix(target, cache.svg); 6541 6542 if (cache.svg) { 6543 if (cache.uncache) { 6544 // if cache.uncache is true (and maybe if origin is 0,0), we need to set element.style.transformOrigin = (cache.xOrigin - bbox.x) + "px " + (cache.yOrigin - bbox.y) + "px". Previously we let the data-svg-origin stay instead, but when introducing revert(), it complicated things. 6545 t2 = target.getBBox(); 6546 origin = cache.xOrigin - t2.x + "px " + (cache.yOrigin - t2.y) + "px"; 6547 t1 = ""; 6548 } else { 6549 t1 = !uncache && target.getAttribute("data-svg-origin"); // Remember, to work around browser inconsistencies we always force SVG elements' transformOrigin to 0,0 and offset the translation accordingly. 6550 } 6551 6552 _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix); 6553 } 6554 6555 xOrigin = cache.xOrigin || 0; 6556 yOrigin = cache.yOrigin || 0; 6557 6558 if (matrix !== _identity2DMatrix) { 6559 a = matrix[0]; //a11 6560 6561 b = matrix[1]; //a21 6562 6563 c = matrix[2]; //a31 6564 6565 d = matrix[3]; //a41 6566 6567 x = a12 = matrix[4]; 6568 y = a22 = matrix[5]; //2D matrix 6569 6570 if (matrix.length === 6) { 6571 scaleX = Math.sqrt(a * a + b * b); 6572 scaleY = Math.sqrt(d * d + c * c); 6573 rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist). 6574 6575 skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0; 6576 skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD))); 6577 6578 if (cache.svg) { 6579 x -= xOrigin - (xOrigin * a + yOrigin * c); 6580 y -= yOrigin - (xOrigin * b + yOrigin * d); 6581 } //3D matrix 6582 6583 } else { 6584 a32 = matrix[6]; 6585 a42 = matrix[7]; 6586 a13 = matrix[8]; 6587 a23 = matrix[9]; 6588 a33 = matrix[10]; 6589 a43 = matrix[11]; 6590 x = matrix[12]; 6591 y = matrix[13]; 6592 z = matrix[14]; 6593 angle = _atan2(a32, a33); 6594 rotationX = angle * _RAD2DEG; //rotationX 6595 6596 if (angle) { 6597 cos = Math.cos(-angle); 6598 sin = Math.sin(-angle); 6599 t1 = a12 * cos + a13 * sin; 6600 t2 = a22 * cos + a23 * sin; 6601 t3 = a32 * cos + a33 * sin; 6602 a13 = a12 * -sin + a13 * cos; 6603 a23 = a22 * -sin + a23 * cos; 6604 a33 = a32 * -sin + a33 * cos; 6605 a43 = a42 * -sin + a43 * cos; 6606 a12 = t1; 6607 a22 = t2; 6608 a32 = t3; 6609 } //rotationY 6610 6611 6612 angle = _atan2(-c, a33); 6613 rotationY = angle * _RAD2DEG; 6614 6615 if (angle) { 6616 cos = Math.cos(-angle); 6617 sin = Math.sin(-angle); 6618 t1 = a * cos - a13 * sin; 6619 t2 = b * cos - a23 * sin; 6620 t3 = c * cos - a33 * sin; 6621 a43 = d * sin + a43 * cos; 6622 a = t1; 6623 b = t2; 6624 c = t3; 6625 } //rotationZ 6626 6627 6628 angle = _atan2(b, a); 6629 rotation = angle * _RAD2DEG; 6630 6631 if (angle) { 6632 cos = Math.cos(angle); 6633 sin = Math.sin(angle); 6634 t1 = a * cos + b * sin; 6635 t2 = a12 * cos + a22 * sin; 6636 b = b * cos - a * sin; 6637 a22 = a22 * cos - a12 * sin; 6638 a = t1; 6639 a12 = t2; 6640 } 6641 6642 if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) { 6643 //when rotationY is set, it will often be parsed as 180 degrees different than it should be, and rotationX and rotation both being 180 (it looks the same), so we adjust for that here. 6644 rotationX = rotation = 0; 6645 rotationY = 180 - rotationY; 6646 } 6647 6648 scaleX = _round(Math.sqrt(a * a + b * b + c * c)); 6649 scaleY = _round(Math.sqrt(a22 * a22 + a32 * a32)); 6650 angle = _atan2(a12, a22); 6651 skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0; 6652 perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0; 6653 } 6654 6655 if (cache.svg) { 6656 //sense if there are CSS transforms applied on an SVG element in which case we must overwrite them when rendering. The transform attribute is more reliable cross-browser, but we can't just remove the CSS ones because they may be applied in a CSS rule somewhere (not just inline). 6657 t1 = target.getAttribute("transform"); 6658 cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp)); 6659 t1 && target.setAttribute("transform", t1); 6660 } 6661 } 6662 6663 if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) { 6664 if (invertedScaleX) { 6665 scaleX *= -1; 6666 skewX += rotation <= 0 ? 180 : -180; 6667 rotation += rotation <= 0 ? 180 : -180; 6668 } else { 6669 scaleY *= -1; 6670 skewX += skewX <= 0 ? 180 : -180; 6671 } 6672 } 6673 6674 uncache = uncache || cache.uncache; 6675 cache.x = x - ((cache.xPercent = x && (!uncache && cache.xPercent || (Math.round(target.offsetWidth / 2) === Math.round(-x) ? -50 : 0))) ? target.offsetWidth * cache.xPercent / 100 : 0) + px; 6676 cache.y = y - ((cache.yPercent = y && (!uncache && cache.yPercent || (Math.round(target.offsetHeight / 2) === Math.round(-y) ? -50 : 0))) ? target.offsetHeight * cache.yPercent / 100 : 0) + px; 6677 cache.z = z + px; 6678 cache.scaleX = _round(scaleX); 6679 cache.scaleY = _round(scaleY); 6680 cache.rotation = _round(rotation) + deg; 6681 cache.rotationX = _round(rotationX) + deg; 6682 cache.rotationY = _round(rotationY) + deg; 6683 cache.skewX = skewX + deg; 6684 cache.skewY = skewY + deg; 6685 cache.transformPerspective = perspective + px; 6686 6687 if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || !uncache && cache.zOrigin || 0) { 6688 style[_transformOriginProp] = _firstTwoOnly(origin); 6689 } 6690 6691 cache.xOffset = cache.yOffset = 0; 6692 cache.force3D = _config.force3D; 6693 cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms; 6694 cache.uncache = 0; 6695 return cache; 6696}, 6697 _firstTwoOnly = function _firstTwoOnly(value) { 6698 return (value = value.split(" "))[0] + " " + value[1]; 6699}, 6700 //for handling transformOrigin values, stripping out the 3rd dimension 6701_addPxTranslate = function _addPxTranslate(target, start, value) { 6702 var unit = getUnit(start); 6703 return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit; 6704}, 6705 _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) { 6706 cache.z = "0px"; 6707 cache.rotationY = cache.rotationX = "0deg"; 6708 cache.force3D = 0; 6709 6710 _renderCSSTransforms(ratio, cache); 6711}, 6712 _zeroDeg = "0deg", 6713 _zeroPx = "0px", 6714 _endParenthesis = ") ", 6715 _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) { 6716 var _ref = cache || this, 6717 xPercent = _ref.xPercent, 6718 yPercent = _ref.yPercent, 6719 x = _ref.x, 6720 y = _ref.y, 6721 z = _ref.z, 6722 rotation = _ref.rotation, 6723 rotationY = _ref.rotationY, 6724 rotationX = _ref.rotationX, 6725 skewX = _ref.skewX, 6726 skewY = _ref.skewY, 6727 scaleX = _ref.scaleX, 6728 scaleY = _ref.scaleY, 6729 transformPerspective = _ref.transformPerspective, 6730 force3D = _ref.force3D, 6731 target = _ref.target, 6732 zOrigin = _ref.zOrigin, 6733 transforms = "", 6734 use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true; // Safari has a bug that causes it not to render 3D transform-origin values properly, so we force the z origin to 0, record it in the cache, and then do the math here to offset the translate values accordingly (basically do the 3D transform-origin part manually) 6735 6736 6737 if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) { 6738 var angle = parseFloat(rotationY) * _DEG2RAD, 6739 a13 = Math.sin(angle), 6740 a33 = Math.cos(angle), 6741 cos; 6742 6743 angle = parseFloat(rotationX) * _DEG2RAD; 6744 cos = Math.cos(angle); 6745 x = _addPxTranslate(target, x, a13 * cos * -zOrigin); 6746 y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin); 6747 z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin); 6748 } 6749 6750 if (transformPerspective !== _zeroPx) { 6751 transforms += "perspective(" + transformPerspective + _endParenthesis; 6752 } 6753 6754 if (xPercent || yPercent) { 6755 transforms += "translate(" + xPercent + "%, " + yPercent + "%) "; 6756 } 6757 6758 if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) { 6759 transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis; 6760 } 6761 6762 if (rotation !== _zeroDeg) { 6763 transforms += "rotate(" + rotation + _endParenthesis; 6764 } 6765 6766 if (rotationY !== _zeroDeg) { 6767 transforms += "rotateY(" + rotationY + _endParenthesis; 6768 } 6769 6770 if (rotationX !== _zeroDeg) { 6771 transforms += "rotateX(" + rotationX + _endParenthesis; 6772 } 6773 6774 if (skewX !== _zeroDeg || skewY !== _zeroDeg) { 6775 transforms += "skew(" + skewX + ", " + skewY + _endParenthesis; 6776 } 6777 6778 if (scaleX !== 1 || scaleY !== 1) { 6779 transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis; 6780 } 6781 6782 target.style[_transformProp] = transforms || "translate(0, 0)"; 6783}, 6784 _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) { 6785 var _ref2 = cache || this, 6786 xPercent = _ref2.xPercent, 6787 yPercent = _ref2.yPercent, 6788 x = _ref2.x, 6789 y = _ref2.y, 6790 rotation = _ref2.rotation, 6791 skewX = _ref2.skewX, 6792 skewY = _ref2.skewY, 6793 scaleX = _ref2.scaleX, 6794 scaleY = _ref2.scaleY, 6795 target = _ref2.target, 6796 xOrigin = _ref2.xOrigin, 6797 yOrigin = _ref2.yOrigin, 6798 xOffset = _ref2.xOffset, 6799 yOffset = _ref2.yOffset, 6800 forceCSS = _ref2.forceCSS, 6801 tx = parseFloat(x), 6802 ty = parseFloat(y), 6803 a11, 6804 a21, 6805 a12, 6806 a22, 6807 temp; 6808 6809 rotation = parseFloat(rotation); 6810 skewX = parseFloat(skewX); 6811 skewY = parseFloat(skewY); 6812 6813 if (skewY) { 6814 //for performance reasons, we combine all skewing into the skewX and rotation values. Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of 10 degrees. 6815 skewY = parseFloat(skewY); 6816 skewX += skewY; 6817 rotation += skewY; 6818 } 6819 6820 if (rotation || skewX) { 6821 rotation *= _DEG2RAD; 6822 skewX *= _DEG2RAD; 6823 a11 = Math.cos(rotation) * scaleX; 6824 a21 = Math.sin(rotation) * scaleX; 6825 a12 = Math.sin(rotation - skewX) * -scaleY; 6826 a22 = Math.cos(rotation - skewX) * scaleY; 6827 6828 if (skewX) { 6829 skewY *= _DEG2RAD; 6830 temp = Math.tan(skewX - skewY); 6831 temp = Math.sqrt(1 + temp * temp); 6832 a12 *= temp; 6833 a22 *= temp; 6834 6835 if (skewY) { 6836 temp = Math.tan(skewY); 6837 temp = Math.sqrt(1 + temp * temp); 6838 a11 *= temp; 6839 a21 *= temp; 6840 } 6841 } 6842 6843 a11 = _round(a11); 6844 a21 = _round(a21); 6845 a12 = _round(a12); 6846 a22 = _round(a22); 6847 } else { 6848 a11 = scaleX; 6849 a22 = scaleY; 6850 a21 = a12 = 0; 6851 } 6852 6853 if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) { 6854 tx = _convertToUnit(target, "x", x, "px"); 6855 ty = _convertToUnit(target, "y", y, "px"); 6856 } 6857 6858 if (xOrigin || yOrigin || xOffset || yOffset) { 6859 tx = _round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset); 6860 ty = _round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset); 6861 } 6862 6863 if (xPercent || yPercent) { 6864 //The SVG spec doesn't support percentage-based translation in the "transform" attribute, so we merge it into the translation to simulate it. 6865 temp = target.getBBox(); 6866 tx = _round(tx + xPercent / 100 * temp.width); 6867 ty = _round(ty + yPercent / 100 * temp.height); 6868 } 6869 6870 temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")"; 6871 target.setAttribute("transform", temp); 6872 forceCSS && (target.style[_transformProp] = temp); //some browsers prioritize CSS transforms over the transform attribute. When we sense that the user has CSS transforms applied, we must overwrite them this way (otherwise some browser simply won't render the transform attribute changes!) 6873}, 6874 _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue) { 6875 var cap = 360, 6876 isString = _isString(endValue), 6877 endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1), 6878 change = endNum - startNum, 6879 finalValue = startNum + change + "deg", 6880 direction, 6881 pt; 6882 6883 if (isString) { 6884 direction = endValue.split("_")[1]; 6885 6886 if (direction === "short") { 6887 change %= cap; 6888 6889 if (change !== change % (cap / 2)) { 6890 change += change < 0 ? cap : -cap; 6891 } 6892 } 6893 6894 if (direction === "cw" && change < 0) { 6895 change = (change + cap *
vendor: 2,887 bytes, lines 6895-6977
6895CSSPlugin_bigNum) % cap - ~~(change / cap) * cap; 6896 } else if (direction === "ccw" && change > 0) { 6897 change = (change - cap * CSSPlugin_bigNum) % cap - ~~(change / cap) * cap; 6898 } 6899 } 6900 6901 plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd); 6902 pt.e = finalValue; 6903 pt.u = "deg"; 6904 6905 plugin._props.push(property); 6906 6907 return pt; 6908}, 6909 _assign = function _assign(target, source) { 6910 // Internet Explorer doesn't have Object.assign(), so we recreate it here. 6911 for (var p in source) { 6912 target[p] = source[p]; 6913 } 6914 6915 return target; 6916}, 6917 _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) { 6918 //for handling cases where someone passes in a whole transform string, like transform: "scale(2, 3) rotate(20deg) translateY(30em)" 6919 var startCache = _assign({}, target._gsap), 6920 exclude = "perspective,force3D,transformOrigin,svgOrigin", 6921 style = target.style, 6922 endCache, 6923 p, 6924 startValue, 6925 endValue, 6926 startNum, 6927 endNum, 6928 startUnit, 6929 endUnit; 6930 6931 if (startCache.svg) { 6932 startValue = target.getAttribute("transform"); 6933 target.setAttribute("transform", ""); 6934 style[_transformProp] = transforms; 6935 endCache = _parseTransform(target, 1); 6936 6937 _removeProperty(target, _transformProp); 6938 6939 target.setAttribute("transform", startValue); 6940 } else { 6941 startValue = getComputedStyle(target)[_transformProp]; 6942 style[_transformProp] = transforms; 6943 endCache = _parseTransform(target, 1); 6944 style[_transformProp] = startValue; 6945 } 6946 6947 for (p in _transformProps) { 6948 startValue = startCache[p]; 6949 endValue = endCache[p]; 6950 6951 if (startValue !== endValue && exclude.indexOf(p) < 0) { 6952 //tweening to no perspective gives very unintuitive results - just keep the same perspective in that case. 6953 startUnit = getUnit(startValue); 6954 endUnit = getUnit(endValue); 6955 startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue); 6956 endNum = parseFloat(endValue); 6957 plugin._pt = new PropTween(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp); 6958 plugin._pt.u = endUnit || 0; 6959 6960 plugin._props.push(p); 6961 } 6962 } 6963 6964 _assign(endCache, startCache); 6965}; // handle splitting apart padding, margin, borderWidth, and borderRadius into their 4 components. Firefox, for example, won't report borderRadius correctly - it will only do borderTopLeftRadius and the other corners. We also want to handle paddingTop, marginLeft, borderRightWidth, etc. 6966 6967 6968_forEachName("padding,margin,Width,Radius", function (name, index) { 6969 var t = "Top", 6970 r = "Right", 6971 b = "Bottom", 6972 l = "Left", 6973 props = (index < 3 ? [t, r, b, l] : [t + l, t + r, b + r, b + l]).map(function (side) { 6974 return index < 2 ? name + side : "border" + side + name; 6975 }); 6976 6977 _specialProps[index >
vendor: 11,069 bytes, lines 6977-7225
6977 1 ? "border" + name : name] = function (plugin, target, property, endValue, tween) { 6978 var a, vars; 6979 6980 if (arguments.length < 4) { 6981 // getter, passed target, property, and unit (from _get()) 6982 a = props.map(function (prop) { 6983 return _get(plugin, prop, property); 6984 }); 6985 vars = a.join(" "); 6986 return vars.split(a[0]).length === 5 ? a[0] : vars; 6987 } 6988 6989 a = (endValue + "").split(" "); 6990 vars = {}; 6991 props.forEach(function (prop, i) { 6992 return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0]; 6993 }); 6994 plugin.init(target, vars, tween); 6995 }; 6996}); 6997 6998var CSSPlugin = { 6999 name: "css", 7000 register: _initCore, 7001 targetTest: function targetTest(target) { 7002 return target.style && target.nodeType; 7003 }, 7004 init: function init(target, vars, tween, index, targets) { 7005 var props = this._props, 7006 style = target.style, 7007 startAt = tween.vars.startAt, 7008 startValue, 7009 endValue, 7010 endNum, 7011 startNum, 7012 type, 7013 specialProp, 7014 p, 7015 startUnit, 7016 endUnit, 7017 relative, 7018 isTransformRelated, 7019 transformPropTween, 7020 cache, 7021 smooth, 7022 hasPriority, 7023 inlineProps; 7024 _pluginInitted || _initCore(); // we may call init() multiple times on the same plugin instance, like when adding special properties, so make sure we don't overwrite the revert data or inlineProps 7025 7026 this.styles = this.styles || _getStyleSaver(target); 7027 inlineProps = this.styles.props; 7028 this.tween = tween; 7029 7030 for (p in vars) { 7031 if (p === "autoRound") { 7032 continue; 7033 } 7034 7035 endValue = vars[p]; 7036 7037 if (_plugins[p] && _checkPlugin(p, vars, tween, index, target, targets)) { 7038 // plugins 7039 continue; 7040 } 7041 7042 type = typeof endValue; 7043 specialProp = _specialProps[p]; 7044 7045 if (type === "function") { 7046 endValue = endValue.call(tween, index, target, targets); 7047 type = typeof endValue; 7048 } 7049 7050 if (type === "string" && ~endValue.indexOf("random(")) { 7051 endValue = _replaceRandom(endValue); 7052 } 7053 7054 if (specialProp) { 7055 specialProp(this, target, p, endValue, tween) && (hasPriority = 1); 7056 } else if (p.substr(0, 2) === "--") { 7057 //CSS variable 7058 startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim(); 7059 endValue += ""; 7060 _colorExp.lastIndex = 0; 7061 7062 if (!_colorExp.test(startValue)) { 7063 // colors don't have units 7064 startUnit = getUnit(startValue); 7065 endUnit = getUnit(endValue); 7066 } 7067 7068 endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit); 7069 this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p); 7070 props.push(p); 7071 inlineProps.push(p, 0, style[p]); 7072 } else if (type !== "undefined") { 7073 if (startAt && p in startAt) { 7074 // in case someone hard-codes a complex value as the start, like top: "calc(2vh / 2)". Without this, it'd use the computed value (always in px) 7075 startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p]; 7076 _isString(startValue) && ~startValue.indexOf("random(") && (startValue = _replaceRandom(startValue)); 7077 getUnit(startValue + "") || startValue === "auto" || (startValue += _config.units[p] || getUnit(_get(target, p)) || ""); // for cases when someone passes in a unitless value like {x: 100}; if we try setting translate(100, 0px) it won't work. 7078 7079 (startValue + "").charAt(1) === "=" && (startValue = _get(target, p)); // can't work with relative values 7080 } else { 7081 startValue = _get(target, p); 7082 } 7083 7084 startNum = parseFloat(startValue); 7085 relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2); 7086 relative && (endValue = endValue.substr(2)); 7087 endNum = parseFloat(endValue); 7088 7089 if (p in _propertyAliases) { 7090 if (p === "autoAlpha") { 7091 //special case where we control the visibility along with opacity. We still allow the opacity value to pass through and get tweened. 7092 if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) { 7093 //if visibility is initially set to "hidden", we should interpret that as intent to make opacity 0 (a convenience) 7094 startNum = 0; 7095 } 7096 7097 inlineProps.push("visibility", 0, style.visibility); 7098 7099 _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum); 7100 } 7101 7102 if (p !== "scale" && p !== "transform") { 7103 p = _propertyAliases[p]; 7104 ~p.indexOf(",") && (p = p.split(",")[0]); 7105 } 7106 } 7107 7108 isTransformRelated = p in _transformProps; //--- TRANSFORM-RELATED --- 7109 7110 if (isTransformRelated) { 7111 this.styles.save(p); 7112 7113 if (!transformPropTween) { 7114 cache = target._gsap; 7115 cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform); // if, for example, gsap.set(... {transform:"translateX(50vw)"}), the _get() call doesn't parse the transform, thus cache.renderTransform won't be set yet so force the parsing of the transform here. 7116 7117 smooth = vars.smoothOrigin !== false && cache.smooth; 7118 transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1); //the first time through, create the rendering PropTween so that it runs LAST (in the linked list, we keep adding to the beginning) 7119 7120 transformPropTween.dep = 1; //flag it as dependent so that if things get killed/overwritten and this is the only PropTween left, we can safely kill the whole tween. 7121 } 7122 7123 if (p === "scale") { 7124 this._pt = new PropTween(this._pt, cache, "scaleY", cache.scaleY, (relative ? _parseRelative(cache.scaleY, relative + endNum) : endNum) - cache.scaleY || 0, _renderCSSProp); 7125 this._pt.u = 0; 7126 props.push("scaleY", p); 7127 p += "X"; 7128 } else if (p === "transformOrigin") { 7129 inlineProps.push(_transformOriginProp, 0, style[_transformOriginProp]); 7130 endValue = _convertKeywordsToPercentages(endValue); //in case something like "left top" or "bottom right" is passed in. Convert to percentages. 7131 7132 if (cache.svg) { 7133 _applySVGOrigin(target, endValue, 0, smooth, 0, this); 7134 } else { 7135 endUnit = parseFloat(endValue.split(" ")[2]) || 0; //handle the zOrigin separately! 7136 7137 endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit); 7138 7139 _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue)); 7140 } 7141 7142 continue; 7143 } else if (p === "svgOrigin") { 7144 _applySVGOrigin(target, endValue, 1, smooth, 0, this); 7145 7146 continue; 7147 } else if (p in _rotationalProperties) { 7148 _addRotationalPropTween(this, cache, p, startNum, relative ? _parseRelative(startNum, relative + endValue) : endValue); 7149 7150 continue; 7151 } else if (p === "smoothOrigin") { 7152 _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue); 7153 7154 continue; 7155 } else if (p === "force3D") { 7156 cache[p] = endValue; 7157 continue; 7158 } else if (p === "transform") { 7159 _addRawTransformPTs(this, endValue, target); 7160 7161 continue; 7162 } 7163 } else if (!(p in style)) { 7164 p = _checkPropPrefix(p) || p; 7165 } 7166 7167 if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) { 7168 startUnit = (startValue + "").substr((startNum + "").length); 7169 endNum || (endNum = 0); // protect against NaN 7170 7171 endUnit = getUnit(endValue) || (p in _config.units ? _config.units[p] : startUnit); 7172 startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit)); 7173 this._pt = new PropTween(this._pt, isTransformRelated ? cache : style, p, startNum, (relative ? _parseRelative(startNum, relative + endNum) : endNum) - startNum, !isTransformRelated && (endUnit === "px" || p === "zIndex") && vars.autoRound !== false ? _renderRoundedCSSProp : _renderCSSProp); 7174 this._pt.u = endUnit || 0; 7175 7176 if (startUnit !== endUnit && endUnit !== "%") { 7177 //when the tween goes all the way back to the beginning, we need to revert it to the OLD/ORIGINAL value (with those units). We record that as a "b" (beginning) property and point to a render method that handles that. (performance optimization) 7178 this._pt.b = startValue; 7179 this._pt.r = _renderCSSPropWithBeginning; 7180 } 7181 } else if (!(p in style)) { 7182 if (p in target) { 7183 //maybe it's not a style - it could be a property added directly to an element in which case we'll try to animate that. 7184 this.add(target, p, startValue || target[p], relative ? relative + endValue : endValue, index, targets); 7185 } else if (p !== "parseTransform") { 7186 _missingPlugin(p, endValue); 7187 7188 continue; 7189 } 7190 } else { 7191 _tweenComplexCSSString.call(this, target, p, startValue, relative ? relative + endValue : endValue); 7192 } 7193 7194 isTransformRelated || (p in style ? inlineProps.push(p, 0, style[p]) : inlineProps.push(p, 1, startValue || target[p])); 7195 props.push(p); 7196 } 7197 } 7198 7199 hasPriority && _sortPropTweensByPriority(this); 7200 }, 7201 render: function render(ratio, data) { 7202 if (data.tween._time || !CSSPlugin_reverting()) { 7203 var pt = data._pt; 7204 7205 while (pt) { 7206 pt.r(ratio, pt.d); 7207 pt = pt._next; 7208 } 7209 } else { 7210 data.styles.revert(); 7211 } 7212 }, 7213 get: _get, 7214 aliases: _propertyAliases, 7215 getSetter: function getSetter(target, property, plugin) { 7216 //returns a setter function that accepts target, property, value and applies it accordingly. Remember, properties like "x" aren't as simple as target.style.property = value because they've got to be applied to a proxy object and then merged into a transform string in a renderer. 7217 var p = _propertyAliases[property]; 7218 p && p.indexOf(",") < 0 && (property = p); 7219 return property in _transformProps && property !== _transformOriginProp && (target._gsap.x || _get(target, "x")) ? plugin && _recentSetterPlugin === plugin ? property === "scale" ? _setterScale : _setterTransform : (_recentSetterPlugin = plugin || {}) && (property === "scale" ? _setterScaleWithRender : _setterTransformWithRender) : target.style && !_isUndefined(target.style[property]) ? _setterCSSStyle : ~property.indexOf("-") ? _setterCSSProp : _getSetter(target, property); 7220 }, 7221 core: { 7222 _removeProperty: _removeProperty, 7223 _getMatrix: _getMatrix 7224 } 7225};
7226gsap.utils.checkPrefix = _checkPropPrefix; 7227gsap.core.getStyleSaver = _getStyleSaver; 7228 7229(function (positionAndScale, rotation, others, aliases) { 7230 var all = _forEachName(positionAndScale + "," + rotation + "," + others, function (name) { 7231 _transformProps[name] = 1; 7232 }); 7233 7234 _forEachName(rotation, function (name) { 7235 _config.units[name] = "deg"; 7236 _rotationalProperties[name] = 1; 7237 }); 7238 7239 _propertyAliases[all[13]] = positionAndScale + "," + rotation; 7240 7241 _forEachName(aliases, function (name) { 7242 var split = name.split(":"); 7243 _propertyAliases[split[1]] = all[split[0]]; 7244 }); 7245})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent", "rotation,rotationX,rotationY,skewX,skewY", "transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", "0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"); 7246 7247_forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function (name) { 7248 _config.units[name] = "px"; 7249}); 7250 7251gsap.registerPlugin(CSSPlugin); 7252 7253;// CONCATENATED MODULE: ./node_modules/gsap/index.js 7254 7255 7256var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap, 7257 // to protect from tree shaking 7258TweenMaxWithCSS = gsapWithCSS.core.Tween; 7259 7260;// CONCATENATED MODULE: ./src/scripts/components/Accordion.ts 7261 7262function Accordion() { 7263 const accordions = document.querySelectorAll(".holder-accordion"); 7264 accordions.forEach((element) => { 7265 const header = element.querySelector(".header"); 7266 const content = element.querySelector(".content"); 7267 const timeline = gsapWithCSS.timeline({ paused: true }); 7268 timeline.from(content, { height: 0 }); 7269 header.addEventListener("click", () => { 7270 const isActive = header.classList.contains("is-active"); 7271 header.classList.toggle("is-active"); 7272 if (isActive) { 7273 timeline.reverse(); 7274 } else { 7275 timeline.play(); 7276 } 7277 }); 7278 }); 7279} 7280 7281;// CONCATENATED MODULE: ./src/scripts/components/FileInputValidation.ts 7282function FileInputValidation() { 7283 if ("umbracoFormsValidationService" in window == false || getChildFileInputs(document).inputs.length === 0) { 7284 return; 7285 } 7286 const MAX_UPLOAD_LIMIT_MEGABYTES = 20; 7287 const maxUploadLimitBytes = MAX_UPLOAD_LIMIT_MEGABYTES * 1024 * 1024; 7288 const aspNetValidationService = window.umbracoFormsValidationService; 7289 InitFileInputValidation(); 7290 validateFileInputsOnPreviousBtnSubmit(); 7291 function InitFileInputValidation() { 7292 const fileInputs = getChildFileInputs(document); 7293 for (const input of fileInputs.inputs) { 7294 input.dataset.valUploadlimit = `You have exceeded the maximum file size of ${MAX_UPLOAD_LIMIT_MEGABYTES} MB for this form`; 7295 input.dataset.val = "true"; 7296 if (!input.dataset.valRequired) { 7297 input.removeAttribute("data-val-required"); 7298 } 7299 } 7300 aspNetValidationService.addProvider("uploadlimit", (_, element) => { 7301 const form = element.closest("form"); 7302 return validateFileInputs(form); 7303 }); 7304 aspNetValidationService.bootstrap(); 7305 } 7306 function validateFileInputsOnPreviousBtnSubmit() { 7307 document.addEventListener("submit", (event) => { 7308 var _a, _b, _c; 7309 const isSubmitterPreviousBtn = ((_b = (_a = event.submitter) == null ? void 0 : _a.dataset) == null ? void 0 : _b.formNavigate) === "prev"; 7310 const form = event.target; 7311 if (!isSubmitterPreviousBtn || validateFileInputs(form)) { 7312 return; 7313 } 7314 event.preventDefault(); 7315 const inputs = getChildFileInputs(form); 7316 for (const input of inputs.inputs) { 7317 aspNetValidationService.swapClasses( 7318 input, 7319 aspNetValidationService.ValidationInputCssClassName, 7320 aspNetValidationService.ValidationInputValidCssClassName 7321 ); 7322 } 7323 for (const errorEl of inputs.errorEls) { 7324 aspNetValidationService.swapClasses( 7325 errorEl, 7326 aspNetValidationService.ValidationMessageCssClassName, 7327 aspNetValidationService.ValidationMessageValidCssClassName 7328 );
7329 errorEl.textContent = (_c = inputs.inputs[0]) == null ? void 0 : _c.dataset.valUploadlimit; 7330 } 7331 }); 7332 } 7333 function getChildFileInputs(parentEl) { 7334 return { 7335 inputs: Array.from( 7336 parentEl.querySelectorAll("input[type=file]") 7337 ), 7338 errorEls: Array.from( 7339 parentEl.querySelectorAll( 7340 "input[type=file] + span" 7341 ) 7342 ) 7343 }; 7344 } 7345 function validateFileInputs(form) { 7346 const fileInputs = getChildFileInputs(form).inputs; 7347 if (fileInputs.length === 0) return true; 7348 const fileSizesInBytes = fileInputs.map((fileInput) => Array.from(fileInput.files)).flat().map((file) => file.size); 7349 const totalFileUploadSize = fileSizesInBytes.reduce((a, b) => a + b, 0); 7350 const hasExceededMaxUploadLimit = totalFileUploadSize > maxUploadLimitBytes; 7351 if (hasExceededMaxUploadLimit) return false; 7352 return true; 7353 } 7354} 7355 7356;// CONCATENATED MODULE: ./src/scripts/components/Modal.ts 7357let modal = null; 7358function getModal() { 7359 if (modal !== null) return modal; 7360 const modalBase = document.querySelector(".modal"); 7361 const modalCloseBtn = modalBase.querySelector(".modal-close-btn"); 7362 const modalContent = modalBase.querySelector(".modal-content"); 7363 modalCloseBtn.addEventListener("click", (event) => { 7364 hide(); 7365 }); 7366 modalBase.addEventListener("click", (event) => { 7367 if (event.target === event.currentTarget) { 7368 hide(); 7369 } 7370 }); 7371 function setContent(content) { 7372 modalContent.innerHTML = content; 7373 } 7374 function show() { 7375 modalBase.classList.add("active"); 7376 document.body.style.overflow = "hidden"; 7377 } 7378 function hide() { 7379 modalBase.classList.remove("active"); 7380 document.body.style.overflow = ""; 7381 modalContent.innerHTML = ""; 7382 } 7383 modal = { 7384 setContent, 7385 show, 7386 hide 7387 }; 7388 return modal; 7389} 7390 7391;// CONCATENATED MODULE: ./src/scripts/components/PeopleBlock.ts 7392var __async = (__this, __arguments, generator) => { 7393 return new Promise((resolve, reject) => { 7394 var fulfilled = (value) => { 7395 try { 7396 step(generator.next(value)); 7397 } catch (e) { 7398 reject(e); 7399 } 7400 }; 7401 var rejected = (value) => { 7402 try { 7403 step(generator.throw(value)); 7404 } catch (e) { 7405 reject(e); 7406 } 7407 }; 7408 var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); 7409 step((generator = generator.apply(__this, __arguments)).next()); 7410 }); 7411}; 7412const BLOCK_SELECTOR = ".holder-people"; 7413function PeopleBlock(modal) { 7414 initPersonClick(); 7415 function initPersonClick() { 7416 document.querySelectorAll(`${BLOCK_SELECTOR} [data-target]`).forEach((el) => { 7417 el.addEventListener("click", (event) => __async(this, null, function* () { 7418 try { 7419 const personId = el.dataset.target; 7420 const response = yield fetch( 7421 `/umbraco/surface/peoplesurface/getpersonmodal/${personId}` 7422 ); 7423 if (!response.ok) { 7424 throw new Error(); 7425 } 7426 const personHtml = yield response.text(); 7427 modal.setContent(personHtml); 7428 modal.show(); 7429 } catch (error) { 7430 } 7431 })); 7432 }); 7433 } 7434} 7435 7436;// CONCATENATED MODULE: ./src/scripts/components/Video.ts 7437function Video() { 7438 const tag = document.createElement("script"); 7439 tag.src = "https://www.youtube.com/player_api"; 7440 const firstScriptTag = document.getElementsByTagName("script")[0]; 7441 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 7442 window["onYouTubeIframeAPIReady"] = function() { 7443 const videos = document.querySelectorAll("div[data-youtube]"); 7444 videos.forEach((video) => { 7445 const id = video.id; 7446 const youTube = JSON.parse(video.getAttribute("data-youtube")); 7447 new YT.Player(id, { 7448 height: youTube.Height, 7449 width: youTube.Width, 7450 videoId: youTube.YouTubeEmbedId, 7451 playerVars: { 7452 autoplay: youTube.AutoPlay ? 1 : 0, 7453 controls: youTube.Controls ? 1 : 0, 7454 loop: youTube.Loop ? 1 : 0, 7455 mute: youTube.Mute ? 1 : 0 7456 } 7457 }); 7458 }); 7459 }; 7460} 7461 7462;// CONCATENATED MODULE: ./src/scripts/components/Vimeo.ts 7463function VimeoVideo() { 7464 const tag = document.createElement("script"); 7465 tag.src = "https://player.vimeo.com/api/player.js"; 7466 var firstScriptTag = document.getElementsByTagName("script")[0]; 7467 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 7468} 7469 7470// EXTERNAL MODULE: ./node_modules/in-viewport/in-viewport.js 7471var in_viewport = __webpack_require__(799); 7472var in_viewport_default = /*#__PURE__*/__webpack_require__.n(in_viewport); 7473;// CONCATENATED MODULE: ./src/scripts/components/CounterAnimation.ts 7474 7475const numberFormatter = new Intl.NumberFormat("en-GB"); 7476function CounterAnimation(elem) { 7477 const start = parseFloat(elem.getAttribute("data-start")); 7478 const end = parseFloat(elem.getAttribute("data-end")); 7479 const duration = parseFloat(elem.getAttribute("data-duration")) * 1e3; 7480 const enableCommaSeparator = elem.hasAttribute( 7481 "data-comma-separator" 7482 ); 7483 let startTimestamp = null; 7484 const step = (timestamp) => { 7485 if (!startTimestamp) { 7486 startTimestamp = timestamp; 7487 } 7488 const progress = Math.min((timestamp - startTimestamp) / duration, 1); 7489 const value = Math.floor(progress * (end - start) + start); 7490 elem.innerHTML = enableCommaSeparator ? numberFormatter.format(value) : value.toString(); 7491 if (progress < 1) { 7492 window.requestAnimationFrame(step); 7493 } 7494 }; 7495 in_viewport_default()(elem, () => { 7496 window.requestAnimationFrame(step); 7497 }); 7498} 7499 7500;// CONCATENATED MODULE: ./src/scripts/index.ts 7501 7502 7503 7504 7505 7506 7507 7508 7509document.addEventListener("DOMContentLoaded", () => { 7510 const modal = getModal(); 7511 FileInputValidation(); 7512 if (document.querySelector("div[data-youtube]")) { 7513 Video(); 7514 } 7515 if (document.querySelector("div[data-vimeo-url]")) { 7516 VimeoVideo(); 7517 } 7518 if (document.querySelector(".holder-accordion")) { 7519 Accordion(); 7520 } 7521 if (document.querySelector(".holder-people")) { 7522 PeopleBlock(modal); 7523 } 7524 if (document.querySelector(".cc-counter")) { 7525 document.querySelectorAll(".cc-counter").forEach((elem) => { 7526 CounterAnimation(elem); 7527 }); 7528 } 7529}); 7530 7531}(); 7532/******/ })() 7533;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.