vendor: 5,173 bytes, lines 1-152
1var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; 2 3var gsap = {exports: {}}; 4 5(function (module, exports) { 6 (function (global, factory) { 7 factory(exports) ; 8 })(commonjsGlobal, function (exports) { 9 10 function _inheritsLoose(subClass, superClass) { 11 subClass.prototype = Object.create(superClass.prototype); 12 subClass.prototype.constructor = subClass; 13 subClass.__proto__ = superClass; 14 } 15 function _assertThisInitialized(self) { 16 if (self === void 0) { 17 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 18 } 19 return self; 20 } 21 22 /*! 23 * GSAP 3.11.5 24 * https://greensock.com 25 * 26 * @license Copyright 2008-2023, GreenSock. All rights reserved. 27 * Subject to the terms at https://greensock.com/standard-license or for 28 * Club GreenSock members, the agreement issued with that membership. 29 * @author: Jack Doyle, [email protected] 30 */ 31 var _config = { 32 autoSleep: 120, 33 force3D: "auto", 34 nullTargetWarn: 1, 35 units: { 36 lineHeight: "" 37 } 38 }, 39 _defaults = { 40 duration: .5, 41 overwrite: false, 42 delay: 0 43 }, 44 _suppressOverwrites, 45 _reverting, 46 _context, 47 _bigNum = 1e8, 48 _tinyNum = 1 / _bigNum, 49 _2PI = Math.PI * 2, 50 _HALF_PI = _2PI / 4, 51 _gsID = 0, 52 _sqrt = Math.sqrt, 53 _cos = Math.cos, 54 _sin = Math.sin, 55 _isString = function _isString(value) { 56 return typeof value === "string"; 57 }, 58 _isFunction = function _isFunction(value) { 59 return typeof value === "function"; 60 }, 61 _isNumber = function _isNumber(value) { 62 return typeof value === "number"; 63 }, 64 _isUndefined = function _isUndefined(value) { 65 return typeof value === "undefined"; 66 }, 67 _isObject = function _isObject(value) { 68 return typeof value === "object"; 69 }, 70 _isNotFalse = function _isNotFalse(value) { 71 return value !== false; 72 }, 73 _windowExists = function _windowExists() { 74 return typeof window !== "undefined"; 75 }, 76 _isFuncOrString = function _isFuncOrString(value) { 77 return _isFunction(value) || _isString(value); 78 }, 79 _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function () {}, 80 _isArray = Array.isArray, 81 _strictNumExp = /(?:-?\.?\d|\.)+/gi, 82 _numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g, 83 _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g, 84 _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi, 85 _relExp = /[+-]=-?[.\d]+/, 86 _delimitedValueExp = /[^,'"\[\]\s]+/gi, 87 _unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i, 88 _globalTimeline, 89 _win, 90 _coreInitted, 91 _doc, 92 _globals = {}, 93 _installScope = {}, 94 _coreReady, 95 _install = function _install(scope) { 96 return (_installScope = _merge(scope, _globals)) && gsap; 97 }, 98 _missingPlugin = function _missingPlugin(property, value) { 99 return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()"); 100 }, 101 _warn = function _warn(message, suppress) { 102 return !suppress && console.warn(message); 103 }, 104 _addGlobal = function _addGlobal(name, obj) { 105 return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals; 106 }, 107 _emptyFunc = function _emptyFunc() { 108 return 0; 109 }, 110 _startAtRevertConfig = { 111 suppressEvents: true, 112 isStart: true, 113 kill: false 114 }, 115 _revertConfigNoKill = { 116 suppressEvents: true, 117 kill: false 118 }, 119 _revertConfig = { 120 suppressEvents: true 121 }, 122 _reservedProps = {}, 123 _lazyTweens = [], 124 _lazyLookup = {}, 125 _lastRenderedFrame, 126 _plugins = {}, 127 _effects = {}, 128 _nextGCFrame = 30, 129 _harnessPlugins = [], 130 _callbackNames = "", 131 _harness = function _harness(targets) { 132 var target = targets[0], 133 harnessPlugin, 134 i; 135 _isObject(target) || _isFunction(target) || (targets = [targets]); 136 if (!(harnessPlugin = (target._gsap || {}).harness)) { 137 i = _harnessPlugins.length; 138 while (i-- && !_harnessPlugins[i].targetTest(target)) {} 139 harnessPlugin = _harnessPlugins[i]; 140 } 141 i = targets.length; 142 while (i--) { 143 targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1); 144 } 145 return targets; 146 }, 147 _getCache = function _getCache(target) { 148 return target._gsap || _harness(toArray(target))[0]._gsap; 149 }, 150 _getProperty = function _getProperty(target, property, v) { 151 return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v; 152 },
vendor: 23,791 bytes, lines 153-699
153 _forEachName = function _forEachName(names, func) { 154 return (names = names.split(",")).forEach(func) || names; 155 }, 156 _round = function _round(value) { 157 return Math.round(value * 100000) / 100000 || 0; 158 }, 159 _roundPrecise = function _roundPrecise(value) { 160 return Math.round(value * 10000000) / 10000000 || 0; 161 }, 162 _parseRelative = function _parseRelative(start, value) { 163 var operator = value.charAt(0), 164 end = parseFloat(value.substr(2)); 165 start = parseFloat(start); 166 return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end; 167 }, 168 _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) { 169 var l = toFind.length, 170 i = 0; 171 for (; toSearch.indexOf(toFind[i]) < 0 && ++i < l;) {} 172 return i < l; 173 }, 174 _lazyRender = function _lazyRender() { 175 var l = _lazyTweens.length, 176 a = _lazyTweens.slice(0), 177 i, 178 tween; 179 _lazyLookup = {}; 180 _lazyTweens.length = 0; 181 for (i = 0; i < l; i++) { 182 tween = a[i]; 183 tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0); 184 } 185 }, 186 _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) { 187 _lazyTweens.length && !_reverting && _lazyRender(); 188 animation.render(time, suppressEvents, force || _reverting && time < 0 && (animation._initted || animation._startAt)); 189 _lazyTweens.length && !_reverting && _lazyRender(); 190 }, 191 _numericIfPossible = function _numericIfPossible(value) { 192 var n = parseFloat(value); 193 return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value; 194 }, 195 _passThrough = function _passThrough(p) { 196 return p; 197 }, 198 _setDefaults = function _setDefaults(obj, defaults) { 199 for (var p in defaults) { 200 p in obj || (obj[p] = defaults[p]); 201 } 202 return obj; 203 }, 204 _setKeyframeDefaults = function _setKeyframeDefaults(excludeDuration) { 205 return function (obj, defaults) { 206 for (var p in defaults) { 207 p in obj || p === "duration" && excludeDuration || p === "ease" || (obj[p] = defaults[p]); 208 } 209 }; 210 }, 211 _merge = function _merge(base, toMerge) { 212 for (var p in toMerge) { 213 base[p] = toMerge[p]; 214 } 215 return base; 216 }, 217 _mergeDeep = function _mergeDeep(base, toMerge) { 218 for (var p in toMerge) { 219 p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]); 220 } 221 return base; 222 }, 223 _copyExcluding = function _copyExcluding(obj, excluding) { 224 var copy = {}, 225 p; 226 for (p in obj) { 227 p in excluding || (copy[p] = obj[p]); 228 } 229 return copy; 230 }, 231 _inheritDefaults = function _inheritDefaults(vars) { 232 var parent = vars.parent || _globalTimeline, 233 func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults; 234 if (_isNotFalse(vars.inherit)) { 235 while (parent) { 236 func(vars, parent.vars.defaults); 237 parent = parent.parent || parent._dp; 238 } 239 } 240 return vars; 241 }, 242 _arraysMatch = function _arraysMatch(a1, a2) { 243 var i = a1.length, 244 match = i === a2.length; 245 while (match && i-- && a1[i] === a2[i]) {} 246 return i < 0; 247 }, 248 _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) { 249 if (firstProp === void 0) { 250 firstProp = "_first"; 251 } 252 if (lastProp === void 0) { 253 lastProp = "_last"; 254 } 255 var prev = parent[lastProp], 256 t; 257 if (sortBy) { 258 t = child[sortBy]; 259 while (prev && prev[sortBy] > t) { 260 prev = prev._prev; 261 } 262 } 263 if (prev) { 264 child._next = prev._next; 265 prev._next = child; 266 } else { 267 child._next = parent[firstProp]; 268 parent[firstProp] = child; 269 } 270 if (child._next) { 271 child._next._prev = child; 272 } else { 273 parent[lastProp] = child; 274 } 275 child._prev = prev; 276 child.parent = child._dp = parent; 277 return child; 278 }, 279 _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) { 280 if (firstProp === void 0) { 281 firstProp = "_first"; 282 } 283 if (lastProp === void 0) { 284 lastProp = "_last"; 285 } 286 var prev = child._prev, 287 next = child._next; 288 if (prev) { 289 prev._next = next; 290 } else if (parent[firstProp] === child) { 291 parent[firstProp] = next; 292 } 293 if (next) { 294 next._prev = prev; 295 } else if (parent[lastProp] === child) { 296 parent[lastProp] = prev; 297 } 298 child._next = child._prev = child.parent = null; 299 }, 300 _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) { 301 child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove(child); 302 child._act = 0; 303 }, 304 _uncache = function _uncache(animation, child) { 305 if (animation && (!child || child._end > animation._dur || child._start < 0)) { 306 var a = animation; 307 while (a) { 308 a._dirty = 1; 309 a = a.parent; 310 } 311 } 312 return animation; 313 }, 314 _recacheAncestors = function _recacheAncestors(animation) { 315 var parent = animation.parent; 316 while (parent && parent.parent) { 317 parent._dirty = 1; 318 parent.totalDuration(); 319 parent = parent.parent; 320 } 321 return animation; 322 }, 323 _rewindStartAt = function _rewindStartAt(tween, totalTime, suppressEvents, force) { 324 return tween._startAt && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween.vars.immediateRender && !tween.vars.autoRevert || tween._startAt.render(totalTime, true, force)); 325 }, 326 _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) { 327 return !animation || animation._ts && _hasNoPausedAncestors(animation.parent); 328 }, 329 _elapsedCycleDuration = function _elapsedCycleDuration(animation) { 330 return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0; 331 }, 332 _animationCycle = function _animationCycle(tTime, cycleDuration) { 333 var whole = Math.floor(tTime /= cycleDuration); 334 return tTime && whole === tTime ? whole - 1 : whole; 335 }, 336 _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) { 337 return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur); 338 }, 339 _setEnd = function _setEnd(animation) { 340 return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0)); 341 }, 342 _alignPlayhead = function _alignPlayhead(animation, totalTime) { 343 var parent = animation._dp; 344 if (parent && parent.smoothChildTiming && animation._ts) { 345 animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts)); 346 _setEnd(animation); 347 parent._dirty || _uncache(parent, animation); 348 } 349 return animation; 350 }, 351 _postAddChecks = function _postAddChecks(timeline, child) { 352 var t; 353 if (child._time || child._initted && !child._dur) { 354 t = _parentToChildTotalTime(timeline.rawTime(), child); 355 if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) { 356 child.render(t, true); 357 } 358 } 359 if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) { 360 if (timeline._dur < timeline.duration()) { 361 t = timeline; 362 while (t._dp) { 363 t.rawTime() >= 0 && t.totalTime(t._tTime); 364 t = t._dp; 365 } 366 } 367 timeline._zTime = -_tinyNum; 368 } 369 }, 370 _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) { 371 child.parent && _removeFromParent(child); 372 child._start = _roundPrecise((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay); 373 child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0)); 374 _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0); 375 _isFromOrFromStart(child) || (timeline._recent = child); 376 skipChecks || _postAddChecks(timeline, child); 377 timeline._ts < 0 && _alignPlayhead(timeline, timeline._tTime); 378 return timeline; 379 }, 380 _scrollTrigger = function _scrollTrigger(animation, trigger) { 381 return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation); 382 }, 383 _attemptInitTween = function _attemptInitTween(tween, time, force, suppressEvents, tTime) { 384 _initTween(tween, time, tTime); 385 if (!tween._initted) { 386 return 1; 387 } 388 if (!force && tween._pt && !_reverting && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) { 389 _lazyTweens.push(tween); 390 tween._lazy = [tTime, suppressEvents]; 391 return 1; 392 } 393 }, 394 _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) { 395 var parent = _ref.parent; 396 return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent)); 397 }, 398 _isFromOrFromStart = function _isFromOrFromStart(_ref2) { 399 var data = _ref2.data; 400 return data === "isFromStart" || data === "isStart"; 401 }, 402 _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) { 403 var prevRatio = tween.ratio, 404 ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1, 405 repeatDelay = tween._rDelay, 406 tTime = 0, 407 pt, 408 iteration, 409 prevIteration; 410 if (repeatDelay && tween._repeat) { 411 tTime = _clamp(0, tween._tDur, totalTime); 412 iteration = _animationCycle(tTime, repeatDelay); 413 tween._yoyo && iteration & 1 && (ratio = 1 - ratio); 414 if (iteration !== _animationCycle(tween._tTime, repeatDelay)) { 415 prevRatio = 1 - ratio; 416 tween.vars.repeatRefresh && tween._initted && tween.invalidate(); 417 } 418 } 419 if (ratio !== prevRatio || _reverting || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) { 420 if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents, tTime)) { 421 return; 422 } 423 prevIteration = tween._zTime; 424 tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0); 425 suppressEvents || (suppressEvents = totalTime && !prevIteration); 426 tween.ratio = ratio; 427 tween._from && (ratio = 1 - ratio); 428 tween._time = 0; 429 tween._tTime = tTime; 430 pt = tween._pt; 431 while (pt) { 432 pt.r(ratio, pt.d); 433 pt = pt._next; 434 } 435 totalTime < 0 && _rewindStartAt(tween, totalTime, suppressEvents, true); 436 tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate"); 437 tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat"); 438 if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) { 439 ratio && _removeFromParent(tween, 1); 440 if (!suppressEvents && !_reverting) { 441 _callback(tween, ratio ? "onComplete" : "onReverseComplete", true); 442 tween._prom && tween._prom(); 443 } 444 } 445 } else if (!tween._zTime) { 446 tween._zTime = totalTime; 447 } 448 }, 449 _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) { 450 var child; 451 if (time > prevTime) { 452 child = animation._first; 453 while (child && child._start <= time) { 454 if (child.data === "isPause" && child._start > prevTime) { 455 return child; 456 } 457 child = child._next; 458 } 459 } else { 460 child = animation._last; 461 while (child && child._start >= time) { 462 if (child.data === "isPause" && child._start < prevTime) { 463 return child; 464 } 465 child = child._prev; 466 } 467 } 468 }, 469 _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) { 470 var repeat = animation._repeat, 471 dur = _roundPrecise(duration) || 0, 472 totalProgress = animation._tTime / animation._tDur; 473 totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur); 474 animation._dur = dur; 475 animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat); 476 totalProgress > 0 && !leavePlayhead && _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress); 477 animation.parent && _setEnd(animation); 478 skipUncache || _uncache(animation.parent, animation); 479 return animation; 480 }, 481 _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) { 482 return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur); 483 }, 484 _zeroPosition = { 485 _start: 0, 486 endTime: _emptyFunc, 487 totalDuration: _emptyFunc 488 }, 489 _parsePosition = function _parsePosition(animation, position, percentAnimation) { 490 var labels = animation.labels, 491 recent = animation._recent || _zeroPosition, 492 clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur, 493 i, 494 offset, 495 isPercent; 496 if (_isString(position) && (isNaN(position) || position in labels)) { 497 offset = position.charAt(0); 498 isPercent = position.substr(-1) === "%"; 499 i = position.indexOf("="); 500 if (offset === "<" || offset === ">") { 501 i >= 0 && (position = position.replace(/=/, "")); 502 return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1); 503 } 504 if (i < 0) { 505 position in labels || (labels[position] = clippedDuration); 506 return labels[position]; 507 } 508 offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1)); 509 if (isPercent && percentAnimation) { 510 offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration(); 511 } 512 return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset; 513 } 514 return position == null ? clippedDuration : +position; 515 }, 516 _createTweenType = function _createTweenType(type, params, timeline) { 517 var isLegacy = _isNumber(params[1]), 518 varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1), 519 vars = params[varsIndex], 520 irVars, 521 parent; 522 isLegacy && (vars.duration = params[1]); 523 vars.parent = timeline; 524 if (type) { 525 irVars = vars; 526 parent = timeline; 527 while (parent && !("immediateRender" in irVars)) { 528 irVars = parent.vars.defaults || {}; 529 parent = _isNotFalse(parent.vars.inherit) && parent.parent; 530 } 531 vars.immediateRender = _isNotFalse(irVars.immediateRender); 532 type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1]; 533 } 534 return new Tween(params[0], vars, params[varsIndex + 1]); 535 }, 536 _conditionalReturn = function _conditionalReturn(value, func) { 537 return value || value === 0 ? func(value) : func; 538 }, 539 _clamp = function _clamp(min, max, value) { 540 return value < min ? min : value > max ? max : value; 541 }, 542 getUnit = function getUnit(value, v) { 543 return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1]; 544 }, 545 clamp = function clamp(min, max, value) { 546 return _conditionalReturn(value, function (v) { 547 return _clamp(min, max, v); 548 }); 549 }, 550 _slice = [].slice, 551 _isArrayLike = function _isArrayLike(value, nonEmpty) { 552 return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win; 553 }, 554 _flatten = function _flatten(ar, leaveStrings, accumulator) { 555 if (accumulator === void 0) { 556 accumulator = []; 557 } 558 return ar.forEach(function (value) { 559 var _accumulator; 560 return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value); 561 }) || accumulator; 562 }, 563 toArray = function toArray(value, scope, leaveStrings) { 564 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] : []; 565 }, 566 selector = function selector(value) { 567 value = toArray(value)[0] || _warn("Invalid scope") || {}; 568 return function (v) { 569 var el = value.current || value.nativeElement || value; 570 return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value); 571 }; 572 }, 573 shuffle = function shuffle(a) { 574 return a.sort(function () { 575 return .5 - Math.random(); 576 }); 577 }, 578 distribute = function distribute(v) { 579 if (_isFunction(v)) { 580 return v; 581 } 582 var vars = _isObject(v) ? v : { 583 each: v 584 }, 585 ease = _parseEase(vars.ease), 586 from = vars.from || 0, 587 base = parseFloat(vars.base) || 0, 588 cache = {}, 589 isDecimal = from > 0 && from < 1, 590 ratios = isNaN(from) || isDecimal, 591 axis = vars.axis, 592 ratioX = from, 593 ratioY = from; 594 if (_isString(from)) { 595 ratioX = ratioY = { 596 center: .5, 597 edges: .5, 598 end: 1 599 }[from] || 0; 600 } else if (!isDecimal && ratios) { 601 ratioX = from[0]; 602 ratioY = from[1]; 603 } 604 return function (i, target, a) { 605 var l = (a || vars).length, 606 distances = cache[l], 607 originX, 608 originY, 609 x, 610 y, 611 d, 612 j, 613 max, 614 min, 615 wrapAt; 616 if (!distances) { 617 wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1]; 618 if (!wrapAt) { 619 max = -_bigNum; 620 while (max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l) {} 621 wrapAt--; 622 } 623 distances = cache[l] = []; 624 originX = ratios ? Math.min(wrapAt, l) * ratioX - .5 : from % wrapAt; 625 originY = wrapAt === _bigNum ? 0 : ratios ? l * ratioY / wrapAt - .5 : from / wrapAt | 0; 626 max = 0; 627 min = _bigNum; 628 for (j = 0; j < l; j++) { 629 x = j % wrapAt - originX; 630 y = originY - (j / wrapAt | 0); 631 distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x); 632 d > max && (max = d); 633 d < min && (min = d); 634 } 635 from === "random" && shuffle(distances); 636 distances.max = max - min; 637 distances.min = min; 638 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); 639 distances.b = l < 0 ? base - l : base; 640 distances.u = getUnit(vars.amount || vars.each) || 0; 641 ease = ease && l < 0 ? _invertEase(ease) : ease; 642 } 643 l = (distances[i] - distances.min) / distances.max || 0; 644 return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u; 645 }; 646 }, 647 _roundModifier = function _roundModifier(v) { 648 var p = Math.pow(10, ((v + "").split(".")[1] || "").length); 649 return function (raw) { 650 var n = _roundPrecise(Math.round(parseFloat(raw) / v) * v * p); 651 return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw)); 652 }; 653 }, 654 snap = function snap(snapTo, value) { 655 var isArray = _isArray(snapTo), 656 radius, 657 is2D; 658 if (!isArray && _isObject(snapTo)) { 659 radius = isArray = snapTo.radius || _bigNum; 660 if (snapTo.values) { 661 snapTo = toArray(snapTo.values); 662 if (is2D = !_isNumber(snapTo[0])) { 663 radius *= radius; 664 } 665 } else { 666 snapTo = _roundModifier(snapTo.increment); 667 } 668 } 669 return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function (raw) { 670 is2D = snapTo(raw); 671 return Math.abs(is2D - raw) <= radius ? is2D : raw; 672 } : function (raw) { 673 var x = parseFloat(is2D ? raw.x : raw), 674 y = parseFloat(is2D ? raw.y : 0), 675 min = _bigNum, 676 closest = 0, 677 i = snapTo.length, 678 dx, 679 dy; 680 while (i--) { 681 if (is2D) { 682 dx = snapTo[i].x - x; 683 dy = snapTo[i].y - y; 684 dx = dx * dx + dy * dy; 685 } else { 686 dx = Math.abs(snapTo[i] - x); 687 } 688 if (dx < min) { 689 min = dx; 690 closest = i; 691 } 692 } 693 closest = !radius || min <= radius ? snapTo[closest] : raw; 694 return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw); 695 }); 696 }, 697 random = function random(min, max, roundingIncrement, returnFunction) { 698 return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function () { 699 return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e
vendor: 5,359 bytes, lines 699-843
699-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; 700 }); 701 }, 702 pipe = function pipe() { 703 for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) { 704 functions[_key] = arguments[_key]; 705 } 706 return function (value) { 707 return functions.reduce(function (v, f) { 708 return f(v); 709 }, value); 710 }; 711 }, 712 unitize = function unitize(func, unit) { 713 return function (value) { 714 return func(parseFloat(value)) + (unit || getUnit(value)); 715 }; 716 }, 717 normalize = function normalize(min, max, value) { 718 return mapRange(min, max, 0, 1, value); 719 }, 720 _wrapArray = function _wrapArray(a, wrapper, value) { 721 return _conditionalReturn(value, function (index) { 722 return a[~~wrapper(index)]; 723 }); 724 }, 725 wrap = function wrap(min, max, value) { 726 var range = max - min; 727 return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function (value) { 728 return (range + (value - min) % range) % range + min; 729 }); 730 }, 731 wrapYoyo = function wrapYoyo(min, max, value) { 732 var range = max - min, 733 total = range * 2; 734 return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function (value) { 735 value = (total + (value - min) % total) % total || 0; 736 return min + (value > range ? total - value : value); 737 }); 738 }, 739 _replaceRandom = function _replaceRandom(value) { 740 var prev = 0, 741 s = "", 742 i, 743 nums, 744 end, 745 isArray; 746 while (~(i = value.indexOf("random(", prev))) { 747 end = value.indexOf(")", i); 748 isArray = value.charAt(i + 7) === "["; 749 nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp); 750 s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5); 751 prev = end + 1; 752 } 753 return s + value.substr(prev, value.length - prev); 754 }, 755 mapRange = function mapRange(inMin, inMax, outMin, outMax, value) { 756 var inRange = inMax - inMin, 757 outRange = outMax - outMin; 758 return _conditionalReturn(value, function (value) { 759 return outMin + ((value - inMin) / inRange * outRange || 0); 760 }); 761 }, 762 interpolate = function interpolate(start, end, progress, mutate) { 763 var func = isNaN(start + end) ? 0 : function (p) { 764 return (1 - p) * start + p * end; 765 }; 766 if (!func) { 767 var isString = _isString(start), 768 master = {}, 769 p, 770 i, 771 interpolators, 772 l, 773 il; 774 progress === true && (mutate = 1) && (progress = null); 775 if (isString) { 776 start = { 777 p: start 778 }; 779 end = { 780 p: end 781 }; 782 } else if (_isArray(start) && !_isArray(end)) { 783 interpolators = []; 784 l = start.length; 785 il = l - 2; 786 for (i = 1; i < l; i++) { 787 interpolators.push(interpolate(start[i - 1], start[i])); 788 } 789 l--; 790 func = function func(p) { 791 p *= l; 792 var i = Math.min(il, ~~p); 793 return interpolators[i](p - i); 794 }; 795 progress = end; 796 } else if (!mutate) { 797 start = _merge(_isArray(start) ? [] : {}, start); 798 } 799 if (!interpolators) { 800 for (p in end) { 801 _addPropTween.call(master, start, p, "get", end[p]); 802 } 803 func = function func(p) { 804 return _renderPropTweens(p, master) || (isString ? start.p : start); 805 }; 806 } 807 } 808 return _conditionalReturn(progress, func); 809 }, 810 _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) { 811 var labels = timeline.labels, 812 min = _bigNum, 813 p, 814 distance, 815 label; 816 for (p in labels) { 817 distance = labels[p] - fromTime; 818 if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) { 819 label = p; 820 min = distance; 821 } 822 } 823 return label; 824 }, 825 _callback = function _callback(animation, type, executeLazyFirst) { 826 var v = animation.vars, 827 callback = v[type], 828 prevContext = _context, 829 context = animation._ctx, 830 params, 831 scope, 832 result; 833 if (!callback) { 834 return; 835 } 836 params = v[type + "Params"]; 837 scope = v.callbackScope || animation; 838 executeLazyFirst && _lazyTweens.length && _lazyRender(); 839 context && (_context = context); 840 result = params ? callback.apply(scope, params) : callback.call(scope); 841 _context = prevContext; 842 return result; 843 },
vendor: 18,481 bytes, lines 844-1349
844 _interrupt = function _interrupt(animation) { 845 _removeFromParent(animation); 846 animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting); 847 animation.progress() < 1 && _callback(animation, "onInterrupt"); 848 return animation; 849 }, 850 _quickTween, 851 _registerPluginQueue = [], 852 _createPlugin = function _createPlugin(config) { 853 if (!_windowExists()) { 854 _registerPluginQueue.push(config); 855 return; 856 } 857 config = !config.name && config["default"] || config; 858 var name = config.name, 859 isFunc = _isFunction(config), 860 Plugin = name && !isFunc && config.init ? function () { 861 this._props = []; 862 } : config, 863 instanceDefaults = { 864 init: _emptyFunc, 865 render: _renderPropTweens, 866 add: _addPropTween, 867 kill: _killPropTweensOf, 868 modifier: _addPluginModifier, 869 rawVars: 0 870 }, 871 statics = { 872 targetTest: 0, 873 get: 0, 874 getSetter: _getSetter, 875 aliases: {}, 876 register: 0 877 }; 878 _wake(); 879 if (config !== Plugin) { 880 if (_plugins[name]) { 881 return; 882 } 883 _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics)); 884 _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics))); 885 _plugins[Plugin.prop = name] = Plugin; 886 if (config.targetTest) { 887 _harnessPlugins.push(Plugin); 888 _reservedProps[name] = 1; 889 } 890 name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin"; 891 } 892 _addGlobal(name, Plugin); 893 config.register && config.register(gsap, Plugin, PropTween); 894 }, 895 _255 = 255, 896 _colorLookup = { 897 aqua: [0, _255, _255], 898 lime: [0, _255, 0], 899 silver: [192, 192, 192], 900 black: [0, 0, 0], 901 maroon: [128, 0, 0], 902 teal: [0, 128, 128], 903 blue: [0, 0, _255], 904 navy: [0, 0, 128], 905 white: [_255, _255, _255], 906 olive: [128, 128, 0], 907 yellow: [_255, _255, 0], 908 orange: [_255, 165, 0], 909 gray: [128, 128, 128], 910 purple: [128, 0, 128], 911 green: [0, 128, 0], 912 red: [_255, 0, 0], 913 pink: [_255, 192, 203], 914 cyan: [0, _255, _255], 915 transparent: [_255, _255, _255, 0] 916 }, 917 _hue = function _hue(h, m1, m2) { 918 h += h < 0 ? 1 : h > 1 ? -1 : 0; 919 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; 920 }, 921 splitColor = function splitColor(v, toHSL, forceAlpha) { 922 var a = !v ? _colorLookup.black : _isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255] : 0, 923 r, 924 g, 925 b, 926 h, 927 s, 928 l, 929 max, 930 min, 931 d, 932 wasHSL; 933 if (!a) { 934 if (v.substr(-1) === ",") { 935 v = v.substr(0, v.length - 1); 936 } 937 if (_colorLookup[v]) { 938 a = _colorLookup[v]; 939 } else if (v.charAt(0) === "#") { 940 if (v.length < 6) { 941 r = v.charAt(1); 942 g = v.charAt(2); 943 b = v.charAt(3); 944 v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : ""); 945 } 946 if (v.length === 9) { 947 a = parseInt(v.substr(1, 6), 16); 948 return [a >> 16, a >> 8 & _255, a & _255, parseInt(v.substr(7), 16) / 255]; 949 } 950 v = parseInt(v.substr(1), 16); 951 a = [v >> 16, v >> 8 & _255, v & _255]; 952 } else if (v.substr(0, 3) === "hsl") { 953 a = wasHSL = v.match(_strictNumExp); 954 if (!toHSL) { 955 h = +a[0] % 360 / 360; 956 s = +a[1] / 100; 957 l = +a[2] / 100; 958 g = l <= .5 ? l * (s + 1) : l + s - l * s; 959 r = l * 2 - g; 960 a.length > 3 && (a[3] *= 1); 961 a[0] = _hue(h + 1 / 3, r, g); 962 a[1] = _hue(h, r, g); 963 a[2] = _hue(h - 1 / 3, r, g); 964 } else if (~v.indexOf("=")) { 965 a = v.match(_numExp); 966 forceAlpha && a.length < 4 && (a[3] = 1); 967 return a; 968 } 969 } else { 970 a = v.match(_strictNumExp) || _colorLookup.transparent; 971 } 972 a = a.map(Number); 973 } 974 if (toHSL && !wasHSL) { 975 r = a[0] / _255; 976 g = a[1] / _255; 977 b = a[2] / _255; 978 max = Math.max(r, g, b); 979 min = Math.min(r, g, b); 980 l = (max + min) / 2; 981 if (max === min) { 982 h = s = 0; 983 } else { 984 d = max - min; 985 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 986 h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4; 987 h *= 60; 988 } 989 a[0] = ~~(h + .5); 990 a[1] = ~~(s * 100 + .5); 991 a[2] = ~~(l * 100 + .5); 992 } 993 forceAlpha && a.length < 4 && (a[3] = 1); 994 return a; 995 }, 996 _colorOrderData = function _colorOrderData(v) { 997 var values = [], 998 c = [], 999 i = -1; 1000 v.split(_colorExp).forEach(function (v) { 1001 var a = v.match(_numWithUnitExp) || []; 1002 values.push.apply(values, a); 1003 c.push(i += a.length + 1); 1004 }); 1005 values.c = c; 1006 return values; 1007 }, 1008 _formatColors = function _formatColors(s, toHSL, orderMatchData) { 1009 var result = "", 1010 colors = (s + result).match(_colorExp), 1011 type = toHSL ? "hsla(" : "rgba(", 1012 i = 0, 1013 c, 1014 shell, 1015 d, 1016 l; 1017 if (!colors) { 1018 return s; 1019 } 1020 colors = colors.map(function (color) { 1021 return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")"; 1022 }); 1023 if (orderMatchData) { 1024 d = _colorOrderData(s); 1025 c = orderMatchData.c; 1026 if (c.join(result) !== d.c.join(result)) { 1027 shell = s.replace(_colorExp, "1").split(_numWithUnitExp); 1028 l = shell.length - 1; 1029 for (; i < l; i++) { 1030 result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift()); 1031 } 1032 } 1033 } 1034 if (!shell) { 1035 shell = s.split(_colorExp); 1036 l = shell.length - 1; 1037 for (; i < l; i++) { 1038 result += shell[i] + colors[i]; 1039 } 1040 } 1041 return result + shell[l]; 1042 }, 1043 _colorExp = function () { 1044 var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b", 1045 p; 1046 for (p in _colorLookup) { 1047 s += "|" + p + "\\b"; 1048 } 1049 return new RegExp(s + ")", "gi"); 1050 }(), 1051 _hslExp = /hsl[a]?\(/, 1052 _colorStringFilter = function _colorStringFilter(a) { 1053 var combined = a.join(" "), 1054 toHSL; 1055 _colorExp.lastIndex = 0; 1056 if (_colorExp.test(combined)) { 1057 toHSL = _hslExp.test(combined); 1058 a[1] = _formatColors(a[1], toHSL); 1059 a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1])); 1060 return true; 1061 } 1062 }, 1063 _tickerActive, 1064 _ticker = function () { 1065 var _getTime = Date.now, 1066 _lagThreshold = 500, 1067 _adjustedLag = 33, 1068 _startTime = _getTime(), 1069 _lastUpdate = _startTime, 1070 _gap = 1000 / 240, 1071 _nextTime = _gap, 1072 _listeners = [], 1073 _id, 1074 _req, 1075 _raf, 1076 _self, 1077 _delta, 1078 _i, 1079 _tick = function _tick(v) { 1080 var elapsed = _getTime() - _lastUpdate, 1081 manual = v === true, 1082 overlap, 1083 dispatch, 1084 time, 1085 frame; 1086 elapsed > _lagThreshold && (_startTime += elapsed - _adjustedLag); 1087 _lastUpdate += elapsed; 1088 time = _lastUpdate - _startTime; 1089 overlap = time - _nextTime; 1090 if (overlap > 0 || manual) { 1091 frame = ++_self.frame; 1092 _delta = time - _self.time * 1000; 1093 _self.time = time = time / 1000; 1094 _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap); 1095 dispatch = 1; 1096 } 1097 manual || (_id = _req(_tick)); 1098 if (dispatch) { 1099 for (_i = 0; _i < _listeners.length; _i++) { 1100 _listeners[_i](time, _delta, frame, v); 1101 } 1102 } 1103 }; 1104 _self = { 1105 time: 0, 1106 frame: 0, 1107 tick: function tick() { 1108 _tick(true); 1109 }, 1110 deltaRatio: function deltaRatio(fps) { 1111 return _delta / (1000 / (fps || 60)); 1112 }, 1113 wake: function wake() { 1114 if (_coreReady) { 1115 if (!_coreInitted && _windowExists()) { 1116 _win = _coreInitted = window; 1117 _doc = _win.document || {}; 1118 _globals.gsap = gsap; 1119 (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version); 1120 _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {}); 1121 _raf = _win.requestAnimationFrame; 1122 _registerPluginQueue.forEach(_createPlugin); 1123 } 1124 _id && _self.sleep(); 1125 _req = _raf || function (f) { 1126 return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0); 1127 }; 1128 _tickerActive = 1; 1129 _tick(2); 1130 } 1131 }, 1132 sleep: function sleep() { 1133 (_raf ? _win.cancelAnimationFrame : clearTimeout)(_id); 1134 _tickerActive = 0; 1135 _req = _emptyFunc; 1136 }, 1137 lagSmoothing: function lagSmoothing(threshold, adjustedLag) { 1138 _lagThreshold = threshold || Infinity; 1139 _adjustedLag = Math.min(adjustedLag || 33, _lagThreshold); 1140 }, 1141 fps: function fps(_fps) { 1142 _gap = 1000 / (_fps || 240); 1143 _nextTime = _self.time * 1000 + _gap; 1144 }, 1145 add: function add(callback, once, prioritize) { 1146 var func = once ? function (t, d, f, v) { 1147 callback(t, d, f, v); 1148 _self.remove(func); 1149 } : callback; 1150 _self.remove(callback); 1151 _listeners[prioritize ? "unshift" : "push"](func); 1152 _wake(); 1153 return func; 1154 }, 1155 remove: function remove(callback, i) { 1156 ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--; 1157 }, 1158 _listeners: _listeners 1159 }; 1160 return _self; 1161 }(), 1162 _wake = function _wake() { 1163 return !_tickerActive && _ticker.wake(); 1164 }, 1165 _easeMap = {}, 1166 _customEaseExp = /^[\d.\-M][\d.\-,\s]/, 1167 _quotesExp = /["']/g, 1168 _parseObjectInString = function _parseObjectInString(value) { 1169 var obj = {}, 1170 split = value.substr(1, value.length - 3).split(":"), 1171 key = split[0], 1172 i = 1, 1173 l = split.length, 1174 index, 1175 val, 1176 parsedVal; 1177 for (; i < l; i++) { 1178 val = split[i]; 1179 index = i !== l - 1 ? val.lastIndexOf(",") : val.length; 1180 parsedVal = val.substr(0, index); 1181 obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal; 1182 key = val.substr(index + 1).trim(); 1183 } 1184 return obj; 1185 }, 1186 _valueInParentheses = function _valueInParentheses(value) { 1187 var open = value.indexOf("(") + 1, 1188 close = value.indexOf(")"), 1189 nested = value.indexOf("(", open); 1190 return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close); 1191 }, 1192 _configEaseFromString = function _configEaseFromString(name) { 1193 var split = (name + "").split("("), 1194 ease = _easeMap[split[0]]; 1195 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; 1196 }, 1197 _invertEase = function _invertEase(ease) { 1198 return function (p) { 1199 return 1 - ease(1 - p); 1200 }; 1201 }, 1202 _propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) { 1203 var child = timeline._first, 1204 ease; 1205 while (child) { 1206 if (child instanceof Timeline) { 1207 _propagateYoyoEase(child, isYoyo); 1208 } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) { 1209 if (child.timeline) { 1210 _propagateYoyoEase(child.timeline, isYoyo); 1211 } else { 1212 ease = child._ease; 1213 child._ease = child._yEase; 1214 child._yEase = ease; 1215 child._yoyo = isYoyo; 1216 } 1217 } 1218 child = child._next; 1219 } 1220 }, 1221 _parseEase = function _parseEase(ease, defaultEase) { 1222 return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase; 1223 }, 1224 _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) { 1225 if (easeOut === void 0) { 1226 easeOut = function easeOut(p) { 1227 return 1 - easeIn(1 - p); 1228 }; 1229 } 1230 if (easeInOut === void 0) { 1231 easeInOut = function easeInOut(p) { 1232 return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2; 1233 }; 1234 } 1235 var ease = { 1236 easeIn: easeIn, 1237 easeOut: easeOut, 1238 easeInOut: easeInOut 1239 }, 1240 lowercaseName; 1241 _forEachName(names, function (name) { 1242 _easeMap[name] = _globals[name] = ease; 1243 _easeMap[lowercaseName = name.toLowerCase()] = easeOut; 1244 for (var p in ease) { 1245 _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p]; 1246 } 1247 }); 1248 return ease; 1249 }, 1250 _easeInOutFromOut = function _easeInOutFromOut(easeOut) { 1251 return function (p) { 1252 return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2; 1253 }; 1254 }, 1255 _configElastic = function _configElastic(type, amplitude, period) { 1256 var p1 = amplitude >= 1 ? amplitude : 1, 1257 p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1), 1258 p3 = p2 / _2PI * (Math.asin(1 / p1) || 0), 1259 easeOut = function easeOut(p) { 1260 return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1; 1261 }, 1262 ease = type === "out" ? easeOut : type === "in" ? function (p) { 1263 return 1 - easeOut(1 - p); 1264 } : _easeInOutFromOut(easeOut); 1265 p2 = _2PI / p2; 1266 ease.config = function (amplitude, period) { 1267 return _configElastic(type, amplitude, period); 1268 }; 1269 return ease; 1270 }, 1271 _configBack = function _configBack(type, overshoot) { 1272 if (overshoot === void 0) { 1273 overshoot = 1.70158; 1274 } 1275 var easeOut = function easeOut(p) { 1276 return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0; 1277 }, 1278 ease = type === "out" ? easeOut : type === "in" ? function (p) { 1279 return 1 - easeOut(1 - p); 1280 } : _easeInOutFromOut(easeOut); 1281 ease.config = function (overshoot) { 1282 return _configBack(type, overshoot); 1283 }; 1284 return ease; 1285 }; 1286 _forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function (name, i) { 1287 var power = i < 5 ? i + 1 : i; 1288 _insertEase(name + ",Power" + (power - 1), i ? function (p) { 1289 return Math.pow(p, power); 1290 } : function (p) { 1291 return p; 1292 }, function (p) { 1293 return 1 - Math.pow(1 - p, power); 1294 }, function (p) { 1295 return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2; 1296 }); 1297 }); 1298 _easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn; 1299 _insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic()); 1300 (function (n, c) { 1301 var n1 = 1 / c, 1302 n2 = 2 * n1, 1303 n3 = 2.5 * n1, 1304 easeOut = function easeOut(p) { 1305 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; 1306 }; 1307 _insertEase("Bounce", function (p) { 1308 return 1 - easeOut(1 - p); 1309 }, easeOut); 1310 })(7.5625, 2.75); 1311 _insertEase("Expo", function (p) { 1312 return p ? Math.pow(2, 10 * (p - 1)) : 0; 1313 }); 1314 _insertEase("Circ", function (p) { 1315 return -(_sqrt(1 - p * p) - 1); 1316 }); 1317 _insertEase("Sine", function (p) { 1318 return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1; 1319 }); 1320 _insertEase("Back", _configBack("in"), _configBack("out"), _configBack()); 1321 _easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = { 1322 config: function config(steps, immediateStart) { 1323 if (steps === void 0) { 1324 steps = 1; 1325 } 1326 var p1 = 1 / steps, 1327 p2 = steps + (immediateStart ? 0 : 1), 1328 p3 = immediateStart ? 1 : 0, 1329 max = 1 - _tinyNum; 1330 return function (p) { 1331 return ((p2 * _clamp(0, max, p) | 0) + p3) * p1; 1332 }; 1333 } 1334 }; 1335 _defaults.ease = _easeMap["quad.out"]; 1336 _forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function (name) { 1337 return _callbackNames += name + "," + name + "Params,"; 1338 }); 1339 var GSCache = function GSCache(target, harness) { 1340 this.id = _gsID++; 1341 target._gsap = this; 1342 this.target = target; 1343 this.harness = harness; 1344 this.get = harness ? harness.get : _getProperty; 1345 this.set = harness ? harness.getSetter : _getSetter; 1346 }; 1347 var Animation = function () { 1348 function Animation(vars) { 1349 this.vars = vars;
vendor: 5,207 bytes, lines 1350-1455
1350 this._delay = +vars.delay || 0; 1351 if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) { 1352 this._rDelay = vars.repeatDelay || 0; 1353 this._yoyo = !!vars.yoyo || !!vars.yoyoEase; 1354 } 1355 this._ts = 1; 1356 _setDuration(this, +vars.duration, 1, 1); 1357 this.data = vars.data; 1358 if (_context) { 1359 this._ctx = _context; 1360 _context.data.push(this); 1361 } 1362 _tickerActive || _ticker.wake(); 1363 } 1364 var _proto = Animation.prototype; 1365 _proto.delay = function delay(value) { 1366 if (value || value === 0) { 1367 this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay); 1368 this._delay = value; 1369 return this; 1370 } 1371 return this._delay; 1372 }; 1373 _proto.duration = function duration(value) { 1374 return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur; 1375 }; 1376 _proto.totalDuration = function totalDuration(value) { 1377 if (!arguments.length) { 1378 return this._tDur; 1379 } 1380 this._dirty = 0; 1381 return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1)); 1382 }; 1383 _proto.totalTime = function totalTime(_totalTime, suppressEvents) { 1384 _wake(); 1385 if (!arguments.length) { 1386 return this._tTime; 1387 } 1388 var parent = this._dp; 1389 if (parent && parent.smoothChildTiming && this._ts) { 1390 _alignPlayhead(this, _totalTime); 1391 !parent._dp || parent.parent || _postAddChecks(parent, this); 1392 while (parent && parent.parent) { 1393 if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) { 1394 parent.totalTime(parent._tTime, true); 1395 } 1396 parent = parent.parent; 1397 } 1398 if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) { 1399 _addToTimeline(this._dp, this, this._start - this._delay); 1400 } 1401 } 1402 if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) { 1403 this._ts || (this._pTime = _totalTime); 1404 _lazySafeRender(this, _totalTime, suppressEvents); 1405 } 1406 return this; 1407 }; 1408 _proto.time = function time(value, suppressEvents) { 1409 return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time; 1410 }; 1411 _proto.totalProgress = function totalProgress(value, suppressEvents) { 1412 return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.ratio; 1413 }; 1414 _proto.progress = function progress(value, suppressEvents) { 1415 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.ratio; 1416 }; 1417 _proto.iteration = function iteration(value, suppressEvents) { 1418 var cycleDuration = this.duration() + this._rDelay; 1419 return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1; 1420 }; 1421 _proto.timeScale = function timeScale(value) { 1422 if (!arguments.length) { 1423 return this._rts === -_tinyNum ? 0 : this._rts; 1424 } 1425 if (this._rts === value) { 1426 return this; 1427 } 1428 var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime; 1429 this._rts = +value || 0; 1430 this._ts = this._ps || value === -_tinyNum ? 0 : this._rts; 1431 this.totalTime(_clamp(-Math.abs(this._delay), this._tDur, tTime), true); 1432 _setEnd(this); 1433 return _recacheAncestors(this); 1434 }; 1435 _proto.paused = function paused(value) { 1436 if (!arguments.length) { 1437 return this._ps; 1438 } 1439 if (this._ps !== value) { 1440 this._ps = value; 1441 if (value) { 1442 this._pTime = this._tTime || Math.max(-this._delay, this.rawTime()); 1443 this._ts = this._act = 0; 1444 } else { 1445 _wake(); 1446 this._ts = this._rts; 1447 this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum)); 1448 } 1449 } 1450 return this; 1451 }; 1452 _proto.startTime = function startTime(value) { 1453 if (arguments.length) { 1454 this._start = value; 1455 var parent = this.parent || this._dp;
vendor: 3,616 bytes, lines 1456-1541
1456 parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay); 1457 return this; 1458 } 1459 return this._start; 1460 }; 1461 _proto.endTime = function endTime(includeRepeats) { 1462 return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1); 1463 }; 1464 _proto.rawTime = function rawTime(wrapRepeats) { 1465 var parent = this.parent || this._dp; 1466 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); 1467 }; 1468 _proto.revert = function revert(config) { 1469 if (config === void 0) { 1470 config = _revertConfig; 1471 } 1472 var prevIsReverting = _reverting; 1473 _reverting = config; 1474 if (this._initted || this._startAt) { 1475 this.timeline && this.timeline.revert(config); 1476 this.totalTime(-0.01, config.suppressEvents); 1477 } 1478 this.data !== "nested" && config.kill !== false && this.kill(); 1479 _reverting = prevIsReverting; 1480 return this; 1481 }; 1482 _proto.globalTime = function globalTime(rawTime) { 1483 var animation = this, 1484 time = arguments.length ? rawTime : animation.rawTime(); 1485 while (animation) { 1486 time = animation._start + time / (animation._ts || 1); 1487 animation = animation._dp; 1488 } 1489 return !this.parent && this._sat ? this._sat.vars.immediateRender ? -1 : this._sat.globalTime(rawTime) : time; 1490 }; 1491 _proto.repeat = function repeat(value) { 1492 if (arguments.length) { 1493 this._repeat = value === Infinity ? -2 : value; 1494 return _onUpdateTotalDuration(this); 1495 } 1496 return this._repeat === -2 ? Infinity : this._repeat; 1497 }; 1498 _proto.repeatDelay = function repeatDelay(value) { 1499 if (arguments.length) { 1500 var time = this._time; 1501 this._rDelay = value; 1502 _onUpdateTotalDuration(this); 1503 return time ? this.time(time) : this; 1504 } 1505 return this._rDelay; 1506 }; 1507 _proto.yoyo = function yoyo(value) { 1508 if (arguments.length) { 1509 this._yoyo = value; 1510 return this; 1511 } 1512 return this._yoyo; 1513 }; 1514 _proto.seek = function seek(position, suppressEvents) { 1515 return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents)); 1516 }; 1517 _proto.restart = function restart(includeDelay, suppressEvents) { 1518 return this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents)); 1519 }; 1520 _proto.play = function play(from, suppressEvents) { 1521 from != null && this.seek(from, suppressEvents); 1522 return this.reversed(false).paused(false); 1523 }; 1524 _proto.reverse = function reverse(from, suppressEvents) { 1525 from != null && this.seek(from || this.totalDuration(), suppressEvents); 1526 return this.reversed(true).paused(false); 1527 }; 1528 _proto.pause = function pause(atTime, suppressEvents) { 1529 atTime != null && this.seek(atTime, suppressEvents); 1530 return this.paused(true); 1531 }; 1532 _proto.resume = function resume() { 1533 return this.paused(false); 1534 }; 1535 _proto.reversed = function reversed(value) { 1536 if (arguments.length) { 1537 !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0)); 1538 return this; 1539 } 1540 return this._rts < 0; 1541 };
vendor: 9,019 bytes, lines 1542-1764
1542 _proto.invalidate = function invalidate() { 1543 this._initted = this._act = 0; 1544 this._zTime = -_tinyNum; 1545 return this; 1546 }; 1547 _proto.isActive = function isActive() { 1548 var parent = this.parent || this._dp, 1549 start = this._start, 1550 rawTime; 1551 return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum); 1552 }; 1553 _proto.eventCallback = function eventCallback(type, callback, params) { 1554 var vars = this.vars; 1555 if (arguments.length > 1) { 1556 if (!callback) { 1557 delete vars[type]; 1558 } else { 1559 vars[type] = callback; 1560 params && (vars[type + "Params"] = params); 1561 type === "onUpdate" && (this._onUpdate = callback); 1562 } 1563 return this; 1564 } 1565 return vars[type]; 1566 }; 1567 _proto.then = function then(onFulfilled) { 1568 var self = this; 1569 return new Promise(function (resolve) { 1570 var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough, 1571 _resolve = function _resolve() { 1572 var _then = self.then; 1573 self.then = null; 1574 _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then); 1575 resolve(f); 1576 self.then = _then; 1577 }; 1578 if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) { 1579 _resolve(); 1580 } else { 1581 self._prom = _resolve; 1582 } 1583 }); 1584 }; 1585 _proto.kill = function kill() { 1586 _interrupt(this); 1587 }; 1588 return Animation; 1589 }(); 1590 _setDefaults(Animation.prototype, { 1591 _time: 0, 1592 _start: 0, 1593 _end: 0, 1594 _tTime: 0, 1595 _tDur: 0, 1596 _dirty: 0, 1597 _repeat: 0, 1598 _yoyo: false, 1599 parent: null, 1600 _initted: false, 1601 _rDelay: 0, 1602 _ts: 1, 1603 _dp: 0, 1604 ratio: 0, 1605 _zTime: -_tinyNum, 1606 _prom: 0, 1607 _ps: false, 1608 _rts: 1 1609 }); 1610 var Timeline = function (_Animation) { 1611 _inheritsLoose(Timeline, _Animation); 1612 function Timeline(vars, position) { 1613 var _this; 1614 if (vars === void 0) { 1615 vars = {}; 1616 } 1617 _this = _Animation.call(this, vars) || this; 1618 _this.labels = {}; 1619 _this.smoothChildTiming = !!vars.smoothChildTiming; 1620 _this.autoRemoveChildren = !!vars.autoRemoveChildren; 1621 _this._sort = _isNotFalse(vars.sortChildren); 1622 _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position); 1623 vars.reversed && _this.reverse(); 1624 vars.paused && _this.paused(true); 1625 vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger); 1626 return _this; 1627 } 1628 var _proto2 = Timeline.prototype; 1629 _proto2.to = function to(targets, vars, position) { 1630 _createTweenType(0, arguments, this); 1631 return this; 1632 }; 1633 _proto2.from = function from(targets, vars, position) { 1634 _createTweenType(1, arguments, this); 1635 return this; 1636 }; 1637 _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) { 1638 _createTweenType(2, arguments, this); 1639 return this; 1640 }; 1641 _proto2.set = function set(targets, vars, position) { 1642 vars.duration = 0; 1643 vars.parent = this; 1644 _inheritDefaults(vars).repeatDelay || (vars.repeat = 0); 1645 vars.immediateRender = !!vars.immediateRender; 1646 new Tween(targets, vars, _parsePosition(this, position), 1); 1647 return this; 1648 }; 1649 _proto2.call = function call(callback, params, position) { 1650 return _addToTimeline(this, Tween.delayedCall(0, callback, params), position); 1651 }; 1652 _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 1653 vars.duration = duration; 1654 vars.stagger = vars.stagger || stagger; 1655 vars.onComplete = onCompleteAll; 1656 vars.onCompleteParams = onCompleteAllParams; 1657 vars.parent = this; 1658 new Tween(targets, vars, _parsePosition(this, position)); 1659 return this; 1660 }; 1661 _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 1662 vars.runBackwards = 1; 1663 _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender); 1664 return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams); 1665 }; 1666 _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) { 1667 toVars.startAt = fromVars; 1668 _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender); 1669 return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams); 1670 }; 1671 _proto2.render = function render(totalTime, suppressEvents, force) { 1672 var prevTime = this._time, 1673 tDur = this._dirty ? this.totalDuration() : this._tDur, 1674 dur = this._dur, 1675 tTime = totalTime <= 0 ? 0 : _roundPrecise(totalTime), 1676 crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur), 1677 time, 1678 child, 1679 next, 1680 iteration, 1681 cycleDuration, 1682 prevPaused, 1683 pauseTween, 1684 timeScale, 1685 prevStart, 1686 prevIteration, 1687 yoyo, 1688 isYoyo; 1689 this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur); 1690 if (tTime !== this._tTime || force || crossingStart) { 1691 if (prevTime !== this._time && dur) { 1692 tTime += this._time - prevTime; 1693 totalTime += this._time - prevTime; 1694 } 1695 time = tTime; 1696 prevStart = this._start; 1697 timeScale = this._ts; 1698 prevPaused = !timeScale; 1699 if (crossingStart) { 1700 dur || (prevTime = this._zTime); 1701 (totalTime || !suppressEvents) && (this._zTime = totalTime); 1702 } 1703 if (this._repeat) { 1704 yoyo = this._yoyo; 1705 cycleDuration = dur + this._rDelay; 1706 if (this._repeat < -1 && totalTime < 0) { 1707 return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 1708 } 1709 time = _roundPrecise(tTime % cycleDuration); 1710 if (tTime === tDur) { 1711 iteration = this._repeat; 1712 time = dur; 1713 } else { 1714 iteration = ~~(tTime / cycleDuration); 1715 if (iteration && iteration === tTime / cycleDuration) { 1716 time = dur; 1717 iteration--; 1718 } 1719 time > dur && (time = dur); 1720 } 1721 prevIteration = _animationCycle(this._tTime, cycleDuration); 1722 !prevTime && this._tTime && prevIteration !== iteration && this._tTime - prevIteration * cycleDuration - this._dur <= 0 && (prevIteration = iteration); 1723 if (yoyo && iteration & 1) { 1724 time = dur - time; 1725 isYoyo = 1; 1726 } 1727 if (iteration !== prevIteration && !this._lock) { 1728 var rewinding = yoyo && prevIteration & 1, 1729 doesWrap = rewinding === (yoyo && iteration & 1); 1730 iteration < prevIteration && (rewinding = !rewinding); 1731 prevTime = rewinding ? 0 : dur; 1732 this._lock = 1; 1733 this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0; 1734 this._tTime = tTime; 1735 !suppressEvents && this.parent && _callback(this, "onRepeat"); 1736 this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1); 1737 if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) { 1738 return this; 1739 } 1740 dur = this._dur; 1741 tDur = this._tDur; 1742 if (doesWrap) { 1743 this._lock = 2; 1744 prevTime = rewinding ? dur : -0.0001; 1745 this.render(prevTime, true); 1746 this.vars.repeatRefresh && !isYoyo && this.invalidate(); 1747 } 1748 this._lock = 0; 1749 if (!this._ts && !prevPaused) { 1750 return this; 1751 } 1752 _propagateYoyoEase(this, isYoyo); 1753 } 1754 } 1755 if (this._hasPause && !this._forcing && this._lock < 2) { 1756 pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time)); 1757 if (pauseTween) { 1758 tTime -= time - (time = pauseTween._start); 1759 } 1760 } 1761 this._tTime = tTime; 1762 this._time = time; 1763 this._act = !timeScale; 1764 if (!this._initted) {
vendor: 31,893 bytes, lines 1765-2550
1765 this._onUpdate = this.vars.onUpdate; 1766 this._initted = 1; 1767 this._zTime = totalTime; 1768 prevTime = 0; 1769 } 1770 if (!prevTime && time && !suppressEvents && !iteration) { 1771 _callback(this, "onStart"); 1772 if (this._tTime !== tTime) { 1773 return this; 1774 } 1775 } 1776 if (time >= prevTime && totalTime >= 0) { 1777 child = this._first; 1778 while (child) { 1779 next = child._next; 1780 if ((child._act || time >= child._start) && child._ts && pauseTween !== child) { 1781 if (child.parent !== this) { 1782 return this.render(totalTime, suppressEvents, force); 1783 } 1784 child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force); 1785 if (time !== this._time || !this._ts && !prevPaused) { 1786 pauseTween = 0; 1787 next && (tTime += this._zTime = -_tinyNum); 1788 break; 1789 } 1790 } 1791 child = next; 1792 } 1793 } else { 1794 child = this._last; 1795 var adjustedTime = totalTime < 0 ? totalTime : time; 1796 while (child) { 1797 next = child._prev; 1798 if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) { 1799 if (child.parent !== this) { 1800 return this.render(totalTime, suppressEvents, force); 1801 } 1802 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)); 1803 if (time !== this._time || !this._ts && !prevPaused) { 1804 pauseTween = 0; 1805 next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum); 1806 break; 1807 } 1808 } 1809 child = next; 1810 } 1811 } 1812 if (pauseTween && !suppressEvents) { 1813 this.pause(); 1814 pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1; 1815 if (this._ts) { 1816 this._start = prevStart; 1817 _setEnd(this); 1818 return this.render(totalTime, suppressEvents, force); 1819 } 1820 } 1821 this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true); 1822 if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) if (!this._lock) { 1823 (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); 1824 if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) { 1825 _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true); 1826 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 1827 } 1828 } 1829 } 1830 return this; 1831 }; 1832 _proto2.add = function add(child, position) { 1833 var _this2 = this; 1834 _isNumber(position) || (position = _parsePosition(this, position, child)); 1835 if (!(child instanceof Animation)) { 1836 if (_isArray(child)) { 1837 child.forEach(function (obj) { 1838 return _this2.add(obj, position); 1839 }); 1840 return this; 1841 } 1842 if (_isString(child)) { 1843 return this.addLabel(child, position); 1844 } 1845 if (_isFunction(child)) { 1846 child = Tween.delayedCall(0, child); 1847 } else { 1848 return this; 1849 } 1850 } 1851 return this !== child ? _addToTimeline(this, child, position) : this; 1852 }; 1853 _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) { 1854 if (nested === void 0) { 1855 nested = true; 1856 } 1857 if (tweens === void 0) { 1858 tweens = true; 1859 } 1860 if (timelines === void 0) { 1861 timelines = true; 1862 } 1863 if (ignoreBeforeTime === void 0) { 1864 ignoreBeforeTime = -_bigNum; 1865 } 1866 var a = [], 1867 child = this._first; 1868 while (child) { 1869 if (child._start >= ignoreBeforeTime) { 1870 if (child instanceof Tween) { 1871 tweens && a.push(child); 1872 } else { 1873 timelines && a.push(child); 1874 nested && a.push.apply(a, child.getChildren(true, tweens, timelines)); 1875 } 1876 } 1877 child = child._next; 1878 } 1879 return a; 1880 }; 1881 _proto2.getById = function getById(id) { 1882 var animations = this.getChildren(1, 1, 1), 1883 i = animations.length; 1884 while (i--) { 1885 if (animations[i].vars.id === id) { 1886 return animations[i]; 1887 } 1888 } 1889 }; 1890 _proto2.remove = function remove(child) { 1891 if (_isString(child)) { 1892 return this.removeLabel(child); 1893 } 1894 if (_isFunction(child)) { 1895 return this.killTweensOf(child); 1896 } 1897 _removeLinkedListItem(this, child); 1898 if (child === this._recent) { 1899 this._recent = this._last; 1900 } 1901 return _uncache(this); 1902 }; 1903 _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) { 1904 if (!arguments.length) { 1905 return this._tTime; 1906 } 1907 this._forcing = 1; 1908 if (!this._dp && this._ts) { 1909 this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts)); 1910 } 1911 _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents); 1912 this._forcing = 0; 1913 return this; 1914 }; 1915 _proto2.addLabel = function addLabel(label, position) { 1916 this.labels[label] = _parsePosition(this, position); 1917 return this; 1918 }; 1919 _proto2.removeLabel = function removeLabel(label) { 1920 delete this.labels[label]; 1921 return this; 1922 }; 1923 _proto2.addPause = function addPause(position, callback, params) { 1924 var t = Tween.delayedCall(0, callback || _emptyFunc, params); 1925 t.data = "isPause"; 1926 this._hasPause = 1; 1927 return _addToTimeline(this, t, _parsePosition(this, position)); 1928 }; 1929 _proto2.removePause = function removePause(position) { 1930 var child = this._first; 1931 position = _parsePosition(this, position); 1932 while (child) { 1933 if (child._start === position && child.data === "isPause") { 1934 _removeFromParent(child); 1935 } 1936 child = child._next; 1937 } 1938 }; 1939 _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) { 1940 var tweens = this.getTweensOf(targets, onlyActive), 1941 i = tweens.length; 1942 while (i--) { 1943 _overwritingTween !== tweens[i] && tweens[i].kill(targets, props); 1944 } 1945 return this; 1946 }; 1947 _proto2.getTweensOf = function getTweensOf(targets, onlyActive) { 1948 var a = [], 1949 parsedTargets = toArray(targets), 1950 child = this._first, 1951 isGlobalTime = _isNumber(onlyActive), 1952 children; 1953 while (child) { 1954 if (child instanceof Tween) { 1955 if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) { 1956 a.push(child); 1957 } 1958 } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) { 1959 a.push.apply(a, children); 1960 } 1961 child = child._next; 1962 } 1963 return a; 1964 }; 1965 _proto2.tweenTo = function tweenTo(position, vars) { 1966 vars = vars || {}; 1967 var tl = this, 1968 endTime = _parsePosition(tl, position), 1969 _vars = vars, 1970 startAt = _vars.startAt, 1971 _onStart = _vars.onStart, 1972 onStartParams = _vars.onStartParams, 1973 immediateRender = _vars.immediateRender, 1974 initted, 1975 tween = Tween.to(tl, _setDefaults({ 1976 ease: vars.ease || "none", 1977 lazy: false, 1978 immediateRender: false, 1979 time: endTime, 1980 overwrite: "auto", 1981 duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum, 1982 onStart: function onStart() { 1983 tl.pause(); 1984 if (!initted) { 1985 var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()); 1986 tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true); 1987 initted = 1; 1988 } 1989 _onStart && _onStart.apply(tween, onStartParams || []); 1990 } 1991 }, vars)); 1992 return immediateRender ? tween.render(0) : tween; 1993 }; 1994 _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) { 1995 return this.tweenTo(toPosition, _setDefaults({ 1996 startAt: { 1997 time: _parsePosition(this, fromPosition) 1998 } 1999 }, vars)); 2000 }; 2001 _proto2.recent = function recent() { 2002 return this._recent; 2003 }; 2004 _proto2.nextLabel = function nextLabel(afterTime) { 2005 if (afterTime === void 0) { 2006 afterTime = this._time; 2007 } 2008 return _getLabelInDirection(this, _parsePosition(this, afterTime)); 2009 }; 2010 _proto2.previousLabel = function previousLabel(beforeTime) { 2011 if (beforeTime === void 0) { 2012 beforeTime = this._time; 2013 } 2014 return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1); 2015 }; 2016 _proto2.currentLabel = function currentLabel(value) { 2017 return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum); 2018 }; 2019 _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) { 2020 if (ignoreBeforeTime === void 0) { 2021 ignoreBeforeTime = 0; 2022 } 2023 var child = this._first, 2024 labels = this.labels, 2025 p; 2026 while (child) { 2027 if (child._start >= ignoreBeforeTime) { 2028 child._start += amount; 2029 child._end += amount; 2030 } 2031 child = child._next; 2032 } 2033 if (adjustLabels) { 2034 for (p in labels) { 2035 if (labels[p] >= ignoreBeforeTime) { 2036 labels[p] += amount; 2037 } 2038 } 2039 } 2040 return _uncache(this); 2041 }; 2042 _proto2.invalidate = function invalidate(soft) { 2043 var child = this._first; 2044 this._lock = 0; 2045 while (child) { 2046 child.invalidate(soft); 2047 child = child._next; 2048 } 2049 return _Animation.prototype.invalidate.call(this, soft); 2050 }; 2051 _proto2.clear = function clear(includeLabels) { 2052 if (includeLabels === void 0) { 2053 includeLabels = true; 2054 } 2055 var child = this._first, 2056 next; 2057 while (child) { 2058 next = child._next; 2059 this.remove(child); 2060 child = next; 2061 } 2062 this._dp && (this._time = this._tTime = this._pTime = 0); 2063 includeLabels && (this.labels = {}); 2064 return _uncache(this); 2065 }; 2066 _proto2.totalDuration = function totalDuration(value) { 2067 var max = 0, 2068 self = this, 2069 child = self._last, 2070 prevStart = _bigNum, 2071 prev, 2072 start, 2073 parent; 2074 if (arguments.length) { 2075 return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value)); 2076 } 2077 if (self._dirty) { 2078 parent = self.parent; 2079 while (child) { 2080 prev = child._prev; 2081 child._dirty && child.totalDuration(); 2082 start = child._start; 2083 if (start > prevStart && self._sort && child._ts && !self._lock) { 2084 self._lock = 1; 2085 _addToTimeline(self, child, start - child._delay, 1)._lock = 0; 2086 } else { 2087 prevStart = start; 2088 } 2089 if (start < 0 && child._ts) { 2090 max -= start; 2091 if (!parent && !self._dp || parent && parent.smoothChildTiming) { 2092 self._start += start / self._ts; 2093 self._time -= start; 2094 self._tTime -= start; 2095 } 2096 self.shiftChildren(-start, false, -1e999); 2097 prevStart = 0; 2098 } 2099 child._end > max && child._ts && (max = child._end); 2100 child = prev; 2101 } 2102 _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1); 2103 self._dirty = 0; 2104 } 2105 return self._tDur; 2106 }; 2107 Timeline.updateRoot = function updateRoot(time) { 2108 if (_globalTimeline._ts) { 2109 _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline)); 2110 _lastRenderedFrame = _ticker.frame; 2111 } 2112 if (_ticker.frame >= _nextGCFrame) { 2113 _nextGCFrame += _config.autoSleep || 120; 2114 var child = _globalTimeline._first; 2115 if (!child || !child._ts) if (_config.autoSleep && _ticker._listeners.length < 2) { 2116 while (child && !child._ts) { 2117 child = child._next; 2118 } 2119 child || _ticker.sleep(); 2120 } 2121 } 2122 }; 2123 return Timeline; 2124 }(Animation); 2125 _setDefaults(Timeline.prototype, { 2126 _lock: 0, 2127 _hasPause: 0, 2128 _forcing: 0 2129 }); 2130 var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) { 2131 var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter), 2132 index = 0, 2133 matchIndex = 0, 2134 result, 2135 startNums, 2136 color, 2137 endNum, 2138 chunk, 2139 startNum, 2140 hasRandom, 2141 a; 2142 pt.b = start; 2143 pt.e = end; 2144 start += ""; 2145 end += ""; 2146 if (hasRandom = ~end.indexOf("random(")) { 2147 end = _replaceRandom(end); 2148 } 2149 if (stringFilter) { 2150 a = [start, end]; 2151 stringFilter(a, target, prop); 2152 start = a[0]; 2153 end = a[1]; 2154 } 2155 startNums = start.match(_complexStringNumExp) || []; 2156 while (result = _complexStringNumExp.exec(end)) { 2157 endNum = result[0]; 2158 chunk = end.substring(index, result.index); 2159 if (color) { 2160 color = (color + 1) % 5; 2161 } else if (chunk.substr(-5) === "rgba(") { 2162 color = 1; 2163 } 2164 if (endNum !== startNums[matchIndex++]) { 2165 startNum = parseFloat(startNums[matchIndex - 1]) || 0; 2166 pt._pt = { 2167 _next: pt._pt, 2168 p: chunk || matchIndex === 1 ? chunk : ",", 2169 s: startNum, 2170 c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum, 2171 m: color && color < 4 ? Math.round : 0 2172 }; 2173 index = _complexStringNumExp.lastIndex; 2174 } 2175 } 2176 pt.c = index < end.length ? end.substring(index, end.length) : ""; 2177 pt.fp = funcParam; 2178 if (_relExp.test(end) || hasRandom) { 2179 pt.e = 0; 2180 } 2181 this._pt = pt; 2182 return pt; 2183 }, 2184 _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam, optional) { 2185 _isFunction(end) && (end = end(index || 0, target, targets)); 2186 var currentValue = target[prop], 2187 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](), 2188 setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc, 2189 pt; 2190 if (_isString(end)) { 2191 if (~end.indexOf("random(")) { 2192 end = _replaceRandom(end); 2193 } 2194 if (end.charAt(1) === "=") { 2195 pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0); 2196 if (pt || pt === 0) { 2197 end = pt; 2198 } 2199 } 2200 } 2201 if (!optional || parsedStart !== end || _forceAllPropTweens) { 2202 if (!isNaN(parsedStart * end) && end !== "") { 2203 pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter); 2204 funcParam && (pt.fp = funcParam); 2205 modifier && pt.modifier(modifier, this, target); 2206 return this._pt = pt; 2207 } 2208 !currentValue && !(prop in target) && _missingPlugin(prop, end); 2209 return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam); 2210 } 2211 }, 2212 _processVars = function _processVars(vars, index, target, targets, tween) { 2213 _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets)); 2214 if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) { 2215 return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars; 2216 } 2217 var copy = {}, 2218 p; 2219 for (p in vars) { 2220 copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets); 2221 } 2222 return copy; 2223 }, 2224 _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) { 2225 var plugin, pt, ptLookup, i; 2226 if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) { 2227 tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority); 2228 if (tween !== _quickTween) { 2229 ptLookup = tween._ptLookup[tween._targets.indexOf(target)]; 2230 i = plugin._props.length; 2231 while (i--) { 2232 ptLookup[plugin._props[i]] = pt; 2233 } 2234 } 2235 } 2236 return plugin; 2237 }, 2238 _overwritingTween, 2239 _forceAllPropTweens, 2240 _initTween = function _initTween(tween, time, tTime) { 2241 var vars = tween.vars, 2242 ease = vars.ease, 2243 startAt = vars.startAt, 2244 immediateRender = vars.immediateRender, 2245 lazy = vars.lazy, 2246 onUpdate = vars.onUpdate, 2247 onUpdateParams = vars.onUpdateParams, 2248 callbackScope = vars.callbackScope, 2249 runBackwards = vars.runBackwards, 2250 yoyoEase = vars.yoyoEase, 2251 keyframes = vars.keyframes, 2252 autoRevert = vars.autoRevert, 2253 dur = tween._dur, 2254 prevStartAt = tween._startAt, 2255 targets = tween._targets, 2256 parent = tween.parent, 2257 fullTargets = parent && parent.data === "nested" ? parent.vars.targets : targets, 2258 autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites, 2259 tl = tween.timeline, 2260 cleanVars, 2261 i, 2262 p, 2263 pt, 2264 target, 2265 hasPriority, 2266 gsData, 2267 harness, 2268 plugin, 2269 ptLookup, 2270 index, 2271 harnessVars, 2272 overwritten; 2273 tl && (!keyframes || !ease) && (ease = "none"); 2274 tween._ease = _parseEase(ease, _defaults.ease); 2275 tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0; 2276 if (yoyoEase && tween._yoyo && !tween._repeat) { 2277 yoyoEase = tween._yEase; 2278 tween._yEase = tween._ease; 2279 tween._ease = yoyoEase; 2280 } 2281 tween._from = !tl && !!vars.runBackwards; 2282 if (!tl || keyframes && !vars.stagger) { 2283 harness = targets[0] ? _getCache(targets[0]).harness : 0; 2284 harnessVars = harness && vars[harness.prop]; 2285 cleanVars = _copyExcluding(vars, _reservedProps); 2286 if (prevStartAt) { 2287 prevStartAt._zTime < 0 && prevStartAt.progress(1); 2288 time < 0 && runBackwards && immediateRender && !autoRevert ? prevStartAt.render(-1, true) : prevStartAt.revert(runBackwards && dur ? _revertConfigNoKill : _startAtRevertConfig); 2289 prevStartAt._lazy = 0; 2290 } 2291 if (startAt) { 2292 _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({ 2293 data: "isStart", 2294 overwrite: false, 2295 parent: parent, 2296 immediateRender: true, 2297 lazy: !prevStartAt && _isNotFalse(lazy), 2298 startAt: null, 2299 delay: 0, 2300 onUpdate: onUpdate, 2301 onUpdateParams: onUpdateParams, 2302 callbackScope: callbackScope, 2303 stagger: 0 2304 }, startAt))); 2305 tween._startAt._dp = 0; 2306 tween._startAt._sat = tween; 2307 time < 0 && (_reverting || !immediateRender && !autoRevert) && tween._startAt.revert(_revertConfigNoKill); 2308 if (immediateRender) { 2309 if (dur && time <= 0 && tTime <= 0) { 2310 time && (tween._zTime = time); 2311 return; 2312 } 2313 } 2314 } else if (runBackwards && dur) { 2315 if (!prevStartAt) { 2316 time && (immediateRender = false); 2317 p = _setDefaults({ 2318 overwrite: false, 2319 data: "isFromStart", 2320 lazy: immediateRender && !prevStartAt && _isNotFalse(lazy), 2321 immediateRender: immediateRender, 2322 stagger: 0, 2323 parent: parent 2324 }, cleanVars); 2325 harnessVars && (p[harness.prop] = harnessVars); 2326 _removeFromParent(tween._startAt = Tween.set(targets, p)); 2327 tween._startAt._dp = 0; 2328 tween._startAt._sat = tween; 2329 time < 0 && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween._startAt.render(-1, true)); 2330 tween._zTime = time; 2331 if (!immediateRender) { 2332 _initTween(tween._startAt, _tinyNum, _tinyNum); 2333 } else if (!time) { 2334 return; 2335 } 2336 } 2337 } 2338 tween._pt = tween._ptCache = 0; 2339 lazy = dur && _isNotFalse(lazy) || lazy && !dur; 2340 for (i = 0; i < targets.length; i++) { 2341 target = targets[i]; 2342 gsData = target._gsap || _harness(targets)[i]._gsap; 2343 tween._ptLookup[i] = ptLookup = {}; 2344 _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender(); 2345 index = fullTargets === targets ? i : fullTargets.indexOf(target); 2346 if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) { 2347 tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority); 2348 plugin._props.forEach(function (name) { 2349 ptLookup[name] = pt; 2350 }); 2351 plugin.priority && (hasPriority = 1); 2352 } 2353 if (!harness || harnessVars) { 2354 for (p in cleanVars) { 2355 if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) { 2356 plugin.priority && (hasPriority = 1); 2357 } else { 2358 ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter); 2359 } 2360 } 2361 } 2362 tween._op && tween._op[i] && tween.kill(target, tween._op[i]); 2363 if (autoOverwrite && tween._pt) { 2364 _overwritingTween = tween; 2365 _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time)); 2366 overwritten = !tween.parent; 2367 _overwritingTween = 0; 2368 } 2369 tween._pt && lazy && (_lazyLookup[gsData.id] = 1); 2370 } 2371 hasPriority && _sortPropTweensByPriority(tween); 2372 tween._onInit && tween._onInit(tween); 2373 } 2374 tween._onUpdate = onUpdate; 2375 tween._initted = (!tween._op || tween._pt) && !overwritten; 2376 keyframes && time <= 0 && tl.render(_bigNum, true, true); 2377 }, 2378 _updatePropTweens = function _updatePropTweens(tween, property, value, start, startIsRelative, ratio, time) { 2379 var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property], 2380 pt, 2381 rootPT, 2382 lookup, 2383 i; 2384 if (!ptCache) { 2385 ptCache = tween._ptCache[property] = []; 2386 lookup = tween._ptLookup; 2387 i = tween._targets.length; 2388 while (i--) { 2389 pt = lookup[i][property]; 2390 if (pt && pt.d && pt.d._pt) { 2391 pt = pt.d._pt; 2392 while (pt && pt.p !== property && pt.fp !== property) { 2393 pt = pt._next; 2394 } 2395 } 2396 if (!pt) { 2397 _forceAllPropTweens = 1; 2398 tween.vars[property] = "+=0"; 2399 _initTween(tween, time); 2400 _forceAllPropTweens = 0; 2401 return 1; 2402 } 2403 ptCache.push(pt); 2404 } 2405 } 2406 i = ptCache.length; 2407 while (i--) { 2408 rootPT = ptCache[i]; 2409 pt = rootPT._pt || rootPT; 2410 pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c; 2411 pt.c = value - pt.s; 2412 rootPT.e && (rootPT.e = _round(value) + getUnit(rootPT.e)); 2413 rootPT.b && (rootPT.b = pt.s + getUnit(rootPT.b)); 2414 } 2415 }, 2416 _addAliasesToVars = function _addAliasesToVars(targets, vars) { 2417 var harness = targets[0] ? _getCache(targets[0]).harness : 0, 2418 propertyAliases = harness && harness.aliases, 2419 copy, 2420 p, 2421 i, 2422 aliases; 2423 if (!propertyAliases) { 2424 return vars; 2425 } 2426 copy = _merge({}, vars); 2427 for (p in propertyAliases) { 2428 if (p in copy) { 2429 aliases = propertyAliases[p].split(","); 2430 i = aliases.length; 2431 while (i--) { 2432 copy[aliases[i]] = copy[p]; 2433 } 2434 } 2435 } 2436 return copy; 2437 }, 2438 _parseKeyframe = function _parseKeyframe(prop, obj, allProps, easeEach) { 2439 var ease = obj.ease || easeEach || "power1.inOut", 2440 p, 2441 a; 2442 if (_isArray(obj)) { 2443 a = allProps[prop] || (allProps[prop] = []); 2444 obj.forEach(function (value, i) { 2445 return a.push({ 2446 t: i / (obj.length - 1) * 100, 2447 v: value, 2448 e: ease 2449 }); 2450 }); 2451 } else { 2452 for (p in obj) { 2453 a = allProps[p] || (allProps[p] = []); 2454 p === "ease" || a.push({ 2455 t: parseFloat(prop), 2456 v: obj[p], 2457 e: ease 2458 }); 2459 } 2460 } 2461 }, 2462 _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) { 2463 return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value; 2464 }, 2465 _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert", 2466 _staggerPropsToSkip = {}; 2467 _forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function (name) { 2468 return _staggerPropsToSkip[name] = 1; 2469 }); 2470 var Tween = function (_Animation2) { 2471 _inheritsLoose(Tween, _Animation2); 2472 function Tween(targets, vars, position, skipInherit) { 2473 var _this3; 2474 if (typeof vars === "number") { 2475 position.duration = vars; 2476 vars = position; 2477 position = null; 2478 } 2479 _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this; 2480 var _this3$vars = _this3.vars, 2481 duration = _this3$vars.duration, 2482 delay = _this3$vars.delay, 2483 immediateRender = _this3$vars.immediateRender, 2484 stagger = _this3$vars.stagger, 2485 overwrite = _this3$vars.overwrite, 2486 keyframes = _this3$vars.keyframes, 2487 defaults = _this3$vars.defaults, 2488 scrollTrigger = _this3$vars.scrollTrigger, 2489 yoyoEase = _this3$vars.yoyoEase, 2490 parent = vars.parent || _globalTimeline, 2491 parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [targets] : toArray(targets), 2492 tl, 2493 i, 2494 copy, 2495 l, 2496 p, 2497 curTarget, 2498 staggerFunc, 2499 staggerVarsToMerge; 2500 _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://greensock.com", !_config.nullTargetWarn) || []; 2501 _this3._ptLookup = []; 2502 _this3._overwrite = overwrite; 2503 if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 2504 vars = _this3.vars; 2505 tl = _this3.timeline = new Timeline({ 2506 data: "nested", 2507 defaults: defaults || {}, 2508 targets: parent && parent.data === "nested" ? parent.vars.targets : parsedTargets 2509 }); 2510 tl.kill(); 2511 tl.parent = tl._dp = _assertThisInitialized(_this3); 2512 tl._start = 0; 2513 if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 2514 l = parsedTargets.length; 2515 staggerFunc = stagger && distribute(stagger); 2516 if (_isObject(stagger)) { 2517 for (p in stagger) { 2518 if (~_staggerTweenProps.indexOf(p)) { 2519 staggerVarsToMerge || (staggerVarsToMerge = {}); 2520 staggerVarsToMerge[p] = stagger[p]; 2521 } 2522 } 2523 } 2524 for (i = 0; i < l; i++) { 2525 copy = _copyExcluding(vars, _staggerPropsToSkip); 2526 copy.stagger = 0; 2527 yoyoEase && (copy.yoyoEase = yoyoEase); 2528 staggerVarsToMerge && _merge(copy, staggerVarsToMerge); 2529 curTarget = parsedTargets[i]; 2530 copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets); 2531 copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay; 2532 if (!stagger && l === 1 && copy.delay) { 2533 _this3._delay = delay = copy.delay; 2534 _this3._start += delay; 2535 copy.delay = 0; 2536 } 2537 tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0); 2538 tl._ease = _easeMap.none; 2539 } 2540 tl.duration() ? duration = delay = 0 : _this3.timeline = 0; 2541 } else if (keyframes) { 2542 _inheritDefaults(_setDefaults(tl.vars.defaults, { 2543 ease: "none" 2544 })); 2545 tl._ease = _parseEase(keyframes.ease || vars.ease || "none"); 2546 var time = 0, 2547 a, 2548 kf, 2549 v; 2550 if (_isArray(keyframes)) {
vendor: 6,583 bytes, lines 2551-2708
2551 keyframes.forEach(function (frame) { 2552 return tl.to(parsedTargets, frame, ">"); 2553 }); 2554 tl.duration(); 2555 } else { 2556 copy = {}; 2557 for (p in keyframes) { 2558 p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach); 2559 } 2560 for (p in copy) { 2561 a = copy[p].sort(function (a, b) { 2562 return a.t - b.t; 2563 }); 2564 time = 0; 2565 for (i = 0; i < a.length; i++) { 2566 kf = a[i]; 2567 v = { 2568 ease: kf.e, 2569 duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration 2570 }; 2571 v[p] = kf.v; 2572 tl.to(parsedTargets, v, time); 2573 time += v.duration; 2574 } 2575 } 2576 tl.duration() < duration && tl.to({}, { 2577 duration: duration - tl.duration() 2578 }); 2579 } 2580 } 2581 duration || _this3.duration(duration = tl.duration()); 2582 } else { 2583 _this3.timeline = 0; 2584 } 2585 if (overwrite === true && !_suppressOverwrites) { 2586 _overwritingTween = _assertThisInitialized(_this3); 2587 _globalTimeline.killTweensOf(parsedTargets); 2588 _overwritingTween = 0; 2589 } 2590 _addToTimeline(parent, _assertThisInitialized(_this3), position); 2591 vars.reversed && _this3.reverse(); 2592 vars.paused && _this3.paused(true); 2593 if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") { 2594 _this3._tTime = -_tinyNum; 2595 _this3.render(Math.max(0, -delay) || 0); 2596 } 2597 scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger); 2598 return _this3; 2599 } 2600 var _proto3 = Tween.prototype; 2601 _proto3.render = function render(totalTime, suppressEvents, force) { 2602 var prevTime = this._time, 2603 tDur = this._tDur, 2604 dur = this._dur, 2605 isNegative = totalTime < 0, 2606 tTime = totalTime > tDur - _tinyNum && !isNegative ? tDur : totalTime < _tinyNum ? 0 : totalTime, 2607 time, 2608 pt, 2609 iteration, 2610 cycleDuration, 2611 prevIteration, 2612 isYoyo, 2613 ratio, 2614 timeline, 2615 yoyoEase; 2616 if (!dur) { 2617 _renderZeroDurationTween(this, totalTime, suppressEvents, force); 2618 } else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== isNegative) { 2619 time = tTime; 2620 timeline = this.timeline; 2621 if (this._repeat) { 2622 cycleDuration = dur + this._rDelay; 2623 if (this._repeat < -1 && isNegative) { 2624 return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 2625 } 2626 time = _roundPrecise(tTime % cycleDuration); 2627 if (tTime === tDur) { 2628 iteration = this._repeat; 2629 time = dur; 2630 } else { 2631 iteration = ~~(tTime / cycleDuration); 2632 if (iteration && iteration === tTime / cycleDuration) { 2633 time = dur; 2634 iteration--; 2635 } 2636 time > dur && (time = dur); 2637 } 2638 isYoyo = this._yoyo && iteration & 1; 2639 if (isYoyo) { 2640 yoyoEase = this._yEase; 2641 time = dur - time; 2642 } 2643 prevIteration = _animationCycle(this._tTime, cycleDuration); 2644 if (time === prevTime && !force && this._initted) { 2645 this._tTime = tTime; 2646 return this; 2647 } 2648 if (iteration !== prevIteration) { 2649 timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo); 2650 if (this.vars.repeatRefresh && !isYoyo && !this._lock) { 2651 this._lock = force = 1; 2652 this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0; 2653 } 2654 } 2655 } 2656 if (!this._initted) { 2657 if (_attemptInitTween(this, isNegative ? totalTime : time, force, suppressEvents, tTime)) { 2658 this._tTime = 0; 2659 return this; 2660 } 2661 if (prevTime !== this._time) { 2662 return this; 2663 } 2664 if (dur !== this._dur) { 2665 return this.render(totalTime, suppressEvents, force); 2666 } 2667 } 2668 this._tTime = tTime; 2669 this._time = time; 2670 if (!this._act && this._ts) { 2671 this._act = 1; 2672 this._lazy = 0; 2673 } 2674 this.ratio = ratio = (yoyoEase || this._ease)(time / dur); 2675 if (this._from) { 2676 this.ratio = ratio = 1 - ratio; 2677 } 2678 if (time && !prevTime && !suppressEvents && !iteration) { 2679 _callback(this, "onStart"); 2680 if (this._tTime !== tTime) { 2681 return this; 2682 } 2683 } 2684 pt = this._pt; 2685 while (pt) { 2686 pt.r(ratio, pt.d); 2687 pt = pt._next; 2688 } 2689 timeline && timeline.render(totalTime < 0 ? totalTime : !time && isYoyo ? -_tinyNum : timeline._dur * timeline._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime); 2690 if (this._onUpdate && !suppressEvents) { 2691 isNegative && _rewindStartAt(this, totalTime, suppressEvents, force); 2692 _callback(this, "onUpdate"); 2693 } 2694 this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat"); 2695 if ((tTime === this._tDur || !tTime) && this._tTime === tTime) { 2696 isNegative && !this._onUpdate && _rewindStartAt(this, totalTime, true, true); 2697 (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); 2698 if (!suppressEvents && !(isNegative && !prevTime) && (tTime || prevTime || isYoyo)) { 2699 _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true); 2700 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 2701 } 2702 } 2703 } 2704 return this; 2705 }; 2706 _proto3.targets = function targets() { 2707 return this._targets; 2708 };
vendor: 13,526 bytes, lines 2709-3091
2709 _proto3.invalidate = function invalidate(soft) { 2710 (!soft || !this.vars.runBackwards) && (this._startAt = 0); 2711 this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0; 2712 this._ptLookup = []; 2713 this.timeline && this.timeline.invalidate(soft); 2714 return _Animation2.prototype.invalidate.call(this, soft); 2715 }; 2716 _proto3.resetTo = function resetTo(property, value, start, startIsRelative) { 2717 _tickerActive || _ticker.wake(); 2718 this._ts || this.play(); 2719 var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts), 2720 ratio; 2721 this._initted || _initTween(this, time); 2722 ratio = this._ease(time / this._dur); 2723 if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time)) { 2724 return this.resetTo(property, value, start, startIsRelative); 2725 } 2726 _alignPlayhead(this, 0); 2727 this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0); 2728 return this.render(0); 2729 }; 2730 _proto3.kill = function kill(targets, vars) { 2731 if (vars === void 0) { 2732 vars = "all"; 2733 } 2734 if (!targets && (!vars || vars === "all")) { 2735 this._lazy = this._pt = 0; 2736 return this.parent ? _interrupt(this) : this; 2737 } 2738 if (this.timeline) { 2739 var tDur = this.timeline.totalDuration(); 2740 this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this); 2741 this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1); 2742 return this; 2743 } 2744 var parsedTargets = this._targets, 2745 killingTargets = targets ? toArray(targets) : parsedTargets, 2746 propTweenLookup = this._ptLookup, 2747 firstPT = this._pt, 2748 overwrittenProps, 2749 curLookup, 2750 curOverwriteProps, 2751 props, 2752 p, 2753 pt, 2754 i; 2755 if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) { 2756 vars === "all" && (this._pt = 0); 2757 return _interrupt(this); 2758 } 2759 overwrittenProps = this._op = this._op || []; 2760 if (vars !== "all") { 2761 if (_isString(vars)) { 2762 p = {}; 2763 _forEachName(vars, function (name) { 2764 return p[name] = 1; 2765 }); 2766 vars = p; 2767 } 2768 vars = _addAliasesToVars(parsedTargets, vars); 2769 } 2770 i = parsedTargets.length; 2771 while (i--) { 2772 if (~killingTargets.indexOf(parsedTargets[i])) { 2773 curLookup = propTweenLookup[i]; 2774 if (vars === "all") { 2775 overwrittenProps[i] = vars; 2776 props = curLookup; 2777 curOverwriteProps = {}; 2778 } else { 2779 curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {}; 2780 props = vars; 2781 } 2782 for (p in props) { 2783 pt = curLookup && curLookup[p]; 2784 if (pt) { 2785 if (!("kill" in pt.d) || pt.d.kill(p) === true) { 2786 _removeLinkedListItem(this, pt, "_pt"); 2787 } 2788 delete curLookup[p]; 2789 } 2790 if (curOverwriteProps !== "all") { 2791 curOverwriteProps[p] = 1; 2792 } 2793 } 2794 } 2795 } 2796 this._initted && !this._pt && firstPT && _interrupt(this); 2797 return this; 2798 }; 2799 Tween.to = function to(targets, vars) { 2800 return new Tween(targets, vars, arguments[2]); 2801 }; 2802 Tween.from = function from(targets, vars) { 2803 return _createTweenType(1, arguments); 2804 }; 2805 Tween.delayedCall = function delayedCall(delay, callback, params, scope) { 2806 return new Tween(callback, 0, { 2807 immediateRender: false, 2808 lazy: false, 2809 overwrite: false, 2810 delay: delay, 2811 onComplete: callback, 2812 onReverseComplete: callback, 2813 onCompleteParams: params, 2814 onReverseCompleteParams: params, 2815 callbackScope: scope 2816 }); 2817 }; 2818 Tween.fromTo = function fromTo(targets, fromVars, toVars) { 2819 return _createTweenType(2, arguments); 2820 }; 2821 Tween.set = function set(targets, vars) { 2822 vars.duration = 0; 2823 vars.repeatDelay || (vars.repeat = 0); 2824 return new Tween(targets, vars); 2825 }; 2826 Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) { 2827 return _globalTimeline.killTweensOf(targets, props, onlyActive); 2828 }; 2829 return Tween; 2830 }(Animation); 2831 _setDefaults(Tween.prototype, { 2832 _targets: [], 2833 _lazy: 0, 2834 _startAt: 0, 2835 _op: 0, 2836 _onInit: 0 2837 }); 2838 _forEachName("staggerTo,staggerFrom,staggerFromTo", function (name) { 2839 Tween[name] = function () { 2840 var tl = new Timeline(), 2841 params = _slice.call(arguments, 0); 2842 params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0); 2843 return tl[name].apply(tl, params); 2844 }; 2845 }); 2846 var _setterPlain = function _setterPlain(target, property, value) { 2847 return target[property] = value; 2848 }, 2849 _setterFunc = function _setterFunc(target, property, value) { 2850 return target[property](value); 2851 }, 2852 _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) { 2853 return target[property](data.fp, value); 2854 }, 2855 _setterAttribute = function _setterAttribute(target, property, value) { 2856 return target.setAttribute(property, value); 2857 }, 2858 _getSetter = function _getSetter(target, property) { 2859 return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain; 2860 }, 2861 _renderPlain = function _renderPlain(ratio, data) { 2862 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1000000) / 1000000, data); 2863 }, 2864 _renderBoolean = function _renderBoolean(ratio, data) { 2865 return data.set(data.t, data.p, !!(data.s + data.c * ratio), data); 2866 }, 2867 _renderComplexString = function _renderComplexString(ratio, data) { 2868 var pt = data._pt, 2869 s = ""; 2870 if (!ratio && data.b) { 2871 s = data.b; 2872 } else if (ratio === 1 && data.e) { 2873 s = data.e; 2874 } else { 2875 while (pt) { 2876 s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s; 2877 pt = pt._next; 2878 } 2879 s += data.c; 2880 } 2881 data.set(data.t, data.p, s, data); 2882 }, 2883 _renderPropTweens = function _renderPropTweens(ratio, data) { 2884 var pt = data._pt; 2885 while (pt) { 2886 pt.r(ratio, pt.d); 2887 pt = pt._next; 2888 } 2889 }, 2890 _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) { 2891 var pt = this._pt, 2892 next; 2893 while (pt) { 2894 next = pt._next; 2895 pt.p === property && pt.modifier(modifier, tween, target); 2896 pt = next; 2897 } 2898 }, 2899 _killPropTweensOf = function _killPropTweensOf(property) { 2900 var pt = this._pt, 2901 hasNonDependentRemaining, 2902 next; 2903 while (pt) { 2904 next = pt._next; 2905 if (pt.p === property && !pt.op || pt.op === property) { 2906 _removeLinkedListItem(this, pt, "_pt"); 2907 } else if (!pt.dep) { 2908 hasNonDependentRemaining = 1; 2909 } 2910 pt = next; 2911 } 2912 return !hasNonDependentRemaining; 2913 }, 2914 _setterWithModifier = function _setterWithModifier(target, property, value, data) { 2915 data.mSet(target, property, data.m.call(data.tween, value, data.mt), data); 2916 }, 2917 _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) { 2918 var pt = parent._pt, 2919 next, 2920 pt2, 2921 first, 2922 last; 2923 while (pt) { 2924 next = pt._next; 2925 pt2 = first; 2926 while (pt2 && pt2.pr > pt.pr) { 2927 pt2 = pt2._next; 2928 } 2929 if (pt._prev = pt2 ? pt2._prev : last) { 2930 pt._prev._next = pt; 2931 } else { 2932 first = pt; 2933 } 2934 if (pt._next = pt2) { 2935 pt2._prev = pt; 2936 } else { 2937 last = pt; 2938 } 2939 pt = next; 2940 } 2941 parent._pt = first; 2942 }; 2943 var PropTween = function () { 2944 function PropTween(next, target, prop, start, change, renderer, data, setter, priority) { 2945 this.t = target; 2946 this.s = start; 2947 this.c = change; 2948 this.p = prop; 2949 this.r = renderer || _renderPlain; 2950 this.d = data || this; 2951 this.set = setter || _setterPlain; 2952 this.pr = priority || 0; 2953 this._next = next; 2954 if (next) { 2955 next._prev = this; 2956 } 2957 } 2958 var _proto4 = PropTween.prototype; 2959 _proto4.modifier = function modifier(func, tween, target) { 2960 this.mSet = this.mSet || this.set; 2961 this.set = _setterWithModifier; 2962 this.m = func; 2963 this.mt = target; 2964 this.tween = tween; 2965 }; 2966 return PropTween; 2967 }(); 2968 _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", function (name) { 2969 return _reservedProps[name] = 1; 2970 }); 2971 _globals.TweenMax = _globals.TweenLite = Tween; 2972 _globals.TimelineLite = _globals.TimelineMax = Timeline; 2973 _globalTimeline = new Timeline({ 2974 sortChildren: false, 2975 defaults: _defaults, 2976 autoRemoveChildren: true, 2977 id: "root", 2978 smoothChildTiming: true 2979 }); 2980 _config.stringFilter = _colorStringFilter; 2981 var _media = [], 2982 _listeners = {}, 2983 _emptyArray = [], 2984 _lastMediaTime = 0, 2985 _dispatch = function _dispatch(type) { 2986 return (_listeners[type] || _emptyArray).map(function (f) { 2987 return f(); 2988 }); 2989 }, 2990 _onMediaChange = function _onMediaChange() { 2991 var time = Date.now(), 2992 matches = []; 2993 if (time - _lastMediaTime > 2) { 2994 _dispatch("matchMediaInit"); 2995 _media.forEach(function (c) { 2996 var queries = c.queries, 2997 conditions = c.conditions, 2998 match, 2999 p, 3000 anyMatch, 3001 toggled; 3002 for (p in queries) { 3003 match = _win.matchMedia(queries[p]).matches; 3004 match && (anyMatch = 1); 3005 if (match !== conditions[p]) { 3006 conditions[p] = match; 3007 toggled = 1; 3008 } 3009 } 3010 if (toggled) { 3011 c.revert(); 3012 anyMatch && matches.push(c); 3013 } 3014 }); 3015 _dispatch("matchMediaRevert"); 3016 matches.forEach(function (c) { 3017 return c.onMatch(c); 3018 }); 3019 _lastMediaTime = time; 3020 _dispatch("matchMedia"); 3021 } 3022 }; 3023 var Context = function () { 3024 function Context(func, scope) { 3025 this.selector = scope && selector(scope); 3026 this.data = []; 3027 this._r = []; 3028 this.isReverted = false; 3029 func && this.add(func); 3030 } 3031 var _proto5 = Context.prototype; 3032 _proto5.add = function add(name, func, scope) { 3033 if (_isFunction(name)) { 3034 scope = func; 3035 func = name; 3036 name = _isFunction; 3037 } 3038 var self = this, 3039 f = function f() { 3040 var prev = _context, 3041 prevSelector = self.selector, 3042 result; 3043 prev && prev !== self && prev.data.push(self); 3044 scope && (self.selector = selector(scope)); 3045 _context = self; 3046 result = func.apply(self, arguments); 3047 _isFunction(result) && self._r.push(result); 3048 _context = prev; 3049 self.selector = prevSelector; 3050 self.isReverted = false; 3051 return result; 3052 }; 3053 self.last = f; 3054 return name === _isFunction ? f(self) : name ? self[name] = f : f; 3055 }; 3056 _proto5.ignore = function ignore(func) { 3057 var prev = _context; 3058 _context = null; 3059 func(this); 3060 _context = prev; 3061 }; 3062 _proto5.getTweens = function getTweens() { 3063 var a = []; 3064 this.data.forEach(function (e) { 3065 return e instanceof Context ? a.push.apply(a, e.getTweens()) : e instanceof Tween && !(e.parent && e.parent.data === "nested") && a.push(e); 3066 }); 3067 return a; 3068 }; 3069 _proto5.clear = function clear() { 3070 this._r.length = this.data.length = 0; 3071 }; 3072 _proto5.kill = function kill(revert, matchMedia) { 3073 var _this4 = this; 3074 if (revert) { 3075 var tweens = this.getTweens(); 3076 this.data.forEach(function (t) { 3077 if (t.data === "isFlip") { 3078 t.revert(); 3079 t.getChildren(true, true, false).forEach(function (tween) { 3080 return tweens.splice(tweens.indexOf(tween), 1); 3081 }); 3082 } 3083 }); 3084 tweens.map(function (t) { 3085 return { 3086 g: t.globalTime(0), 3087 t: t 3088 }; 3089 }).sort(function (a, b) { 3090 return b.g - a.g || -1; 3091 }
3091).forEach(function (o) { 3092 return o.t.revert(revert); 3093 }); 3094 this.data.forEach(function (e) { 3095 return !(e instanceof Animation) && e.revert && e.revert(revert); 3096 }); 3097 this._r.forEach(function (f) { 3098 return f(revert, _this4); 3099 }); 3100 this.isReverted = true; 3101 } else { 3102 this.data.forEach(function (e) { 3103 return e.kill && e.kill(); 3104 }); 3105 } 3106 this.clear(); 3107 if (matchMedia) { 3108 var i = _media.indexOf(this); 3109 !!~i && _media.splice(i, 1); 3110 } 3111 }; 3112 _proto5.revert = function revert(config) { 3113 this.kill(config || {}); 3114 }; 3115 return Context; 3116 }(); 3117 var MatchMedia = function () { 3118 function MatchMedia(scope) { 3119 this.contexts = []; 3120 this.scope = scope; 3121 } 3122 var _proto6 = MatchMedia.prototype; 3123 _proto6.add = function add(conditions, func, scope) { 3124 _isObject(conditions) || (conditions = { 3125 matches: conditions 3126 }); 3127 var context = new Context(0, scope || this.scope), 3128 cond = context.conditions = {}, 3129 mq, 3130 p, 3131 active; 3132 this.contexts.push(context); 3133 func = context.add("onMatch", func); 3134 context.queries = conditions; 3135 for (p in conditions) { 3136 if (p === "all") { 3137 active = 1; 3138 } else { 3139 mq = _win.matchMedia(conditions[p]); 3140 if (mq) { 3141 _media.indexOf(context) < 0 && _media.push(context); 3142 (cond[p] = mq.matches) && (active = 1); 3143 mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange); 3144 } 3145 } 3146 } 3147 active && func(context); 3148 return this; 3149 }; 3150 _proto6.revert = function revert(config) { 3151 this.kill(config || {}); 3152 }; 3153 _proto6.kill = function kill(revert) {
vendor: 30,543 bytes, lines 3154-3938
3154 this.contexts.forEach(function (c) { 3155 return c.kill(revert, true); 3156 }); 3157 }; 3158 return MatchMedia; 3159 }(); 3160 var _gsap = { 3161 registerPlugin: function registerPlugin() { 3162 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 3163 args[_key2] = arguments[_key2]; 3164 } 3165 args.forEach(function (config) { 3166 return _createPlugin(config); 3167 }); 3168 }, 3169 timeline: function timeline(vars) { 3170 return new Timeline(vars); 3171 }, 3172 getTweensOf: function getTweensOf(targets, onlyActive) { 3173 return _globalTimeline.getTweensOf(targets, onlyActive); 3174 }, 3175 getProperty: function getProperty(target, property, unit, uncache) { 3176 _isString(target) && (target = toArray(target)[0]); 3177 var getter = _getCache(target || {}).get, 3178 format = unit ? _passThrough : _numericIfPossible; 3179 unit === "native" && (unit = ""); 3180 return !target ? target : !property ? function (property, unit, uncache) { 3181 return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 3182 } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 3183 }, 3184 quickSetter: function quickSetter(target, property, unit) { 3185 target = toArray(target); 3186 if (target.length > 1) { 3187 var setters = target.map(function (t) { 3188 return gsap.quickSetter(t, property, unit); 3189 }), 3190 l = setters.length; 3191 return function (value) { 3192 var i = l; 3193 while (i--) { 3194 setters[i](value); 3195 } 3196 }; 3197 } 3198 target = target[0] || {}; 3199 var Plugin = _plugins[property], 3200 cache = _getCache(target), 3201 p = cache.harness && (cache.harness.aliases || {})[property] || property, 3202 setter = Plugin ? function (value) { 3203 var p = new Plugin(); 3204 _quickTween._pt = 0; 3205 p.init(target, unit ? value + unit : value, _quickTween, 0, [target]); 3206 p.render(1, p); 3207 _quickTween._pt && _renderPropTweens(1, _quickTween); 3208 } : cache.set(target, p); 3209 return Plugin ? setter : function (value) { 3210 return setter(target, p, unit ? value + unit : value, cache, 1); 3211 }; 3212 }, 3213 quickTo: function quickTo(target, property, vars) { 3214 var _merge2; 3215 var tween = gsap.to(target, _merge((_merge2 = {}, _merge2[property] = "+=0.1", _merge2.paused = true, _merge2), vars || {})), 3216 func = function func(value, start, startIsRelative) { 3217 return tween.resetTo(property, value, start, startIsRelative); 3218 }; 3219 func.tween = tween; 3220 return func; 3221 }, 3222 isTweening: function isTweening(targets) { 3223 return _globalTimeline.getTweensOf(targets, true).length > 0; 3224 }, 3225 defaults: function defaults(value) { 3226 value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease)); 3227 return _mergeDeep(_defaults, value || {}); 3228 }, 3229 config: function config(value) { 3230 return _mergeDeep(_config, value || {}); 3231 }, 3232 registerEffect: function registerEffect(_ref3) { 3233 var name = _ref3.name, 3234 effect = _ref3.effect, 3235 plugins = _ref3.plugins, 3236 defaults = _ref3.defaults, 3237 extendTimeline = _ref3.extendTimeline; 3238 (plugins || "").split(",").forEach(function (pluginName) { 3239 return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin."); 3240 }); 3241 _effects[name] = function (targets, vars, tl) { 3242 return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl); 3243 }; 3244 if (extendTimeline) { 3245 Timeline.prototype[name] = function (targets, vars, position) { 3246 return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position); 3247 }; 3248 } 3249 }, 3250 registerEase: function registerEase(name, ease) { 3251 _easeMap[name] = _parseEase(ease); 3252 }, 3253 parseEase: function parseEase(ease, defaultEase) { 3254 return arguments.length ? _parseEase(ease, defaultEase) : _easeMap; 3255 }, 3256 getById: function getById(id) { 3257 return _globalTimeline.getById(id); 3258 }, 3259 exportRoot: function exportRoot(vars, includeDelayedCalls) { 3260 if (vars === void 0) { 3261 vars = {}; 3262 } 3263 var tl = new Timeline(vars), 3264 child, 3265 next; 3266 tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming); 3267 _globalTimeline.remove(tl); 3268 tl._dp = 0; 3269 tl._time = tl._tTime = _globalTimeline._time; 3270 child = _globalTimeline._first; 3271 while (child) { 3272 next = child._next; 3273 if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) { 3274 _addToTimeline(tl, child, child._start - child._delay); 3275 } 3276 child = next; 3277 } 3278 _addToTimeline(_globalTimeline, tl, 0); 3279 return tl; 3280 }, 3281 context: function context(func, scope) { 3282 return func ? new Context(func, scope) : _context; 3283 }, 3284 matchMedia: function matchMedia(scope) { 3285 return new MatchMedia(scope); 3286 }, 3287 matchMediaRefresh: function matchMediaRefresh() { 3288 return _media.forEach(function (c) { 3289 var cond = c.conditions, 3290 found, 3291 p; 3292 for (p in cond) { 3293 if (cond[p]) { 3294 cond[p] = false; 3295 found = 1; 3296 } 3297 } 3298 found && c.revert(); 3299 }) || _onMediaChange(); 3300 }, 3301 addEventListener: function addEventListener(type, callback) { 3302 var a = _listeners[type] || (_listeners[type] = []); 3303 ~a.indexOf(callback) || a.push(callback); 3304 }, 3305 removeEventListener: function removeEventListener(type, callback) { 3306 var a = _listeners[type], 3307 i = a && a.indexOf(callback); 3308 i >= 0 && a.splice(i, 1); 3309 }, 3310 utils: { 3311 wrap: wrap, 3312 wrapYoyo: wrapYoyo, 3313 distribute: distribute, 3314 random: random, 3315 snap: snap, 3316 normalize: normalize, 3317 getUnit: getUnit, 3318 clamp: clamp, 3319 splitColor: splitColor, 3320 toArray: toArray, 3321 selector: selector, 3322 mapRange: mapRange, 3323 pipe: pipe, 3324 unitize: unitize, 3325 interpolate: interpolate, 3326 shuffle: shuffle 3327 }, 3328 install: _install, 3329 effects: _effects, 3330 ticker: _ticker, 3331 updateRoot: Timeline.updateRoot, 3332 plugins: _plugins, 3333 globalTimeline: _globalTimeline, 3334 core: { 3335 PropTween: PropTween, 3336 globals: _addGlobal, 3337 Tween: Tween, 3338 Timeline: Timeline, 3339 Animation: Animation, 3340 getCache: _getCache, 3341 _removeLinkedListItem: _removeLinkedListItem, 3342 reverting: function reverting() { 3343 return _reverting; 3344 }, 3345 context: function context(toAdd) { 3346 if (toAdd && _context) { 3347 _context.data.push(toAdd); 3348 toAdd._ctx = _context; 3349 } 3350 return _context; 3351 }, 3352 suppressOverwrites: function suppressOverwrites(value) { 3353 return _suppressOverwrites = value; 3354 } 3355 } 3356 }; 3357 _forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function (name) { 3358 return _gsap[name] = Tween[name]; 3359 }); 3360 _ticker.add(Timeline.updateRoot); 3361 _quickTween = _gsap.to({}, { 3362 duration: 0 3363 }); 3364 var _getPluginPropTween = function _getPluginPropTween(plugin, prop) { 3365 var pt = plugin._pt; 3366 while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) { 3367 pt = pt._next; 3368 } 3369 return pt; 3370 }, 3371 _addModifiers = function _addModifiers(tween, modifiers) { 3372 var targets = tween._targets, 3373 p, 3374 i, 3375 pt; 3376 for (p in modifiers) { 3377 i = targets.length; 3378 while (i--) { 3379 pt = tween._ptLookup[i][p]; 3380 if (pt && (pt = pt.d)) { 3381 if (pt._pt) { 3382 pt = _getPluginPropTween(pt, p); 3383 } 3384 pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p); 3385 } 3386 } 3387 } 3388 }, 3389 _buildModifierPlugin = function _buildModifierPlugin(name, modifier) { 3390 return { 3391 name: name, 3392 rawVars: 1, 3393 init: function init(target, vars, tween) { 3394 tween._onInit = function (tween) { 3395 var temp, p; 3396 if (_isString(vars)) { 3397 temp = {}; 3398 _forEachName(vars, function (name) { 3399 return temp[name] = 1; 3400 }); 3401 vars = temp; 3402 } 3403 if (modifier) { 3404 temp = {}; 3405 for (p in vars) { 3406 temp[p] = modifier(vars[p]); 3407 } 3408 vars = temp; 3409 } 3410 _addModifiers(tween, vars); 3411 }; 3412 } 3413 }; 3414 }; 3415 var gsap = _gsap.registerPlugin({ 3416 name: "attr", 3417 init: function init(target, vars, tween, index, targets) { 3418 var p, pt, v; 3419 this.tween = tween; 3420 for (p in vars) { 3421 v = target.getAttribute(p) || ""; 3422 pt = this.add(target, "setAttribute", (v || 0) + "", vars[p], index, targets, 0, 0, p); 3423 pt.op = p; 3424 pt.b = v; 3425 this._props.push(p); 3426 } 3427 }, 3428 render: function render(ratio, data) { 3429 var pt = data._pt; 3430 while (pt) { 3431 _reverting ? pt.set(pt.t, pt.p, pt.b, pt) : pt.r(ratio, pt.d); 3432 pt = pt._next; 3433 } 3434 } 3435 }, { 3436 name: "endArray", 3437 init: function init(target, value) { 3438 var i = value.length; 3439 while (i--) { 3440 this.add(target, i, target[i] || 0, value[i], 0, 0, 0, 0, 0, 1); 3441 } 3442 } 3443 }, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap; 3444 Tween.version = Timeline.version = gsap.version = "3.11.5"; 3445 _coreReady = 1; 3446 _windowExists() && _wake(); 3447 var Power0 = _easeMap.Power0, 3448 Power1 = _easeMap.Power1, 3449 Power2 = _easeMap.Power2, 3450 Power3 = _easeMap.Power3, 3451 Power4 = _easeMap.Power4, 3452 Linear = _easeMap.Linear, 3453 Quad = _easeMap.Quad, 3454 Cubic = _easeMap.Cubic, 3455 Quart = _easeMap.Quart, 3456 Quint = _easeMap.Quint, 3457 Strong = _easeMap.Strong, 3458 Elastic = _easeMap.Elastic, 3459 Back = _easeMap.Back, 3460 SteppedEase = _easeMap.SteppedEase, 3461 Bounce = _easeMap.Bounce, 3462 Sine = _easeMap.Sine, 3463 Expo = _easeMap.Expo, 3464 Circ = _easeMap.Circ; 3465 var _win$1, 3466 _doc$1, 3467 _docElement, 3468 _pluginInitted, 3469 _tempDiv, 3470 _recentSetterPlugin, 3471 _reverting$1, 3472 _windowExists$1 = function _windowExists() { 3473 return typeof window !== "undefined"; 3474 }, 3475 _transformProps = {}, 3476 _RAD2DEG = 180 / Math.PI, 3477 _DEG2RAD = Math.PI / 180, 3478 _atan2 = Math.atan2, 3479 _bigNum$1 = 1e8, 3480 _capsExp = /([A-Z])/g, 3481 _horizontalExp = /(left|right|width|margin|padding|x)/i, 3482 _complexExp = /[\s,\(]\S/, 3483 _propertyAliases = { 3484 autoAlpha: "opacity,visibility", 3485 scale: "scaleX,scaleY", 3486 alpha: "opacity" 3487 }, 3488 _renderCSSProp = function _renderCSSProp(ratio, data) { 3489 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); 3490 }, 3491 _renderPropWithEnd = function _renderPropWithEnd(ratio, data) { 3492 return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); 3493 }, 3494 _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) { 3495 return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u : data.b, data); 3496 }, 3497 _renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) { 3498 var value = data.s + data.c * ratio; 3499 data.set(data.t, data.p, ~~(value + (value < 0 ? -.5 : .5)) + data.u, data); 3500 }, 3501 _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) { 3502 return data.set(data.t, data.p, ratio ? data.e : data.b, data); 3503 }, 3504 _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) { 3505 return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data); 3506 }, 3507 _setterCSSStyle = function _setterCSSStyle(target, property, value) { 3508 return target.style[property] = value; 3509 }, 3510 _setterCSSProp = function _setterCSSProp(target, property, value) { 3511 return target.style.setProperty(property, value); 3512 }, 3513 _setterTransform = function _setterTransform(target, property, value) { 3514 return target._gsap[property] = value; 3515 }, 3516 _setterScale = function _setterScale(target, property, value) { 3517 return target._gsap.scaleX = target._gsap.scaleY = value; 3518 }, 3519 _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) { 3520 var cache = target._gsap; 3521 cache.scaleX = cache.scaleY = value; 3522 cache.renderTransform(ratio, cache); 3523 }, 3524 _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) { 3525 var cache = target._gsap; 3526 cache[property] = value; 3527 cache.renderTransform(ratio, cache); 3528 }, 3529 _transformProp = "transform", 3530 _transformOriginProp = _transformProp + "Origin", 3531 _saveStyle = function _saveStyle(property, isNotCSS) { 3532 var _this = this; 3533 var target = this.target, 3534 style = target.style; 3535 if (property in _transformProps) { 3536 this.tfm = this.tfm || {}; 3537 if (property !== "transform") { 3538 property = _propertyAliases[property] || property; 3539 ~property.indexOf(",") ? property.split(",").forEach(function (a) { 3540 return _this.tfm[a] = _get(target, a); 3541 }) : this.tfm[property] = target._gsap.x ? target._gsap[property] : _get(target, property); 3542 } else { 3543 return _propertyAliases.transform.split(",").forEach(function (p) { 3544 return _saveStyle.call(_this, p, isNotCSS); 3545 }); 3546 } 3547 if (this.props.indexOf(_transformProp) >= 0) { 3548 return; 3549 } 3550 if (target._gsap.svg) { 3551 this.svgo = target.getAttribute("data-svg-origin"); 3552 this.props.push(_transformOriginProp, isNotCSS, ""); 3553 } 3554 property = _transformProp; 3555 } 3556 (style || isNotCSS) && this.props.push(property, isNotCSS, style[property]); 3557 }, 3558 _removeIndependentTransforms = function _removeIndependentTransforms(style) { 3559 if (style.translate) { 3560 style.removeProperty("translate"); 3561 style.removeProperty("scale"); 3562 style.removeProperty("rotate"); 3563 } 3564 }, 3565 _revertStyle = function _revertStyle() { 3566 var props = this.props, 3567 target = this.target, 3568 style = target.style, 3569 cache = target._gsap, 3570 i, 3571 p; 3572 for (i = 0; i < props.length; i += 3) { 3573 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()); 3574 } 3575 if (this.tfm) { 3576 for (p in this.tfm) { 3577 cache[p] = this.tfm[p]; 3578 } 3579 if (cache.svg) { 3580 cache.renderTransform(); 3581 target.setAttribute("data-svg-origin", this.svgo || ""); 3582 } 3583 i = _reverting$1(); 3584 if ((!i || !i.isStart) && !style[_transformProp]) { 3585 _removeIndependentTransforms(style); 3586 cache.uncache = 1; 3587 } 3588 } 3589 }, 3590 _getStyleSaver = function _getStyleSaver(target, properties) { 3591 var saver = { 3592 target: target, 3593 props: [], 3594 revert: _revertStyle, 3595 save: _saveStyle 3596 }; 3597 target._gsap || gsap.core.getCache(target); 3598 properties && properties.split(",").forEach(function (p) { 3599 return saver.save(p); 3600 }); 3601 return saver; 3602 }, 3603 _supports3D, 3604 _createElement = function _createElement(type, ns) { 3605 var e = _doc$1.createElementNS ? _doc$1.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc$1.createElement(type); 3606 return e.style ? e : _doc$1.createElement(type); 3607 }, 3608 _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) { 3609 var cs = getComputedStyle(target); 3610 return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || ""; 3611 }, 3612 _prefixes = "O,Moz,ms,Ms,Webkit".split(","), 3613 _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) { 3614 var e = element || _tempDiv, 3615 s = e.style, 3616 i = 5; 3617 if (property in s && !preferPrefix) { 3618 return property; 3619 } 3620 property = property.charAt(0).toUpperCase() + property.substr(1); 3621 while (i-- && !(_prefixes[i] + property in s)) {} 3622 return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property; 3623 }, 3624 _initCore = function _initCore() { 3625 if (_windowExists$1() && window.document) { 3626 _win$1 = window; 3627 _doc$1 = _win$1.document; 3628 _docElement = _doc$1.documentElement; 3629 _tempDiv = _createElement("div") || { 3630 style: {} 3631 }; 3632 _createElement("div"); 3633 _transformProp = _checkPropPrefix(_transformProp); 3634 _transformOriginProp = _transformProp + "Origin"; 3635 _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0"; 3636 _supports3D = !!_checkPropPrefix("perspective"); 3637 _reverting$1 = gsap.core.reverting; 3638 _pluginInitted = 1; 3639 } 3640 }, 3641 _getBBoxHack = function _getBBoxHack(swapIfPossible) { 3642 var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), 3643 oldParent = this.parentNode, 3644 oldSibling = this.nextSibling, 3645 oldCSS = this.style.cssText, 3646 bbox; 3647 _docElement.appendChild(svg); 3648 svg.appendChild(this); 3649 this.style.display = "block"; 3650 if (swapIfPossible) { 3651 try { 3652 bbox = this.getBBox(); 3653 this._gsapBBox = this.getBBox; 3654 this.getBBox = _getBBoxHack; 3655 } catch (e) {} 3656 } else if (this._gsapBBox) { 3657 bbox = this._gsapBBox(); 3658 } 3659 if (oldParent) { 3660 if (oldSibling) { 3661 oldParent.insertBefore(this, oldSibling); 3662 } else { 3663 oldParent.appendChild(this); 3664 } 3665 } 3666 _docElement.removeChild(svg); 3667 this.style.cssText = oldCSS; 3668 return bbox; 3669 }, 3670 _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) { 3671 var i = attributesArray.length; 3672 while (i--) { 3673 if (target.hasAttribute(attributesArray[i])) { 3674 return target.getAttribute(attributesArray[i]); 3675 } 3676 } 3677 }, 3678 _getBBox = function _getBBox(target) { 3679 var bounds; 3680 try { 3681 bounds = target.getBBox(); 3682 } catch (error) { 3683 bounds = _getBBoxHack.call(target, true); 3684 } 3685 bounds && (bounds.width || bounds.height) || target.getBBox === _getBBoxHack || (bounds = _getBBoxHack.call(target, true)); 3686 return bounds && !bounds.width && !bounds.x && !bounds.y ? { 3687 x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0, 3688 y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0, 3689 width: 0, 3690 height: 0 3691 } : bounds; 3692 }, 3693 _isSVG = function _isSVG(e) { 3694 return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e)); 3695 }, 3696 _removeProperty = function _removeProperty(target, property) { 3697 if (property) { 3698 var style = target.style; 3699 if (property in _transformProps && property !== _transformOriginProp) { 3700 property = _transformProp; 3701 } 3702 if (style.removeProperty) { 3703 if (property.substr(0, 2) === "ms" || property.substr(0, 6) === "webkit") { 3704 property = "-" + property; 3705 } 3706 style.removeProperty(property.replace(_capsExp, "-$1").toLowerCase()); 3707 } else { 3708 style.removeAttribute(property); 3709 } 3710 } 3711 }, 3712 _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) { 3713 var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue); 3714 plugin._pt = pt; 3715 pt.b = beginning; 3716 pt.e = end; 3717 plugin._props.push(property); 3718 return pt; 3719 }, 3720 _nonConvertibleUnits = { 3721 deg: 1, 3722 rad: 1, 3723 turn: 1 3724 }, 3725 _nonStandardLayouts = { 3726 grid: 1, 3727 flex: 1 3728 }, 3729 _convertToUnit = function _convertToUnit(target, property, value, unit) { 3730 var curValue = parseFloat(value) || 0, 3731 curUnit = (value + "").trim().substr((curValue + "").length) || "px", 3732 style = _tempDiv.style, 3733 horizontal = _horizontalExp.test(property), 3734 isRootSVG = target.tagName.toLowerCase() === "svg", 3735 measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"), 3736 amount = 100, 3737 toPixels = unit === "px", 3738 toPercent = unit === "%", 3739 px, 3740 parent, 3741 cache, 3742 isSVG; 3743 if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) { 3744 return curValue; 3745 } 3746 curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px")); 3747 isSVG = target.getCTM && _isSVG(target); 3748 if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) { 3749 px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty]; 3750 return _round(toPercent ? curValue / px * amount : curValue / 100 * px); 3751 } 3752 style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit); 3753 parent = ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode; 3754 if (isSVG) { 3755 parent = (target.ownerSVGElement || {}).parentNode; 3756 } 3757 if (!parent || parent === _doc$1 || !parent.appendChild) { 3758 parent = _doc$1.body; 3759 } 3760 cache = parent._gsap; 3761 if (cache && toPercent && cache.width && horizontal && cache.time === _ticker.time && !cache.uncache) { 3762 return _round(curValue / cache.width * amount); 3763 } else { 3764 (toPercent || curUnit === "%") && !_nonStandardLayouts[_getComputedProperty(parent, "display")] && (style.position = _getComputedProperty(target, "position")); 3765 parent === target && (style.position = "static"); 3766 parent.appendChild(_tempDiv); 3767 px = _tempDiv[measureProperty]; 3768 parent.removeChild(_tempDiv); 3769 style.position = "absolute"; 3770 if (horizontal && toPercent) { 3771 cache = _getCache(parent); 3772 cache.time = _ticker.time; 3773 cache.width = parent[measureProperty]; 3774 } 3775 } 3776 return _round(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0); 3777 }, 3778 _get = function _get(target, property, unit, uncache) { 3779 var value; 3780 _pluginInitted || _initCore(); 3781 if (property in _propertyAliases && property !== "transform") { 3782 property = _propertyAliases[property]; 3783 if (~property.indexOf(",")) { 3784 property = property.split(",")[0]; 3785 } 3786 } 3787 if (_transformProps[property] && property !== "transform") { 3788 value = _parseTransform(target, uncache); 3789 value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px"; 3790 } else { 3791 value = target.style[property]; 3792 if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) { 3793 value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0); 3794 } 3795 } 3796 return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value; 3797 }, 3798 _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) { 3799 if (!start || start === "none") { 3800 var p = _checkPropPrefix(prop, target, 1), 3801 s = p && _getComputedProperty(target, p, 1); 3802 if (s && s !== start) { 3803 prop = p; 3804 start = s; 3805 } else if (prop === "borderColor") { 3806 start = _getComputedProperty(target, "borderTopColor"); 3807 } 3808 } 3809 var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString), 3810 index = 0, 3811 matchIndex = 0, 3812 a, 3813 result, 3814 startValues, 3815 startNum, 3816 color, 3817 startValue, 3818 endValue, 3819 endNum, 3820 chunk, 3821 endUnit, 3822 startUnit, 3823 endValues; 3824 pt.b = start; 3825 pt.e = end; 3826 start += ""; 3827 end += ""; 3828 if (end === "auto") { 3829 target.style[prop] = end; 3830 end = _getComputedProperty(target, prop) || end; 3831 target.style[prop] = start; 3832 } 3833 a = [start, end]; 3834 _colorStringFilter(a); 3835 start = a[0]; 3836 end = a[1]; 3837 startValues = start.match(_numWithUnitExp) || []; 3838 endValues = end.match(_numWithUnitExp) || []; 3839 if (endValues.length) { 3840 while (result = _numWithUnitExp.exec(end)) { 3841 endValue = result[0]; 3842 chunk = end.substring(index, result.index); 3843 if (color) { 3844 color = (color + 1) % 5; 3845 } else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") { 3846 color = 1; 3847 } 3848 if (endValue !== (startValue = startValues[matchIndex++] || "")) { 3849 startNum = parseFloat(startValue) || 0; 3850 startUnit = startValue.substr((startNum + "").length); 3851 endValue.charAt(1) === "=" && (endValue = _parseRelative(startNum, endValue) + startUnit); 3852 endNum = parseFloat(endValue); 3853 endUnit = endValue.substr((endNum + "").length); 3854 index = _numWithUnitExp.lastIndex - endUnit.length; 3855 if (!endUnit) { 3856 endUnit = endUnit || _config.units[prop] || startUnit; 3857 if (index === end.length) { 3858 end += endUnit; 3859 pt.e += endUnit; 3860 } 3861 } 3862 if (startUnit !== endUnit) { 3863 startNum = _convertToUnit(target, prop, startValue, endUnit) || 0; 3864 } 3865 pt._pt = { 3866 _next: pt._pt, 3867 p: chunk || matchIndex === 1 ? chunk : ",", 3868 s: startNum, 3869 c: endNum - startNum, 3870 m: color && color < 4 || prop === "zIndex" ? Math.round : 0 3871 }; 3872 } 3873 } 3874 pt.c = index < end.length ? end.substring(index, end.length) : ""; 3875 } else { 3876 pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue; 3877 } 3878 _relExp.test(end) && (pt.e = 0); 3879 this._pt = pt; 3880 return pt; 3881 }, 3882 _keywordToPercent = { 3883 top: "0%", 3884 bottom: "100%", 3885 left: "0%", 3886 right: "100%", 3887 center: "50%" 3888 }, 3889 _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) { 3890 var split = value.split(" "), 3891 x = split[0], 3892 y = split[1] || "50%"; 3893 if (x === "top" || x === "bottom" || y === "left" || y === "right") { 3894 value = x; 3895 x = y; 3896 y = value; 3897 } 3898 split[0] = _keywordToPercent[x] || x; 3899 split[1] = _keywordToPercent[y] || y; 3900 return split.join(" "); 3901 }, 3902 _renderClearProps = function _renderClearProps(ratio, data) { 3903 if (data.tween && data.tween._time === data.tween._dur) { 3904 var target = data.t, 3905 style = target.style, 3906 props = data.u, 3907 cache = target._gsap, 3908 prop, 3909 clearTransforms, 3910 i; 3911 if (props === "all" || props === true) { 3912 style.cssText = ""; 3913 clearTransforms = 1; 3914 } else { 3915 props = props.split(","); 3916 i = props.length; 3917 while (--i > -1) { 3918 prop = props[i]; 3919 if (_transformProps[prop]) { 3920 clearTransforms = 1; 3921 prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp; 3922 } 3923 _removeProperty(target, prop); 3924 } 3925 } 3926 if (clearTransforms) { 3927 _removeProperty(target, _transformProp); 3928 if (cache) { 3929 cache.svg && target.removeAttribute("transform"); 3930 _parseTransform(target, 1); 3931 cache.uncache = 1; 3932 _removeIndependentTransforms(style); 3933 } 3934 } 3935 } 3936 }, 3937 _specialProps = { 3938 clearProps: function clearProps(plugin, target, property, endValue, tween) {
vendor: 20,544 bytes, lines 3939-4443
3939 if (tween.data !== "isFromStart") { 3940 var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps); 3941 pt.u = endValue; 3942 pt.pr = -10; 3943 pt.tween = tween; 3944 plugin._props.push(property); 3945 return 1; 3946 } 3947 } 3948 }, 3949 _identity2DMatrix = [1, 0, 0, 1, 0, 0], 3950 _rotationalProperties = {}, 3951 _isNullTransform = function _isNullTransform(value) { 3952 return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value; 3953 }, 3954 _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) { 3955 var matrixString = _getComputedProperty(target, _transformProp); 3956 return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp).map(_round); 3957 }, 3958 _getMatrix = function _getMatrix(target, force2D) { 3959 var cache = target._gsap || _getCache(target), 3960 style = target.style, 3961 matrix = _getComputedTransformMatrixAsArray(target), 3962 parent, 3963 nextSibling, 3964 temp, 3965 addedToDOM; 3966 if (cache.svg && target.getAttribute("transform")) { 3967 temp = target.transform.baseVal.consolidate().matrix; 3968 matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f]; 3969 return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix; 3970 } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) { 3971 temp = style.display; 3972 style.display = "block"; 3973 parent = target.parentNode; 3974 if (!parent || !target.offsetParent) { 3975 addedToDOM = 1; 3976 nextSibling = target.nextElementSibling; 3977 _docElement.appendChild(target); 3978 } 3979 matrix = _getComputedTransformMatrixAsArray(target); 3980 temp ? style.display = temp : _removeProperty(target, "display"); 3981 if (addedToDOM) { 3982 nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target); 3983 } 3984 } 3985 return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix; 3986 }, 3987 _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) { 3988 var cache = target._gsap, 3989 matrix = matrixArray || _getMatrix(target, true), 3990 xOriginOld = cache.xOrigin || 0, 3991 yOriginOld = cache.yOrigin || 0, 3992 xOffsetOld = cache.xOffset || 0, 3993 yOffsetOld = cache.yOffset || 0, 3994 a = matrix[0], 3995 b = matrix[1], 3996 c = matrix[2], 3997 d = matrix[3], 3998 tx = matrix[4], 3999 ty = matrix[5], 4000 originSplit = origin.split(" "), 4001 xOrigin = parseFloat(originSplit[0]) || 0, 4002 yOrigin = parseFloat(originSplit[1]) || 0, 4003 bounds, 4004 determinant, 4005 x, 4006 y; 4007 if (!originIsAbsolute) { 4008 bounds = _getBBox(target); 4009 xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width : xOrigin); 4010 yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin); 4011 } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) { 4012 x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant; 4013 y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant; 4014 xOrigin = x; 4015 yOrigin = y; 4016 } 4017 if (smooth || smooth !== false && cache.smooth) { 4018 tx = xOrigin - xOriginOld; 4019 ty = yOrigin - yOriginOld; 4020 cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx; 4021 cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty; 4022 } else { 4023 cache.xOffset = cache.yOffset = 0; 4024 } 4025 cache.xOrigin = xOrigin; 4026 cache.yOrigin = yOrigin; 4027 cache.smooth = !!smooth; 4028 cache.origin = origin; 4029 cache.originIsAbsolute = !!originIsAbsolute; 4030 target.style[_transformOriginProp] = "0px 0px"; 4031 if (pluginToAddPropTweensTo) { 4032 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin); 4033 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin); 4034 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset); 4035 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset); 4036 } 4037 target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin); 4038 }, 4039 _parseTransform = function _parseTransform(target, uncache) { 4040 var cache = target._gsap || new GSCache(target); 4041 if ("x" in cache && !uncache && !cache.uncache) { 4042 return cache; 4043 } 4044 var style = target.style, 4045 invertedScaleX = cache.scaleX < 0, 4046 px = "px", 4047 deg = "deg", 4048 cs = getComputedStyle(target), 4049 origin = _getComputedProperty(target, _transformOriginProp) || "0", 4050 x, 4051 y, 4052 z, 4053 scaleX, 4054 scaleY, 4055 rotation, 4056 rotationX, 4057 rotationY, 4058 skewX, 4059 skewY, 4060 perspective, 4061 xOrigin, 4062 yOrigin, 4063 matrix, 4064 angle, 4065 cos, 4066 sin, 4067 a, 4068 b, 4069 c, 4070 d, 4071 a12, 4072 a22, 4073 t1, 4074 t2, 4075 t3, 4076 a13, 4077 a23, 4078 a33, 4079 a42, 4080 a43, 4081 a32; 4082 x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0; 4083 scaleX = scaleY = 1; 4084 cache.svg = !!(target.getCTM && _isSVG(target)); 4085 if (cs.translate) { 4086 if (cs.translate !== "none" || cs.scale !== "none" || cs.rotate !== "none") { 4087 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] : ""); 4088 } 4089 style.scale = style.rotate = style.translate = "none"; 4090 } 4091 matrix = _getMatrix(target, cache.svg); 4092 if (cache.svg) { 4093 if (cache.uncache) { 4094 t2 = target.getBBox(); 4095 origin = cache.xOrigin - t2.x + "px " + (cache.yOrigin - t2.y) + "px"; 4096 t1 = ""; 4097 } else { 4098 t1 = !uncache && target.getAttribute("data-svg-origin"); 4099 } 4100 _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix); 4101 } 4102 xOrigin = cache.xOrigin || 0; 4103 yOrigin = cache.yOrigin || 0; 4104 if (matrix !== _identity2DMatrix) { 4105 a = matrix[0]; 4106 b = matrix[1]; 4107 c = matrix[2]; 4108 d = matrix[3]; 4109 x = a12 = matrix[4]; 4110 y = a22 = matrix[5]; 4111 if (matrix.length === 6) { 4112 scaleX = Math.sqrt(a * a + b * b); 4113 scaleY = Math.sqrt(d * d + c * c); 4114 rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0; 4115 skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0; 4116 skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD))); 4117 if (cache.svg) { 4118 x -= xOrigin - (xOrigin * a + yOrigin * c); 4119 y -= yOrigin - (xOrigin * b + yOrigin * d); 4120 } 4121 } else { 4122 a32 = matrix[6]; 4123 a42 = matrix[7]; 4124 a13 = matrix[8]; 4125 a23 = matrix[9]; 4126 a33 = matrix[10]; 4127 a43 = matrix[11]; 4128 x = matrix[12]; 4129 y = matrix[13]; 4130 z = matrix[14]; 4131 angle = _atan2(a32, a33); 4132 rotationX = angle * _RAD2DEG; 4133 if (angle) { 4134 cos = Math.cos(-angle); 4135 sin = Math.sin(-angle); 4136 t1 = a12 * cos + a13 * sin; 4137 t2 = a22 * cos + a23 * sin; 4138 t3 = a32 * cos + a33 * sin; 4139 a13 = a12 * -sin + a13 * cos; 4140 a23 = a22 * -sin + a23 * cos; 4141 a33 = a32 * -sin + a33 * cos; 4142 a43 = a42 * -sin + a43 * cos; 4143 a12 = t1; 4144 a22 = t2; 4145 a32 = t3; 4146 } 4147 angle = _atan2(-c, a33); 4148 rotationY = angle * _RAD2DEG; 4149 if (angle) { 4150 cos = Math.cos(-angle); 4151 sin = Math.sin(-angle); 4152 t1 = a * cos - a13 * sin; 4153 t2 = b * cos - a23 * sin; 4154 t3 = c * cos - a33 * sin; 4155 a43 = d * sin + a43 * cos; 4156 a = t1; 4157 b = t2; 4158 c = t3; 4159 } 4160 angle = _atan2(b, a); 4161 rotation = angle * _RAD2DEG; 4162 if (angle) { 4163 cos = Math.cos(angle); 4164 sin = Math.sin(angle); 4165 t1 = a * cos + b * sin; 4166 t2 = a12 * cos + a22 * sin; 4167 b = b * cos - a * sin; 4168 a22 = a22 * cos - a12 * sin; 4169 a = t1; 4170 a12 = t2; 4171 } 4172 if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) { 4173 rotationX = rotation = 0; 4174 rotationY = 180 - rotationY; 4175 } 4176 scaleX = _round(Math.sqrt(a * a + b * b + c * c)); 4177 scaleY = _round(Math.sqrt(a22 * a22 + a32 * a32)); 4178 angle = _atan2(a12, a22); 4179 skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0; 4180 perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0; 4181 } 4182 if (cache.svg) { 4183 t1 = target.getAttribute("transform"); 4184 cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp)); 4185 t1 && target.setAttribute("transform", t1); 4186 } 4187 } 4188 if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) { 4189 if (invertedScaleX) { 4190 scaleX *= -1; 4191 skewX += rotation <= 0 ? 180 : -180; 4192 rotation += rotation <= 0 ? 180 : -180; 4193 } else { 4194 scaleY *= -1; 4195 skewX += skewX <= 0 ? 180 : -180; 4196 } 4197 } 4198 uncache = uncache || cache.uncache; 4199 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; 4200 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; 4201 cache.z = z + px; 4202 cache.scaleX = _round(scaleX); 4203 cache.scaleY = _round(scaleY); 4204 cache.rotation = _round(rotation) + deg; 4205 cache.rotationX = _round(rotationX) + deg; 4206 cache.rotationY = _round(rotationY) + deg; 4207 cache.skewX = skewX + deg; 4208 cache.skewY = skewY + deg; 4209 cache.transformPerspective = perspective + px; 4210 if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || 0) { 4211 style[_transformOriginProp] = _firstTwoOnly(origin); 4212 } 4213 cache.xOffset = cache.yOffset = 0; 4214 cache.force3D = _config.force3D; 4215 cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms; 4216 cache.uncache = 0; 4217 return cache; 4218 }, 4219 _firstTwoOnly = function _firstTwoOnly(value) { 4220 return (value = value.split(" "))[0] + " " + value[1]; 4221 }, 4222 _addPxTranslate = function _addPxTranslate(target, start, value) { 4223 var unit = getUnit(start); 4224 return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit; 4225 }, 4226 _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) { 4227 cache.z = "0px"; 4228 cache.rotationY = cache.rotationX = "0deg"; 4229 cache.force3D = 0; 4230 _renderCSSTransforms(ratio, cache); 4231 }, 4232 _zeroDeg = "0deg", 4233 _zeroPx = "0px", 4234 _endParenthesis = ") ", 4235 _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) { 4236 var _ref = cache || this, 4237 xPercent = _ref.xPercent, 4238 yPercent = _ref.yPercent, 4239 x = _ref.x, 4240 y = _ref.y, 4241 z = _ref.z, 4242 rotation = _ref.rotation, 4243 rotationY = _ref.rotationY, 4244 rotationX = _ref.rotationX, 4245 skewX = _ref.skewX, 4246 skewY = _ref.skewY, 4247 scaleX = _ref.scaleX, 4248 scaleY = _ref.scaleY, 4249 transformPerspective = _ref.transformPerspective, 4250 force3D = _ref.force3D, 4251 target = _ref.target, 4252 zOrigin = _ref.zOrigin, 4253 transforms = "", 4254 use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true; 4255 if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) { 4256 var angle = parseFloat(rotationY) * _DEG2RAD, 4257 a13 = Math.sin(angle), 4258 a33 = Math.cos(angle), 4259 cos; 4260 angle = parseFloat(rotationX) * _DEG2RAD; 4261 cos = Math.cos(angle); 4262 x = _addPxTranslate(target, x, a13 * cos * -zOrigin); 4263 y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin); 4264 z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin); 4265 } 4266 if (transformPerspective !== _zeroPx) { 4267 transforms += "perspective(" + transformPerspective + _endParenthesis; 4268 } 4269 if (xPercent || yPercent) { 4270 transforms += "translate(" + xPercent + "%, " + yPercent + "%) "; 4271 } 4272 if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) { 4273 transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis; 4274 } 4275 if (rotation !== _zeroDeg) { 4276 transforms += "rotate(" + rotation + _endParenthesis; 4277 } 4278 if (rotationY !== _zeroDeg) { 4279 transforms += "rotateY(" + rotationY + _endParenthesis; 4280 } 4281 if (rotationX !== _zeroDeg) { 4282 transforms += "rotateX(" + rotationX + _endParenthesis; 4283 } 4284 if (skewX !== _zeroDeg || skewY !== _zeroDeg) { 4285 transforms += "skew(" + skewX + ", " + skewY + _endParenthesis; 4286 } 4287 if (scaleX !== 1 || scaleY !== 1) { 4288 transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis; 4289 } 4290 target.style[_transformProp] = transforms || "translate(0, 0)"; 4291 }, 4292 _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) { 4293 var _ref2 = cache || this, 4294 xPercent = _ref2.xPercent, 4295 yPercent = _ref2.yPercent, 4296 x = _ref2.x, 4297 y = _ref2.y, 4298 rotation = _ref2.rotation, 4299 skewX = _ref2.skewX, 4300 skewY = _ref2.skewY, 4301 scaleX = _ref2.scaleX, 4302 scaleY = _ref2.scaleY, 4303 target = _ref2.target, 4304 xOrigin = _ref2.xOrigin, 4305 yOrigin = _ref2.yOrigin, 4306 xOffset = _ref2.xOffset, 4307 yOffset = _ref2.yOffset, 4308 forceCSS = _ref2.forceCSS, 4309 tx = parseFloat(x), 4310 ty = parseFloat(y), 4311 a11, 4312 a21, 4313 a12, 4314 a22, 4315 temp; 4316 rotation = parseFloat(rotation); 4317 skewX = parseFloat(skewX); 4318 skewY = parseFloat(skewY); 4319 if (skewY) { 4320 skewY = parseFloat(skewY); 4321 skewX += skewY; 4322 rotation += skewY; 4323 } 4324 if (rotation || skewX) { 4325 rotation *= _DEG2RAD; 4326 skewX *= _DEG2RAD; 4327 a11 = Math.cos(rotation) * scaleX; 4328 a21 = Math.sin(rotation) * scaleX; 4329 a12 = Math.sin(rotation - skewX) * -scaleY; 4330 a22 = Math.cos(rotation - skewX) * scaleY; 4331 if (skewX) { 4332 skewY *= _DEG2RAD; 4333 temp = Math.tan(skewX - skewY); 4334 temp = Math.sqrt(1 + temp * temp); 4335 a12 *= temp; 4336 a22 *= temp; 4337 if (skewY) { 4338 temp = Math.tan(skewY); 4339 temp = Math.sqrt(1 + temp * temp); 4340 a11 *= temp; 4341 a21 *= temp; 4342 } 4343 } 4344 a11 = _round(a11); 4345 a21 = _round(a21); 4346 a12 = _round(a12); 4347 a22 = _round(a22); 4348 } else { 4349 a11 = scaleX; 4350 a22 = scaleY; 4351 a21 = a12 = 0; 4352 } 4353 if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) { 4354 tx = _convertToUnit(target, "x", x, "px"); 4355 ty = _convertToUnit(target, "y", y, "px"); 4356 } 4357 if (xOrigin || yOrigin || xOffset || yOffset) { 4358 tx = _round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset); 4359 ty = _round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset); 4360 } 4361 if (xPercent || yPercent) { 4362 temp = target.getBBox(); 4363 tx = _round(tx + xPercent / 100 * temp.width); 4364 ty = _round(ty + yPercent / 100 * temp.height); 4365 } 4366 temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")"; 4367 target.setAttribute("transform", temp); 4368 forceCSS && (target.style[_transformProp] = temp); 4369 }, 4370 _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue) { 4371 var cap = 360, 4372 isString = _isString(endValue), 4373 endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1), 4374 change = endNum - startNum, 4375 finalValue = startNum + change + "deg", 4376 direction, 4377 pt; 4378 if (isString) { 4379 direction = endValue.split("_")[1]; 4380 if (direction === "short") { 4381 change %= cap; 4382 if (change !== change % (cap / 2)) { 4383 change += change < 0 ? cap : -cap; 4384 } 4385 } 4386 if (direction === "cw" && change < 0) { 4387 change = (change + cap * _bigNum$1) % cap - ~~(change / cap) * cap; 4388 } else if (direction === "ccw" && change > 0) { 4389 change = (change - cap * _bigNum$1) % cap - ~~(change / cap) * cap; 4390 } 4391 } 4392 plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd); 4393 pt.e = finalValue; 4394 pt.u = "deg"; 4395 plugin._props.push(property); 4396 return pt; 4397 }, 4398 _assign = function _assign(target, source) { 4399 for (var p in source) { 4400 target[p] = source[p]; 4401 } 4402 return target; 4403 }, 4404 _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) { 4405 var startCache = _assign({}, target._gsap), 4406 exclude = "perspective,force3D,transformOrigin,svgOrigin", 4407 style = target.style, 4408 endCache, 4409 p, 4410 startValue, 4411 endValue, 4412 startNum, 4413 endNum, 4414 startUnit, 4415 endUnit; 4416 if (startCache.svg) { 4417 startValue = target.getAttribute("transform"); 4418 target.setAttribute("transform", ""); 4419 style[_transformProp] = transforms; 4420 endCache = _parseTransform(target, 1); 4421 _removeProperty(target, _transformProp); 4422 target.setAttribute("transform", startValue); 4423 } else { 4424 startValue = getComputedStyle(target)[_transformProp]; 4425 style[_transformProp] = transforms; 4426 endCache = _parseTransform(target, 1); 4427 style[_transformProp] = startValue; 4428 } 4429 for (p in _transformProps) { 4430 startValue = startCache[p]; 4431 endValue = endCache[p]; 4432 if (startValue !== endValue && exclude.indexOf(p) < 0) { 4433 startUnit = getUnit(startValue); 4434 endUnit = getUnit(endValue); 4435 startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue); 4436 endNum = parseFloat(endValue); 4437 plugin._pt = new PropTween(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp); 4438 plugin._pt.u = endUnit || 0; 4439 plugin._props.push(p); 4440 } 4441 } 4442 _assign(endCache, startCache); 4443 };
vendor: 9,902 bytes, lines 4444-4650
4444 _forEachName("padding,margin,Width,Radius", function (name, index) { 4445 var t = "Top", 4446 r = "Right", 4447 b = "Bottom", 4448 l = "Left", 4449 props = (index < 3 ? [t, r, b, l] : [t + l, t + r, b + r, b + l]).map(function (side) { 4450 return index < 2 ? name + side : "border" + side + name; 4451 }); 4452 _specialProps[index > 1 ? "border" + name : name] = function (plugin, target, property, endValue, tween) { 4453 var a, vars; 4454 if (arguments.length < 4) { 4455 a = props.map(function (prop) { 4456 return _get(plugin, prop, property); 4457 }); 4458 vars = a.join(" "); 4459 return vars.split(a[0]).length === 5 ? a[0] : vars; 4460 } 4461 a = (endValue + "").split(" "); 4462 vars = {}; 4463 props.forEach(function (prop, i) { 4464 return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0]; 4465 }); 4466 plugin.init(target, vars, tween); 4467 }; 4468 }); 4469 var CSSPlugin = { 4470 name: "css", 4471 register: _initCore, 4472 targetTest: function targetTest(target) { 4473 return target.style && target.nodeType; 4474 }, 4475 init: function init(target, vars, tween, index, targets) { 4476 var props = this._props, 4477 style = target.style, 4478 startAt = tween.vars.startAt, 4479 startValue, 4480 endValue, 4481 endNum, 4482 startNum, 4483 type, 4484 specialProp, 4485 p, 4486 startUnit, 4487 endUnit, 4488 relative, 4489 isTransformRelated, 4490 transformPropTween, 4491 cache, 4492 smooth, 4493 hasPriority, 4494 inlineProps; 4495 _pluginInitted || _initCore(); 4496 this.styles = this.styles || _getStyleSaver(target); 4497 inlineProps = this.styles.props; 4498 this.tween = tween; 4499 for (p in vars) { 4500 if (p === "autoRound") { 4501 continue; 4502 } 4503 endValue = vars[p]; 4504 if (_plugins[p] && _checkPlugin(p, vars, tween, index, target, targets)) { 4505 continue; 4506 } 4507 type = typeof endValue; 4508 specialProp = _specialProps[p]; 4509 if (type === "function") { 4510 endValue = endValue.call(tween, index, target, targets); 4511 type = typeof endValue; 4512 } 4513 if (type === "string" && ~endValue.indexOf("random(")) { 4514 endValue = _replaceRandom(endValue); 4515 } 4516 if (specialProp) { 4517 specialProp(this, target, p, endValue, tween) && (hasPriority = 1); 4518 } else if (p.substr(0, 2) === "--") { 4519 startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim(); 4520 endValue += ""; 4521 _colorExp.lastIndex = 0; 4522 if (!_colorExp.test(startValue)) { 4523 startUnit = getUnit(startValue); 4524 endUnit = getUnit(endValue); 4525 } 4526 endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit); 4527 this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p); 4528 props.push(p); 4529 inlineProps.push(p, 0, style[p]); 4530 } else if (type !== "undefined") { 4531 if (startAt && p in startAt) { 4532 startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p]; 4533 _isString(startValue) && ~startValue.indexOf("random(") && (startValue = _replaceRandom(startValue)); 4534 getUnit(startValue + "") || (startValue += _config.units[p] || getUnit(_get(target, p)) || ""); 4535 (startValue + "").charAt(1) === "=" && (startValue = _get(target, p)); 4536 } else { 4537 startValue = _get(target, p); 4538 } 4539 startNum = parseFloat(startValue); 4540 relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2); 4541 relative && (endValue = endValue.substr(2)); 4542 endNum = parseFloat(endValue); 4543 if (p in _propertyAliases) { 4544 if (p === "autoAlpha") { 4545 if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) { 4546 startNum = 0; 4547 } 4548 inlineProps.push("visibility", 0, style.visibility); 4549 _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum); 4550 } 4551 if (p !== "scale" && p !== "transform") { 4552 p = _propertyAliases[p]; 4553 ~p.indexOf(",") && (p = p.split(",")[0]); 4554 } 4555 } 4556 isTransformRelated = p in _transformProps; 4557 if (isTransformRelated) { 4558 this.styles.save(p); 4559 if (!transformPropTween) { 4560 cache = target._gsap; 4561 cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform); 4562 smooth = vars.smoothOrigin !== false && cache.smooth; 4563 transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1); 4564 transformPropTween.dep = 1; 4565 } 4566 if (p === "scale") { 4567 this._pt = new PropTween(this._pt, cache, "scaleY", cache.scaleY, (relative ? _parseRelative(cache.scaleY, relative + endNum) : endNum) - cache.scaleY || 0, _renderCSSProp); 4568 this._pt.u = 0; 4569 props.push("scaleY", p); 4570 p += "X"; 4571 } else if (p === "transformOrigin") { 4572 inlineProps.push(_transformOriginProp, 0, style[_transformOriginProp]); 4573 endValue = _convertKeywordsToPercentages(endValue); 4574 if (cache.svg) { 4575 _applySVGOrigin(target, endValue, 0, smooth, 0, this); 4576 } else { 4577 endUnit = parseFloat(endValue.split(" ")[2]) || 0; 4578 endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit); 4579 _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue)); 4580 } 4581 continue; 4582 } else if (p === "svgOrigin") { 4583 _applySVGOrigin(target, endValue, 1, smooth, 0, this); 4584 continue; 4585 } else if (p in _rotationalProperties) { 4586 _addRotationalPropTween(this, cache, p, startNum, relative ? _parseRelative(startNum, relative + endValue) : endValue); 4587 continue; 4588 } else if (p === "smoothOrigin") { 4589 _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue); 4590 continue; 4591 } else if (p === "force3D") { 4592 cache[p] = endValue; 4593 continue; 4594 } else if (p === "transform") { 4595 _addRawTransformPTs(this, endValue, target); 4596 continue; 4597 } 4598 } else if (!(p in style)) { 4599 p = _checkPropPrefix(p) || p; 4600 } 4601 if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) { 4602 startUnit = (startValue + "").substr((startNum + "").length); 4603 endNum || (endNum = 0); 4604 endUnit = getUnit(endValue) || (p in _config.units ? _config.units[p] : startUnit); 4605 startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit)); 4606 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); 4607 this._pt.u = endUnit || 0; 4608 if (startUnit !== endUnit && endUnit !== "%") { 4609 this._pt.b = startValue; 4610 this._pt.r = _renderCSSPropWithBeginning; 4611 } 4612 } else if (!(p in style)) { 4613 if (p in target) { 4614 this.add(target, p, startValue || target[p], relative ? relative + endValue : endValue, index, targets); 4615 } else if (p !== "parseTransform") { 4616 _missingPlugin(p, endValue); 4617 continue; 4618 } 4619 } else { 4620 _tweenComplexCSSString.call(this, target, p, startValue, relative ? relative + endValue : endValue); 4621 } 4622 isTransformRelated || (p in style ? inlineProps.push(p, 0, style[p]) : inlineProps.push(p, 1, startValue || target[p])); 4623 props.push(p); 4624 } 4625 } 4626 hasPriority && _sortPropTweensByPriority(this); 4627 }, 4628 render: function render(ratio, data) { 4629 if (data.tween._time || !_reverting$1()) { 4630 var pt = data._pt; 4631 while (pt) { 4632 pt.r(ratio, pt.d); 4633 pt = pt._next; 4634 } 4635 } else { 4636 data.styles.revert(); 4637 } 4638 }, 4639 get: _get, 4640 aliases: _propertyAliases, 4641 getSetter: function getSetter(target, property, plugin) { 4642 var p = _propertyAliases[property]; 4643 p && p.indexOf(",") < 0 && (property = p); 4644 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); 4645 }, 4646 core: { 4647 _removeProperty: _removeProperty, 4648 _getMatrix: _getMatrix 4649 } 4650 };
4651 gsap.utils.checkPrefix = _checkPropPrefix; 4652 gsap.core.getStyleSaver = _getStyleSaver; 4653 (function (positionAndScale, rotation, others, aliases) { 4654 var all = _forEachName(positionAndScale + "," + rotation + "," + others, function (name) { 4655 _transformProps[name] = 1; 4656 }); 4657 _forEachName(rotation, function (name) { 4658 _config.units[name] = "deg"; 4659 _rotationalProperties[name] = 1; 4660 }); 4661 _propertyAliases[all[13]] = positionAndScale + "," + rotation; 4662 _forEachName(aliases, function (name) { 4663 var split = name.split(":"); 4664 _propertyAliases[split[1]] = all[split[0]]; 4665 }); 4666 })("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"); 4667 _forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function (name) { 4668 _config.units[name] = "px"; 4669 }); 4670 gsap.registerPlugin(CSSPlugin); 4671 var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap, 4672 TweenMaxWithCSS = gsapWithCSS.core.Tween; 4673 exports.Back = Back; 4674 exports.Bounce = Bounce; 4675 exports.CSSPlugin = CSSPlugin; 4676 exports.Circ = Circ; 4677 exports.Cubic = Cubic; 4678 exports.Elastic = Elastic; 4679 exports.Expo = Expo; 4680 exports.Linear = Linear; 4681 exports.Power0 = Power0; 4682 exports.Power1 = Power1; 4683 exports.Power2 = Power2; 4684 exports.Power3 = Power3; 4685 exports.Power4 = Power4; 4686 exports.Quad = Quad; 4687 exports.Quart = Quart; 4688 exports.Quint = Quint; 4689 exports.Sine = Sine; 4690 exports.SteppedEase = SteppedEase; 4691 exports.Strong = Strong; 4692 exports.TimelineLite = Timeline; 4693 exports.TimelineMax = Timeline; 4694 exports.TweenLite = Tween; 4695 exports.TweenMax = TweenMaxWithCSS; 4696 exports.default = gsapWithCSS; 4697 exports.gsap = gsapWithCSS; 4698 if (typeof window === 'undefined' || window !== exports) { 4699 Object.defineProperty(exports, '__esModule', { 4700 value: true 4701 }); 4702 } else { 4703 delete window.default; 4704 } 4705 }); 4706})(gsap, gsap.exports); 4707var gsapExports = gsap.exports; 4708 4709var ScrollTrigger = {exports: {}}; 4710 4711(function (module, exports) { 4712 (function (global, factory) { 4713 factory(exports) ; 4714 })(commonjsGlobal, function (exports) { 4715 4716 function _defineProperties(target, props) { 4717 for (var i = 0; i < props.length; i++) { 4718 var descriptor = props[i]; 4719 descriptor.enumerable = descriptor.enumerable || false; 4720 descriptor.configurable = true; 4721 if ("value" in descriptor) descriptor.writable = true; 4722 Object.defineProperty(target, descriptor.key, descriptor); 4723 } 4724 } 4725 function _createClass(Constructor, protoProps, staticProps) { 4726 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 4727 if (staticProps) _defineProperties(Constructor, staticProps); 4728 return Constructor; 4729 } 4730 4731 /*! 4732 * Observer 3.11.5 4733 * https://greensock.com 4734 * 4735 * @license Copyright 2008-2023, GreenSock. All rights reserved. 4736 * Subject to the terms at https://greensock.com/standard-license or for 4737 * Club GreenSock members, the agreement issued with that membership. 4738 * @author: Jack Doyle, [email protected] 4739 */ 4740 var gsap, 4741 _coreInitted, 4742 _win, 4743 _doc, 4744 _docEl, 4745 _body, 4746 _isTouch, 4747 _pointerType, 4748 ScrollTrigger, 4749 _root, 4750 _normalizer, 4751 _eventTypes, 4752 _context, 4753 _getGSAP = function _getGSAP() { 4754 return gsap || typeof window !== "undefined" && (gsap = window.gsap) && gsap.registerPlugin && gsap; 4755 }, 4756 _startup = 1, 4757 _observers = [], 4758 _scrollers = [], 4759 _proxies = [], 4760 _getTime = Date.now, 4761 _bridge = function _bridge(name, value) { 4762 return value; 4763 }, 4764 _integrate = function _integrate() { 4765 var core = ScrollTrigger.core, 4766 data = core.bridge || {}, 4767 scrollers = core._scrollers, 4768 proxies = core._proxies; 4769 scrollers.push.apply(scrollers, _scrollers);
vendor: 10,541 bytes, lines 4770-5025
4770 proxies.push.apply(proxies, _proxies); 4771 _scrollers = scrollers; 4772 _proxies = proxies; 4773 _bridge = function _bridge(name, value) { 4774 return data[name](value); 4775 }; 4776 }, 4777 _getProxyProp = function _getProxyProp(element, property) { 4778 return ~_proxies.indexOf(element) && _proxies[_proxies.indexOf(element) + 1][property]; 4779 }, 4780 _isViewport = function _isViewport(el) { 4781 return !!~_root.indexOf(el); 4782 }, 4783 _addListener = function _addListener(element, type, func, nonPassive, capture) { 4784 return element.addEventListener(type, func, { 4785 passive: !nonPassive, 4786 capture: !!capture 4787 }); 4788 }, 4789 _removeListener = function _removeListener(element, type, func, capture) { 4790 return element.removeEventListener(type, func, !!capture); 4791 }, 4792 _scrollLeft = "scrollLeft", 4793 _scrollTop = "scrollTop", 4794 _onScroll = function _onScroll() { 4795 return _normalizer && _normalizer.isPressed || _scrollers.cache++; 4796 }, 4797 _scrollCacheFunc = function _scrollCacheFunc(f, doNotCache) { 4798 var cachingFunc = function cachingFunc(value) { 4799 if (value || value === 0) { 4800 _startup && (_win.history.scrollRestoration = "manual"); 4801 var isNormalizing = _normalizer && _normalizer.isPressed; 4802 value = cachingFunc.v = Math.round(value) || (_normalizer && _normalizer.iOS ? 1 : 0); 4803 f(value); 4804 cachingFunc.cacheID = _scrollers.cache; 4805 isNormalizing && _bridge("ss", value); 4806 } else if (doNotCache || _scrollers.cache !== cachingFunc.cacheID || _bridge("ref")) { 4807 cachingFunc.cacheID = _scrollers.cache; 4808 cachingFunc.v = f(); 4809 } 4810 return cachingFunc.v + cachingFunc.offset; 4811 }; 4812 cachingFunc.offset = 0; 4813 return f && cachingFunc; 4814 }, 4815 _horizontal = { 4816 s: _scrollLeft, 4817 p: "left", 4818 p2: "Left", 4819 os: "right", 4820 os2: "Right", 4821 d: "width", 4822 d2: "Width", 4823 a: "x", 4824 sc: _scrollCacheFunc(function (value) { 4825 return arguments.length ? _win.scrollTo(value, _vertical.sc()) : _win.pageXOffset || _doc[_scrollLeft] || _docEl[_scrollLeft] || _body[_scrollLeft] || 0; 4826 }) 4827 }, 4828 _vertical = { 4829 s: _scrollTop, 4830 p: "top", 4831 p2: "Top", 4832 os: "bottom", 4833 os2: "Bottom", 4834 d: "height", 4835 d2: "Height", 4836 a: "y", 4837 op: _horizontal, 4838 sc: _scrollCacheFunc(function (value) { 4839 return arguments.length ? _win.scrollTo(_horizontal.sc(), value) : _win.pageYOffset || _doc[_scrollTop] || _docEl[_scrollTop] || _body[_scrollTop] || 0; 4840 }) 4841 }, 4842 _getTarget = function _getTarget(t) { 4843 return gsap.utils.toArray(t)[0] || (typeof t === "string" && gsap.config().nullTargetWarn !== false ? console.warn("Element not found:", t) : null); 4844 }, 4845 _getScrollFunc = function _getScrollFunc(element, _ref) { 4846 var s = _ref.s, 4847 sc = _ref.sc; 4848 _isViewport(element) && (element = _doc.scrollingElement || _docEl); 4849 var i = _scrollers.indexOf(element), 4850 offset = sc === _vertical.sc ? 1 : 2; 4851 !~i && (i = _scrollers.push(element) - 1); 4852 _scrollers[i + offset] || element.addEventListener("scroll", _onScroll); 4853 var prev = _scrollers[i + offset], 4854 func = prev || (_scrollers[i + offset] = _scrollCacheFunc(_getProxyProp(element, s), true) || (_isViewport(element) ? sc : _scrollCacheFunc(function (value) { 4855 return arguments.length ? element[s] = value : element[s]; 4856 }))); 4857 func.target = element; 4858 prev || (func.smooth = gsap.getProperty(element, "scrollBehavior") === "smooth"); 4859 return func; 4860 }, 4861 _getVelocityProp = function _getVelocityProp(value, minTimeRefresh, useDelta) { 4862 var v1 = value, 4863 v2 = value, 4864 t1 = _getTime(), 4865 t2 = t1, 4866 min = minTimeRefresh || 50, 4867 dropToZeroTime = Math.max(500, min * 3), 4868 update = function update(value, force) { 4869 var t = _getTime(); 4870 if (force || t - t1 > min) { 4871 v2 = v1; 4872 v1 = value; 4873 t2 = t1; 4874 t1 = t; 4875 } else if (useDelta) { 4876 v1 += value; 4877 } else { 4878 v1 = v2 + (value - v2) / (t - t2) * (t1 - t2); 4879 } 4880 }, 4881 reset = function reset() { 4882 v2 = v1 = useDelta ? 0 : v1; 4883 t2 = t1 = 0; 4884 }, 4885 getVelocity = function getVelocity(latestValue) { 4886 var tOld = t2, 4887 vOld = v2, 4888 t = _getTime(); 4889 (latestValue || latestValue === 0) && latestValue !== v1 && update(latestValue); 4890 return t1 === t2 || t - t2 > dropToZeroTime ? 0 : (v1 + (useDelta ? vOld : -vOld)) / ((useDelta ? t : t1) - tOld) * 1000; 4891 }; 4892 return { 4893 update: update, 4894 reset: reset, 4895 getVelocity: getVelocity 4896 }; 4897 }, 4898 _getEvent = function _getEvent(e, preventDefault) { 4899 preventDefault && !e._gsapAllow && e.preventDefault(); 4900 return e.changedTouches ? e.changedTouches[0] : e; 4901 }, 4902 _getAbsoluteMax = function _getAbsoluteMax(a) { 4903 var max = Math.max.apply(Math, a), 4904 min = Math.min.apply(Math, a); 4905 return Math.abs(max) >= Math.abs(min) ? max : min; 4906 }, 4907 _setScrollTrigger = function _setScrollTrigger() { 4908 ScrollTrigger = gsap.core.globals().ScrollTrigger; 4909 ScrollTrigger && ScrollTrigger.core && _integrate(); 4910 }, 4911 _initCore = function _initCore(core) { 4912 gsap = core || _getGSAP(); 4913 if (gsap && typeof document !== "undefined" && document.body) { 4914 _win = window; 4915 _doc = document; 4916 _docEl = _doc.documentElement; 4917 _body = _doc.body; 4918 _root = [_win, _doc, _docEl, _body]; 4919 gsap.utils.clamp; 4920 _context = gsap.core.context || function () {}; 4921 _pointerType = "onpointerenter" in _body ? "pointer" : "mouse"; 4922 _isTouch = Observer.isTouch = _win.matchMedia && _win.matchMedia("(hover: none), (pointer: coarse)").matches ? 1 : "ontouchstart" in _win || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0 ? 2 : 0; 4923 _eventTypes = Observer.eventTypes = ("ontouchstart" in _docEl ? "touchstart,touchmove,touchcancel,touchend" : !("onpointerdown" in _docEl) ? "mousedown,mousemove,mouseup,mouseup" : "pointerdown,pointermove,pointercancel,pointerup").split(","); 4924 setTimeout(function () { 4925 return _startup = 0; 4926 }, 500); 4927 _setScrollTrigger(); 4928 _coreInitted = 1; 4929 } 4930 return _coreInitted; 4931 }; 4932 _horizontal.op = _vertical; 4933 _scrollers.cache = 0; 4934 var Observer = function () { 4935 function Observer(vars) { 4936 this.init(vars); 4937 } 4938 var _proto = Observer.prototype; 4939 _proto.init = function init(vars) { 4940 _coreInitted || _initCore(gsap) || console.warn("Please gsap.registerPlugin(Observer)"); 4941 ScrollTrigger || _setScrollTrigger(); 4942 var tolerance = vars.tolerance, 4943 dragMinimum = vars.dragMinimum, 4944 type = vars.type, 4945 target = vars.target, 4946 lineHeight = vars.lineHeight, 4947 debounce = vars.debounce, 4948 preventDefault = vars.preventDefault, 4949 onStop = vars.onStop, 4950 onStopDelay = vars.onStopDelay, 4951 ignore = vars.ignore, 4952 wheelSpeed = vars.wheelSpeed, 4953 event = vars.event, 4954 onDragStart = vars.onDragStart, 4955 onDragEnd = vars.onDragEnd, 4956 onDrag = vars.onDrag, 4957 onPress = vars.onPress, 4958 onRelease = vars.onRelease, 4959 onRight = vars.onRight, 4960 onLeft = vars.onLeft, 4961 onUp = vars.onUp, 4962 onDown = vars.onDown, 4963 onChangeX = vars.onChangeX, 4964 onChangeY = vars.onChangeY, 4965 onChange = vars.onChange, 4966 onToggleX = vars.onToggleX, 4967 onToggleY = vars.onToggleY, 4968 onHover = vars.onHover, 4969 onHoverEnd = vars.onHoverEnd, 4970 onMove = vars.onMove, 4971 ignoreCheck = vars.ignoreCheck, 4972 isNormalizer = vars.isNormalizer, 4973 onGestureStart = vars.onGestureStart, 4974 onGestureEnd = vars.onGestureEnd, 4975 onWheel = vars.onWheel, 4976 onEnable = vars.onEnable, 4977 onDisable = vars.onDisable, 4978 onClick = vars.onClick, 4979 scrollSpeed = vars.scrollSpeed, 4980 capture = vars.capture, 4981 allowClicks = vars.allowClicks, 4982 lockAxis = vars.lockAxis, 4983 onLockAxis = vars.onLockAxis; 4984 this.target = target = _getTarget(target) || _docEl; 4985 this.vars = vars; 4986 ignore && (ignore = gsap.utils.toArray(ignore)); 4987 tolerance = tolerance || 1e-9; 4988 dragMinimum = dragMinimum || 0; 4989 wheelSpeed = wheelSpeed || 1; 4990 scrollSpeed = scrollSpeed || 1; 4991 type = type || "wheel,touch,pointer"; 4992 debounce = debounce !== false; 4993 lineHeight || (lineHeight = parseFloat(_win.getComputedStyle(_body).lineHeight) || 22); 4994 var id, 4995 onStopDelayedCall, 4996 dragged, 4997 moved, 4998 wheeled, 4999 locked, 5000 axis, 5001 self = this, 5002 prevDeltaX = 0, 5003 prevDeltaY = 0, 5004 scrollFuncX = _getScrollFunc(target, _horizontal), 5005 scrollFuncY = _getScrollFunc(target, _vertical), 5006 scrollX = scrollFuncX(), 5007 scrollY = scrollFuncY(), 5008 limitToTouch = ~type.indexOf("touch") && !~type.indexOf("pointer") && _eventTypes[0] === "pointerdown", 5009 isViewport = _isViewport(target), 5010 ownerDoc = target.ownerDocument || _doc, 5011 deltaX = [0, 0, 0], 5012 deltaY = [0, 0, 0], 5013 onClickTime = 0, 5014 clickCapture = function clickCapture() { 5015 return onClickTime = _getTime(); 5016 }, 5017 _ignoreCheck = function _ignoreCheck(e, isPointerOrTouch) { 5018 return (self.event = e) && ignore && ~ignore.indexOf(e.target) || isPointerOrTouch && limitToTouch && e.pointerType !== "touch" || ignoreCheck && ignoreCheck(e, isPointerOrTouch); 5019 }, 5020 onStopFunc = function onStopFunc() { 5021 self._vx.reset(); 5022 self._vy.reset(); 5023 onStopDelayedCall.pause(); 5024 onStop && onStop(self); 5025 },
vendor: 10,507 bytes, lines 5026-5255
5026 update = function update() { 5027 var dx = self.deltaX = _getAbsoluteMax(deltaX), 5028 dy = self.deltaY = _getAbsoluteMax(deltaY), 5029 changedX = Math.abs(dx) >= tolerance, 5030 changedY = Math.abs(dy) >= tolerance; 5031 onChange && (changedX || changedY) && onChange(self, dx, dy, deltaX, deltaY); 5032 if (changedX) { 5033 onRight && self.deltaX > 0 && onRight(self); 5034 onLeft && self.deltaX < 0 && onLeft(self); 5035 onChangeX && onChangeX(self); 5036 onToggleX && self.deltaX < 0 !== prevDeltaX < 0 && onToggleX(self); 5037 prevDeltaX = self.deltaX; 5038 deltaX[0] = deltaX[1] = deltaX[2] = 0; 5039 } 5040 if (changedY) { 5041 onDown && self.deltaY > 0 && onDown(self); 5042 onUp && self.deltaY < 0 && onUp(self); 5043 onChangeY && onChangeY(self); 5044 onToggleY && self.deltaY < 0 !== prevDeltaY < 0 && onToggleY(self); 5045 prevDeltaY = self.deltaY; 5046 deltaY[0] = deltaY[1] = deltaY[2] = 0; 5047 } 5048 if (moved || dragged) { 5049 onMove && onMove(self); 5050 if (dragged) { 5051 onDrag(self); 5052 dragged = false; 5053 } 5054 moved = false; 5055 } 5056 locked && !(locked = false) && onLockAxis && onLockAxis(self); 5057 if (wheeled) { 5058 onWheel(self); 5059 wheeled = false; 5060 } 5061 id = 0; 5062 }, 5063 onDelta = function onDelta(x, y, index) { 5064 deltaX[index] += x; 5065 deltaY[index] += y; 5066 self._vx.update(x); 5067 self._vy.update(y); 5068 debounce ? id || (id = requestAnimationFrame(update)) : update(); 5069 }, 5070 onTouchOrPointerDelta = function onTouchOrPointerDelta(x, y) { 5071 if (lockAxis && !axis) { 5072 self.axis = axis = Math.abs(x) > Math.abs(y) ? "x" : "y"; 5073 locked = true; 5074 } 5075 if (axis !== "y") { 5076 deltaX[2] += x; 5077 self._vx.update(x, true); 5078 } 5079 if (axis !== "x") { 5080 deltaY[2] += y; 5081 self._vy.update(y, true); 5082 } 5083 debounce ? id || (id = requestAnimationFrame(update)) : update(); 5084 }, 5085 _onDrag = function _onDrag(e) { 5086 if (_ignoreCheck(e, 1)) { 5087 return; 5088 } 5089 e = _getEvent(e, preventDefault); 5090 var x = e.clientX, 5091 y = e.clientY, 5092 dx = x - self.x, 5093 dy = y - self.y, 5094 isDragging = self.isDragging; 5095 self.x = x; 5096 self.y = y; 5097 if (isDragging || Math.abs(self.startX - x) >= dragMinimum || Math.abs(self.startY - y) >= dragMinimum) { 5098 onDrag && (dragged = true); 5099 isDragging || (self.isDragging = true); 5100 onTouchOrPointerDelta(dx, dy); 5101 isDragging || onDragStart && onDragStart(self); 5102 } 5103 }, 5104 _onPress = self.onPress = function (e) { 5105 if (_ignoreCheck(e, 1) || e && e.button) { 5106 return; 5107 } 5108 self.axis = axis = null; 5109 onStopDelayedCall.pause(); 5110 self.isPressed = true; 5111 e = _getEvent(e); 5112 prevDeltaX = prevDeltaY = 0; 5113 self.startX = self.x = e.clientX; 5114 self.startY = self.y = e.clientY; 5115 self._vx.reset(); 5116 self._vy.reset(); 5117 _addListener(isNormalizer ? target : ownerDoc, _eventTypes[1], _onDrag, preventDefault, true); 5118 self.deltaX = self.deltaY = 0; 5119 onPress && onPress(self); 5120 }, 5121 _onRelease = self.onRelease = function (e) { 5122 if (_ignoreCheck(e, 1)) { 5123 return; 5124 } 5125 _removeListener(isNormalizer ? target : ownerDoc, _eventTypes[1], _onDrag, true); 5126 var isTrackingDrag = !isNaN(self.y - self.startY), 5127 wasDragging = self.isDragging && (Math.abs(self.x - self.startX) > 3 || Math.abs(self.y - self.startY) > 3), 5128 eventData = _getEvent(e); 5129 if (!wasDragging && isTrackingDrag) { 5130 self._vx.reset(); 5131 self._vy.reset(); 5132 if (preventDefault && allowClicks) { 5133 gsap.delayedCall(0.08, function () { 5134 if (_getTime() - onClickTime > 300 && !e.defaultPrevented) { 5135 if (e.target.click) { 5136 e.target.click(); 5137 } else if (ownerDoc.createEvent) { 5138 var syntheticEvent = ownerDoc.createEvent("MouseEvents"); 5139 syntheticEvent.initMouseEvent("click", true, true, _win, 1, eventData.screenX, eventData.screenY, eventData.clientX, eventData.clientY, false, false, false, false, 0, null); 5140 e.target.dispatchEvent(syntheticEvent); 5141 } 5142 } 5143 }); 5144 } 5145 } 5146 self.isDragging = self.isGesturing = self.isPressed = false; 5147 onStop && !isNormalizer && onStopDelayedCall.restart(true); 5148 onDragEnd && wasDragging && onDragEnd(self); 5149 onRelease && onRelease(self, wasDragging); 5150 }, 5151 _onGestureStart = function _onGestureStart(e) { 5152 return e.touches && e.touches.length > 1 && (self.isGesturing = true) && onGestureStart(e, self.isDragging); 5153 }, 5154 _onGestureEnd = function _onGestureEnd() { 5155 return (self.isGesturing = false) || onGestureEnd(self); 5156 }, 5157 onScroll = function onScroll(e) { 5158 if (_ignoreCheck(e)) { 5159 return; 5160 } 5161 var x = scrollFuncX(), 5162 y = scrollFuncY(); 5163 onDelta((x - scrollX) * scrollSpeed, (y - scrollY) * scrollSpeed, 1); 5164 scrollX = x; 5165 scrollY = y; 5166 onStop && onStopDelayedCall.restart(true); 5167 }, 5168 _onWheel = function _onWheel(e) { 5169 if (_ignoreCheck(e)) { 5170 return; 5171 } 5172 e = _getEvent(e, preventDefault); 5173 onWheel && (wheeled = true); 5174 var multiplier = (e.deltaMode === 1 ? lineHeight : e.deltaMode === 2 ? _win.innerHeight : 1) * wheelSpeed; 5175 onDelta(e.deltaX * multiplier, e.deltaY * multiplier, 0); 5176 onStop && !isNormalizer && onStopDelayedCall.restart(true); 5177 }, 5178 _onMove = function _onMove(e) { 5179 if (_ignoreCheck(e)) { 5180 return; 5181 } 5182 var x = e.clientX, 5183 y = e.clientY, 5184 dx = x - self.x, 5185 dy = y - self.y; 5186 self.x = x; 5187 self.y = y; 5188 moved = true; 5189 (dx || dy) && onTouchOrPointerDelta(dx, dy); 5190 }, 5191 _onHover = function _onHover(e) { 5192 self.event = e; 5193 onHover(self); 5194 }, 5195 _onHoverEnd = function _onHoverEnd(e) { 5196 self.event = e; 5197 onHoverEnd(self); 5198 }, 5199 _onClick = function _onClick(e) { 5200 return _ignoreCheck(e) || _getEvent(e, preventDefault) && onClick(self); 5201 }; 5202 onStopDelayedCall = self._dc = gsap.delayedCall(onStopDelay || 0.25, onStopFunc).pause(); 5203 self.deltaX = self.deltaY = 0; 5204 self._vx = _getVelocityProp(0, 50, true); 5205 self._vy = _getVelocityProp(0, 50, true); 5206 self.scrollX = scrollFuncX; 5207 self.scrollY = scrollFuncY; 5208 self.isDragging = self.isGesturing = self.isPressed = false; 5209 _context(this); 5210 self.enable = function (e) { 5211 if (!self.isEnabled) { 5212 _addListener(isViewport ? ownerDoc : target, "scroll", _onScroll); 5213 type.indexOf("scroll") >= 0 && _addListener(isViewport ? ownerDoc : target, "scroll", onScroll, preventDefault, capture); 5214 type.indexOf("wheel") >= 0 && _addListener(target, "wheel", _onWheel, preventDefault, capture); 5215 if (type.indexOf("touch") >= 0 && _isTouch || type.indexOf("pointer") >= 0) { 5216 _addListener(target, _eventTypes[0], _onPress, preventDefault, capture); 5217 _addListener(ownerDoc, _eventTypes[2], _onRelease); 5218 _addListener(ownerDoc, _eventTypes[3], _onRelease); 5219 allowClicks && _addListener(target, "click", clickCapture, false, true); 5220 onClick && _addListener(target, "click", _onClick); 5221 onGestureStart && _addListener(ownerDoc, "gesturestart", _onGestureStart); 5222 onGestureEnd && _addListener(ownerDoc, "gestureend", _onGestureEnd); 5223 onHover && _addListener(target, _pointerType + "enter", _onHover); 5224 onHoverEnd && _addListener(target, _pointerType + "leave", _onHoverEnd); 5225 onMove && _addListener(target, _pointerType + "move", _onMove); 5226 } 5227 self.isEnabled = true; 5228 e && e.type && _onPress(e); 5229 onEnable && onEnable(self); 5230 } 5231 return self; 5232 }; 5233 self.disable = function () { 5234 if (self.isEnabled) { 5235 _observers.filter(function (o) { 5236 return o !== self && _isViewport(o.target); 5237 }).length || _removeListener(isViewport ? ownerDoc : target, "scroll", _onScroll); 5238 if (self.isPressed) { 5239 self._vx.reset(); 5240 self._vy.reset(); 5241 _removeListener(isNormalizer ? target : ownerDoc, _eventTypes[1], _onDrag, true); 5242 } 5243 _removeListener(isViewport ? ownerDoc : target, "scroll", onScroll, capture); 5244 _removeListener(target, "wheel", _onWheel, capture); 5245 _removeListener(target, _eventTypes[0], _onPress, capture); 5246 _removeListener(ownerDoc, _eventTypes[2], _onRelease); 5247 _removeListener(ownerDoc, _eventTypes[3], _onRelease); 5248 _removeListener(target, "click", clickCapture, true); 5249 _removeListener(target, "click", _onClick); 5250 _removeListener(ownerDoc, "gesturestart", _onGestureStart); 5251 _removeListener(ownerDoc, "gestureend", _onGestureEnd); 5252 _removeListener(target, _pointerType + "enter", _onHover); 5253 _removeListener(target, _pointerType + "leave", _onHoverEnd); 5254 _removeListener(target, _pointerType + "move", _onMove); 5255 self.isEnabled = self.isPressed = self.isDragging = false;
vendor: 4,611 bytes, lines 5256-5398
5256 onDisable && onDisable(self); 5257 } 5258 }; 5259 self.kill = self.revert = function () { 5260 self.disable(); 5261 var i = _observers.indexOf(self); 5262 i >= 0 && _observers.splice(i, 1); 5263 _normalizer === self && (_normalizer = 0); 5264 }; 5265 _observers.push(self); 5266 isNormalizer && _isViewport(target) && (_normalizer = self); 5267 self.enable(event); 5268 }; 5269 _createClass(Observer, [{ 5270 key: "velocityX", 5271 get: function get() { 5272 return this._vx.getVelocity(); 5273 } 5274 }, { 5275 key: "velocityY", 5276 get: function get() { 5277 return this._vy.getVelocity(); 5278 } 5279 }]); 5280 return Observer; 5281 }(); 5282 Observer.version = "3.11.5"; 5283 Observer.create = function (vars) { 5284 return new Observer(vars); 5285 }; 5286 Observer.register = _initCore; 5287 Observer.getAll = function () { 5288 return _observers.slice(); 5289 }; 5290 Observer.getById = function (id) { 5291 return _observers.filter(function (o) { 5292 return o.vars.id === id; 5293 })[0]; 5294 }; 5295 _getGSAP() && gsap.registerPlugin(Observer); 5296 5297 /*! 5298 * ScrollTrigger 3.11.5 5299 * https://greensock.com 5300 * 5301 * @license Copyright 2008-2023, GreenSock. All rights reserved. 5302 * Subject to the terms at https://greensock.com/standard-license or for 5303 * Club GreenSock members, the agreement issued with that membership. 5304 * @author: Jack Doyle, [email protected] 5305 */ 5306 5307 var gsap$1, 5308 _coreInitted$1, 5309 _win$1, 5310 _doc$1, 5311 _docEl$1, 5312 _body$1, 5313 _root$1, 5314 _resizeDelay, 5315 _toArray, 5316 _clamp$1, 5317 _time2, 5318 _syncInterval, 5319 _refreshing, 5320 _pointerIsDown, 5321 _transformProp, 5322 _i, 5323 _prevWidth, 5324 _prevHeight, 5325 _autoRefresh, 5326 _sort, 5327 _suppressOverwrites, 5328 _ignoreResize, 5329 _normalizer$1, 5330 _ignoreMobileResize, 5331 _baseScreenHeight, 5332 _baseScreenWidth, 5333 _fixIOSBug, 5334 _context$1, 5335 _scrollRestoration, 5336 _limitCallbacks, 5337 _startup$1 = 1, 5338 _getTime$1 = Date.now, 5339 _time1 = _getTime$1(), 5340 _lastScrollTime = 0, 5341 _enabled = 0, 5342 _rafBugFix = function _rafBugFix() { 5343 return _enabled && requestAnimationFrame(_rafBugFix); 5344 }, 5345 _pointerDownHandler = function _pointerDownHandler() { 5346 return _pointerIsDown = 1; 5347 }, 5348 _pointerUpHandler = function _pointerUpHandler() { 5349 return _pointerIsDown = 0; 5350 }, 5351 _passThrough = function _passThrough(v) { 5352 return v; 5353 }, 5354 _round = function _round(value) { 5355 return Math.round(value * 100000) / 100000 || 0; 5356 }, 5357 _windowExists = function _windowExists() { 5358 return typeof window !== "undefined"; 5359 }, 5360 _getGSAP$1 = function _getGSAP() { 5361 return gsap$1 || _windowExists() && (gsap$1 = window.gsap) && gsap$1.registerPlugin && gsap$1; 5362 }, 5363 _isViewport$1 = function _isViewport(e) { 5364 return !!~_root$1.indexOf(e); 5365 }, 5366 _getBoundsFunc = function _getBoundsFunc(element) { 5367 return _getProxyProp(element, "getBoundingClientRect") || (_isViewport$1(element) ? function () { 5368 _winOffsets.width = _win$1.innerWidth; 5369 _winOffsets.height = _win$1.innerHeight; 5370 return _winOffsets; 5371 } : function () { 5372 return _getBounds(element); 5373 }); 5374 }, 5375 _getSizeFunc = function _getSizeFunc(scroller, isViewport, _ref) { 5376 var d = _ref.d, 5377 d2 = _ref.d2, 5378 a = _ref.a; 5379 return (a = _getProxyProp(scroller, "getBoundingClientRect")) ? function () { 5380 return a()[d]; 5381 } : function () { 5382 return (isViewport ? _win$1["inner" + d2] : scroller["client" + d2]) || 0; 5383 }; 5384 }, 5385 _getOffsetsFunc = function _getOffsetsFunc(element, isViewport) { 5386 return !isViewport || ~_proxies.indexOf(element) ? _getBoundsFunc(element) : function () { 5387 return _winOffsets; 5388 }; 5389 }, 5390 _maxScroll = function _maxScroll(element, _ref2) { 5391 var s = _ref2.s, 5392 d2 = _ref2.d2, 5393 d = _ref2.d, 5394 a = _ref2.a; 5395 return Math.max(0, (s = "scroll" + d2) && (a = _getProxyProp(element, s)) ? a() - _getBoundsFunc(element)()[d] : _isViewport$1(element) ? (_docEl$1[s] || _body$1[s]) - (_win$1["inner" + d2] || _docEl$1["client" + d2] || _body$1["client" + d2]) : element[s] - element["offset" + d2]); 5396 }, 5397 _iterateAutoRefresh = function _iterateAutoRefresh(func, events) { 5398 for (var i = 0; i < _autoRefresh.length; i += 3) {
vendor: 7,774 bytes, lines 5399-5598
5399 (!events || ~events.indexOf(_autoRefresh[i + 1])) && func(_autoRefresh[i], _autoRefresh[i + 1], _autoRefresh[i + 2]); 5400 } 5401 }, 5402 _isString = function _isString(value) { 5403 return typeof value === "string"; 5404 }, 5405 _isFunction = function _isFunction(value) { 5406 return typeof value === "function"; 5407 }, 5408 _isNumber = function _isNumber(value) { 5409 return typeof value === "number"; 5410 }, 5411 _isObject = function _isObject(value) { 5412 return typeof value === "object"; 5413 }, 5414 _endAnimation = function _endAnimation(animation, reversed, pause) { 5415 return animation && animation.progress(reversed ? 0 : 1) && pause && animation.pause(); 5416 }, 5417 _callback = function _callback(self, func) { 5418 if (self.enabled) { 5419 var result = func(self); 5420 result && result.totalTime && (self.callbackAnimation = result); 5421 } 5422 }, 5423 _abs = Math.abs, 5424 _left = "left", 5425 _top = "top", 5426 _right = "right", 5427 _bottom = "bottom", 5428 _width = "width", 5429 _height = "height", 5430 _Right = "Right", 5431 _Left = "Left", 5432 _Top = "Top", 5433 _Bottom = "Bottom", 5434 _padding = "padding", 5435 _margin = "margin", 5436 _Width = "Width", 5437 _Height = "Height", 5438 _px = "px", 5439 _getComputedStyle = function _getComputedStyle(element) { 5440 return _win$1.getComputedStyle(element); 5441 }, 5442 _makePositionable = function _makePositionable(element) { 5443 var position = _getComputedStyle(element).position; 5444 element.style.position = position === "absolute" || position === "fixed" ? position : "relative"; 5445 }, 5446 _setDefaults = function _setDefaults(obj, defaults) { 5447 for (var p in defaults) { 5448 p in obj || (obj[p] = defaults[p]); 5449 } 5450 return obj; 5451 }, 5452 _getBounds = function _getBounds(element, withoutTransforms) { 5453 var tween = withoutTransforms && _getComputedStyle(element)[_transformProp] !== "matrix(1, 0, 0, 1, 0, 0)" && gsap$1.to(element, { 5454 x: 0, 5455 y: 0, 5456 xPercent: 0, 5457 yPercent: 0, 5458 rotation: 0, 5459 rotationX: 0, 5460 rotationY: 0, 5461 scale: 1, 5462 skewX: 0, 5463 skewY: 0 5464 }).progress(1), 5465 bounds = element.getBoundingClientRect(); 5466 tween && tween.progress(0).kill(); 5467 return bounds; 5468 }, 5469 _getSize = function _getSize(element, _ref3) { 5470 var d2 = _ref3.d2; 5471 return element["offset" + d2] || element["client" + d2] || 0; 5472 }, 5473 _getLabelRatioArray = function _getLabelRatioArray(timeline) { 5474 var a = [], 5475 labels = timeline.labels, 5476 duration = timeline.duration(), 5477 p; 5478 for (p in labels) { 5479 a.push(labels[p] / duration); 5480 } 5481 return a; 5482 }, 5483 _getClosestLabel = function _getClosestLabel(animation) { 5484 return function (value) { 5485 return gsap$1.utils.snap(_getLabelRatioArray(animation), value); 5486 }; 5487 }, 5488 _snapDirectional = function _snapDirectional(snapIncrementOrArray) { 5489 var snap = gsap$1.utils.snap(snapIncrementOrArray), 5490 a = Array.isArray(snapIncrementOrArray) && snapIncrementOrArray.slice(0).sort(function (a, b) { 5491 return a - b; 5492 }); 5493 return a ? function (value, direction, threshold) { 5494 if (threshold === void 0) { 5495 threshold = 1e-3; 5496 } 5497 var i; 5498 if (!direction) { 5499 return snap(value); 5500 } 5501 if (direction > 0) { 5502 value -= threshold; 5503 for (i = 0; i < a.length; i++) { 5504 if (a[i] >= value) { 5505 return a[i]; 5506 } 5507 } 5508 return a[i - 1]; 5509 } else { 5510 i = a.length; 5511 value += threshold; 5512 while (i--) { 5513 if (a[i] <= value) { 5514 return a[i]; 5515 } 5516 } 5517 } 5518 return a[0]; 5519 } : function (value, direction, threshold) { 5520 if (threshold === void 0) { 5521 threshold = 1e-3; 5522 } 5523 var snapped = snap(value); 5524 return !direction || Math.abs(snapped - value) < threshold || snapped - value < 0 === direction < 0 ? snapped : snap(direction < 0 ? value - snapIncrementOrArray : value + snapIncrementOrArray); 5525 }; 5526 }, 5527 _getLabelAtDirection = function _getLabelAtDirection(timeline) { 5528 return function (value, st) { 5529 return _snapDirectional(_getLabelRatioArray(timeline))(value, st.direction); 5530 }; 5531 }, 5532 _multiListener = function _multiListener(func, element, types, callback) { 5533 return types.split(",").forEach(function (type) { 5534 return func(element, type, callback); 5535 }); 5536 }, 5537 _addListener$1 = function _addListener(element, type, func, nonPassive, capture) { 5538 return element.addEventListener(type, func, { 5539 passive: !nonPassive, 5540 capture: !!capture 5541 }); 5542 }, 5543 _removeListener$1 = function _removeListener(element, type, func, capture) { 5544 return element.removeEventListener(type, func, !!capture); 5545 }, 5546 _wheelListener = function _wheelListener(func, el, scrollFunc) { 5547 scrollFunc = scrollFunc && scrollFunc.wheelHandler; 5548 if (scrollFunc) { 5549 func(el, "wheel", scrollFunc); 5550 func(el, "touchmove", scrollFunc); 5551 } 5552 }, 5553 _markerDefaults = { 5554 startColor: "green", 5555 endColor: "red", 5556 indent: 0, 5557 fontSize: "16px", 5558 fontWeight: "normal" 5559 }, 5560 _defaults = { 5561 toggleActions: "play", 5562 anticipatePin: 0 5563 }, 5564 _keywords = { 5565 top: 0, 5566 left: 0, 5567 center: 0.5, 5568 bottom: 1, 5569 right: 1 5570 }, 5571 _offsetToPx = function _offsetToPx(value, size) { 5572 if (_isString(value)) { 5573 var eqIndex = value.indexOf("="), 5574 relative = ~eqIndex ? +(value.charAt(eqIndex - 1) + 1) * parseFloat(value.substr(eqIndex + 1)) : 0; 5575 if (~eqIndex) { 5576 value.indexOf("%") > eqIndex && (relative *= size / 100); 5577 value = value.substr(0, eqIndex - 1); 5578 } 5579 value = relative + (value in _keywords ? _keywords[value] * size : ~value.indexOf("%") ? parseFloat(value) * size / 100 : parseFloat(value) || 0); 5580 } 5581 return value; 5582 }, 5583 _createMarker = function _createMarker(type, name, container, direction, _ref4, offset, matchWidthEl, containerAnimation) { 5584 var startColor = _ref4.startColor, 5585 endColor = _ref4.endColor, 5586 fontSize = _ref4.fontSize, 5587 indent = _ref4.indent, 5588 fontWeight = _ref4.fontWeight; 5589 var e = _doc$1.createElement("div"), 5590 useFixedPosition = _isViewport$1(container) || _getProxyProp(container, "pinType") === "fixed", 5591 isScroller = type.indexOf("scroller") !== -1, 5592 parent = useFixedPosition ? _body$1 : container, 5593 isStart = type.indexOf("start") !== -1, 5594 color = isStart ? startColor : endColor, 5595 css = "border-color:" + color + ";font-size:" + fontSize + ";color:" + color + ";font-weight:" + fontWeight + ";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;"; 5596 css += "position:" + ((isScroller || containerAnimation) && useFixedPosition ? "fixed;" : "absolute;"); 5597 (isScroller || containerAnimation || !useFixedPosition) && (css += (direction === _vertical ? _right : _bottom) + ":" + (offset + parseFloat(indent)) + "px;"); 5598 matchWidthEl && (css += "box-sizing:border-box;text-align:left;
vendor: 4,092 bytes, lines 5598-5693
5598width:" + matchWidthEl.offsetWidth + "px;"); 5599 e._isStart = isStart; 5600 e.setAttribute("class", "gsap-marker-" + type + (name ? " marker-" + name : "")); 5601 e.style.cssText = css; 5602 e.innerText = name || name === 0 ? type + "-" + name : type; 5603 parent.children[0] ? parent.insertBefore(e, parent.children[0]) : parent.appendChild(e); 5604 e._offset = e["offset" + direction.op.d2]; 5605 _positionMarker(e, 0, direction, isStart); 5606 return e; 5607 }, 5608 _positionMarker = function _positionMarker(marker, start, direction, flipped) { 5609 var vars = { 5610 display: "block" 5611 }, 5612 side = direction[flipped ? "os2" : "p2"], 5613 oppositeSide = direction[flipped ? "p2" : "os2"]; 5614 marker._isFlipped = flipped; 5615 vars[direction.a + "Percent"] = flipped ? -100 : 0; 5616 vars[direction.a] = flipped ? "1px" : 0; 5617 vars["border" + side + _Width] = 1; 5618 vars["border" + oppositeSide + _Width] = 0; 5619 vars[direction.p] = start + "px"; 5620 gsap$1.set(marker, vars); 5621 }, 5622 _triggers = [], 5623 _ids = {}, 5624 _rafID, 5625 _sync = function _sync() { 5626 return _getTime$1() - _lastScrollTime > 34 && (_rafID || (_rafID = requestAnimationFrame(_updateAll))); 5627 }, 5628 _onScroll$1 = function _onScroll() { 5629 if (!_normalizer$1 || !_normalizer$1.isPressed || _normalizer$1.startX > _body$1.clientWidth) { 5630 _scrollers.cache++; 5631 if (_normalizer$1) { 5632 _rafID || (_rafID = requestAnimationFrame(_updateAll)); 5633 } else { 5634 _updateAll(); 5635 } 5636 _lastScrollTime || _dispatch("scrollStart"); 5637 _lastScrollTime = _getTime$1(); 5638 } 5639 }, 5640 _setBaseDimensions = function _setBaseDimensions() { 5641 _baseScreenWidth = _win$1.innerWidth; 5642 _baseScreenHeight = _win$1.innerHeight; 5643 }, 5644 _onResize = function _onResize() { 5645 _scrollers.cache++; 5646 !_refreshing && !_ignoreResize && !_doc$1.fullscreenElement && !_doc$1.webkitFullscreenElement && (!_ignoreMobileResize || _baseScreenWidth !== _win$1.innerWidth || Math.abs(_win$1.innerHeight - _baseScreenHeight) > _win$1.innerHeight * 0.25) && _resizeDelay.restart(true); 5647 }, 5648 _listeners = {}, 5649 _emptyArray = [], 5650 _softRefresh = function _softRefresh() { 5651 return _removeListener$1(ScrollTrigger$1, "scrollEnd", _softRefresh) || _refreshAll(true); 5652 }, 5653 _dispatch = function _dispatch(type) { 5654 return _listeners[type] && _listeners[type].map(function (f) { 5655 return f(); 5656 }) || _emptyArray; 5657 }, 5658 _savedStyles = [], 5659 _revertRecorded = function _revertRecorded(media) { 5660 for (var i = 0; i < _savedStyles.length; i += 5) { 5661 if (!media || _savedStyles[i + 4] && _savedStyles[i + 4].query === media) { 5662 _savedStyles[i].style.cssText = _savedStyles[i + 1]; 5663 _savedStyles[i].getBBox && _savedStyles[i].setAttribute("transform", _savedStyles[i + 2] || ""); 5664 _savedStyles[i + 3].uncache = 1; 5665 } 5666 } 5667 }, 5668 _revertAll = function _revertAll(kill, media) { 5669 var trigger; 5670 for (_i = 0; _i < _triggers.length; _i++) { 5671 trigger = _triggers[_i]; 5672 if (trigger && (!media || trigger._ctx === media)) { 5673 if (kill) { 5674 trigger.kill(1); 5675 } else { 5676 trigger.revert(true, true); 5677 } 5678 } 5679 } 5680 media && _revertRecorded(media); 5681 media || _dispatch("revert"); 5682 }, 5683 _clearScrollMemory = function _clearScrollMemory(scrollRestoration, force) { 5684 _scrollers.cache++; 5685 (force || !_refreshingAll) && _scrollers.forEach(function (obj) { 5686 return _isFunction(obj) && obj.cacheID++ && (obj.rec = 0); 5687 }); 5688 _isString(scrollRestoration) && (_win$1.history.scrollRestoration = _scrollRestoration = scrollRestoration); 5689 }, 5690 _refreshingAll, 5691 _refreshID = 0, 5692 _queueRefreshID, 5693 _queueRefreshAll = function _queueRefreshAll() {
vendor: 4,526 bytes, lines 5694-5806
5694 if (_queueRefreshID !== _refreshID) { 5695 var id = _queueRefreshID = _refreshID; 5696 requestAnimationFrame(function () { 5697 return id === _refreshID && _refreshAll(true); 5698 }); 5699 } 5700 }, 5701 _refreshAll = function _refreshAll(force, skipRevert) { 5702 if (_lastScrollTime && !force) { 5703 _addListener$1(ScrollTrigger$1, "scrollEnd", _softRefresh); 5704 return; 5705 } 5706 _refreshingAll = ScrollTrigger$1.isRefreshing = true; 5707 _scrollers.forEach(function (obj) { 5708 return _isFunction(obj) && obj.cacheID++ && (obj.rec = obj()); 5709 }); 5710 var refreshInits = _dispatch("refreshInit"); 5711 _sort && ScrollTrigger$1.sort(); 5712 skipRevert || _revertAll(); 5713 _scrollers.forEach(function (obj) { 5714 if (_isFunction(obj)) { 5715 obj.smooth && (obj.target.style.scrollBehavior = "auto"); 5716 obj(0); 5717 } 5718 }); 5719 _triggers.slice(0).forEach(function (t) { 5720 return t.refresh(); 5721 }); 5722 _triggers.forEach(function (t, i) { 5723 if (t._subPinOffset && t.pin) { 5724 var prop = t.vars.horizontal ? "offsetWidth" : "offsetHeight", 5725 original = t.pin[prop]; 5726 t.revert(true, 1); 5727 t.adjustPinSpacing(t.pin[prop] - original); 5728 t.refresh(); 5729 } 5730 }); 5731 _triggers.forEach(function (t) { 5732 return t.vars.end === "max" && t.setPositions(t.start, Math.max(t.start + 1, _maxScroll(t.scroller, t._dir))); 5733 }); 5734 refreshInits.forEach(function (result) { 5735 return result && result.render && result.render(-1); 5736 }); 5737 _scrollers.forEach(function (obj) { 5738 if (_isFunction(obj)) { 5739 obj.smooth && requestAnimationFrame(function () { 5740 return obj.target.style.scrollBehavior = "smooth"; 5741 }); 5742 obj.rec && obj(obj.rec); 5743 } 5744 }); 5745 _clearScrollMemory(_scrollRestoration, 1); 5746 _resizeDelay.pause(); 5747 _refreshID++; 5748 _refreshingAll = 2; 5749 _updateAll(2); 5750 _triggers.forEach(function (t) { 5751 return _isFunction(t.vars.onRefresh) && t.vars.onRefresh(t); 5752 }); 5753 _refreshingAll = ScrollTrigger$1.isRefreshing = false; 5754 _dispatch("refresh"); 5755 }, 5756 _lastScroll = 0, 5757 _direction = 1, 5758 _primary, 5759 _updateAll = function _updateAll(force) { 5760 if (!_refreshingAll || force === 2) { 5761 ScrollTrigger$1.isUpdating = true; 5762 _primary && _primary.update(0); 5763 var l = _triggers.length, 5764 time = _getTime$1(), 5765 recordVelocity = time - _time1 >= 50, 5766 scroll = l && _triggers[0].scroll(); 5767 _direction = _lastScroll > scroll ? -1 : 1; 5768 _refreshingAll || (_lastScroll = scroll); 5769 if (recordVelocity) { 5770 if (_lastScrollTime && !_pointerIsDown && time - _lastScrollTime > 200) { 5771 _lastScrollTime = 0; 5772 _dispatch("scrollEnd"); 5773 } 5774 _time2 = _time1; 5775 _time1 = time; 5776 } 5777 if (_direction < 0) { 5778 _i = l; 5779 while (_i-- > 0) { 5780 _triggers[_i] && _triggers[_i].update(0, recordVelocity); 5781 } 5782 _direction = 1; 5783 } else { 5784 for (_i = 0; _i < l; _i++) { 5785 _triggers[_i] && _triggers[_i].update(0, recordVelocity); 5786 } 5787 } 5788 ScrollTrigger$1.isUpdating = false; 5789 } 5790 _rafID = 0; 5791 }, 5792 _propNamesToCopy = [_left, _top, _bottom, _right, _margin + _Bottom, _margin + _Right, _margin + _Top, _margin + _Left, "display", "flexShrink", "float", "zIndex", "gridColumnStart", "gridColumnEnd", "gridRowStart", "gridRowEnd", "gridArea", "justifySelf", "alignSelf", "placeSelf", "order"], 5793 _stateProps = _propNamesToCopy.concat([_width, _height, "boxSizing", "max" + _Width, "max" + _Height, "position", _margin, _padding, _padding + _Top, _padding + _Right, _padding + _Bottom, _padding + _Left]), 5794 _swapPinOut = function _swapPinOut(pin, spacer, state) { 5795 _setState(state); 5796 var cache = pin._gsap; 5797 if (cache.spacerIsNative) { 5798 _setState(cache.spacerState); 5799 } else if (pin._gsap.swappedIn) { 5800 var parent = spacer.parentNode; 5801 if (parent) { 5802 parent.insertBefore(pin, spacer); 5803 parent.removeChild(spacer); 5804 } 5805 } 5806 pin._gsap.swappedIn = false;
vendor: 8,748 bytes, lines 5807-6010
5807 }, 5808 _swapPinIn = function _swapPinIn(pin, spacer, cs, spacerState) { 5809 if (!pin._gsap.swappedIn) { 5810 var i = _propNamesToCopy.length, 5811 spacerStyle = spacer.style, 5812 pinStyle = pin.style, 5813 p; 5814 while (i--) { 5815 p = _propNamesToCopy[i]; 5816 spacerStyle[p] = cs[p]; 5817 } 5818 spacerStyle.position = cs.position === "absolute" ? "absolute" : "relative"; 5819 cs.display === "inline" && (spacerStyle.display = "inline-block"); 5820 pinStyle[_bottom] = pinStyle[_right] = "auto"; 5821 spacerStyle.flexBasis = cs.flexBasis || "auto"; 5822 spacerStyle.overflow = "visible"; 5823 spacerStyle.boxSizing = "border-box"; 5824 spacerStyle[_width] = _getSize(pin, _horizontal) + _px; 5825 spacerStyle[_height] = _getSize(pin, _vertical) + _px; 5826 spacerStyle[_padding] = pinStyle[_margin] = pinStyle[_top] = pinStyle[_left] = "0"; 5827 _setState(spacerState); 5828 pinStyle[_width] = pinStyle["max" + _Width] = cs[_width]; 5829 pinStyle[_height] = pinStyle["max" + _Height] = cs[_height]; 5830 pinStyle[_padding] = cs[_padding]; 5831 if (pin.parentNode !== spacer) { 5832 pin.parentNode.insertBefore(spacer, pin); 5833 spacer.appendChild(pin); 5834 } 5835 pin._gsap.swappedIn = true; 5836 } 5837 }, 5838 _capsExp = /([A-Z])/g, 5839 _setState = function _setState(state) { 5840 if (state) { 5841 var style = state.t.style, 5842 l = state.length, 5843 i = 0, 5844 p, 5845 value; 5846 (state.t._gsap || gsap$1.core.getCache(state.t)).uncache = 1; 5847 for (; i < l; i += 2) { 5848 value = state[i + 1]; 5849 p = state[i]; 5850 if (value) { 5851 style[p] = value; 5852 } else if (style[p]) { 5853 style.removeProperty(p.replace(_capsExp, "-$1").toLowerCase()); 5854 } 5855 } 5856 } 5857 }, 5858 _getState = function _getState(element) { 5859 var l = _stateProps.length, 5860 style = element.style, 5861 state = [], 5862 i = 0; 5863 for (; i < l; i++) { 5864 state.push(_stateProps[i], style[_stateProps[i]]); 5865 } 5866 state.t = element; 5867 return state; 5868 }, 5869 _copyState = function _copyState(state, override, omitOffsets) { 5870 var result = [], 5871 l = state.length, 5872 i = omitOffsets ? 8 : 0, 5873 p; 5874 for (; i < l; i += 2) { 5875 p = state[i]; 5876 result.push(p, p in override ? override[p] : state[i + 1]); 5877 } 5878 result.t = state.t; 5879 return result; 5880 }, 5881 _winOffsets = { 5882 left: 0, 5883 top: 0 5884 }, 5885 _parsePosition = function _parsePosition(value, trigger, scrollerSize, direction, scroll, marker, markerScroller, self, scrollerBounds, borderWidth, useFixedPosition, scrollerMax, containerAnimation) { 5886 _isFunction(value) && (value = value(self)); 5887 if (_isString(value) && value.substr(0, 3) === "max") { 5888 value = scrollerMax + (value.charAt(4) === "=" ? _offsetToPx("0" + value.substr(3), scrollerSize) : 0); 5889 } 5890 var time = containerAnimation ? containerAnimation.time() : 0, 5891 p1, 5892 p2, 5893 element; 5894 containerAnimation && containerAnimation.seek(0); 5895 if (!_isNumber(value)) { 5896 _isFunction(trigger) && (trigger = trigger(self)); 5897 var offsets = (value || "0").split(" "), 5898 bounds, 5899 localOffset, 5900 globalOffset, 5901 display; 5902 element = _getTarget(trigger) || _body$1; 5903 bounds = _getBounds(element) || {}; 5904 if ((!bounds || !bounds.left && !bounds.top) && _getComputedStyle(element).display === "none") { 5905 display = element.style.display; 5906 element.style.display = "block"; 5907 bounds = _getBounds(element); 5908 display ? element.style.display = display : element.style.removeProperty("display"); 5909 } 5910 localOffset = _offsetToPx(offsets[0], bounds[direction.d]); 5911 globalOffset = _offsetToPx(offsets[1] || "0", scrollerSize); 5912 value = bounds[direction.p] - scrollerBounds[direction.p] - borderWidth + localOffset + scroll - globalOffset; 5913 markerScroller && _positionMarker(markerScroller, globalOffset, direction, scrollerSize - globalOffset < 20 || markerScroller._isStart && globalOffset > 20); 5914 scrollerSize -= scrollerSize - globalOffset; 5915 } else { 5916 containerAnimation && (value = gsap$1.utils.mapRange(containerAnimation.scrollTrigger.start, containerAnimation.scrollTrigger.end, 0, scrollerMax, value)); 5917 markerScroller && _positionMarker(markerScroller, scrollerSize, direction, true); 5918 } 5919 if (marker) { 5920 var position = value + scrollerSize, 5921 isStart = marker._isStart; 5922 p1 = "scroll" + direction.d2; 5923 _positionMarker(marker, position, direction, isStart && position > 20 || !isStart && (useFixedPosition ? Math.max(_body$1[p1], _docEl$1[p1]) : marker.parentNode[p1]) <= position + 1); 5924 if (useFixedPosition) { 5925 scrollerBounds = _getBounds(markerScroller); 5926 useFixedPosition && (marker.style[direction.op.p] = scrollerBounds[direction.op.p] - direction.op.m - marker._offset + _px); 5927 } 5928 } 5929 if (containerAnimation && element) { 5930 p1 = _getBounds(element); 5931 containerAnimation.seek(scrollerMax); 5932 p2 = _getBounds(element); 5933 containerAnimation._caScrollDist = p1[direction.p] - p2[direction.p]; 5934 value = value / containerAnimation._caScrollDist * scrollerMax; 5935 } 5936 containerAnimation && containerAnimation.seek(time); 5937 return containerAnimation ? value : Math.round(value); 5938 }, 5939 _prefixExp = /(webkit|moz|length|cssText|inset)/i, 5940 _reparent = function _reparent(element, parent, top, left) { 5941 if (element.parentNode !== parent) { 5942 var style = element.style, 5943 p, 5944 cs; 5945 if (parent === _body$1) { 5946 element._stOrig = style.cssText; 5947 cs = _getComputedStyle(element); 5948 for (p in cs) { 5949 if (!+p && !_prefixExp.test(p) && cs[p] && typeof style[p] === "string" && p !== "0") { 5950 style[p] = cs[p]; 5951 } 5952 } 5953 style.top = top; 5954 style.left = left; 5955 } else { 5956 style.cssText = element._stOrig; 5957 } 5958 gsap$1.core.getCache(element).uncache = 1; 5959 parent.appendChild(element); 5960 } 5961 }, 5962 _interruptionTracker = function _interruptionTracker(getValueFunc, initialValue, onInterrupt) { 5963 var last1 = initialValue, 5964 last2 = last1; 5965 return function (value) { 5966 var current = Math.round(getValueFunc()); 5967 if (current !== last1 && current !== last2 && Math.abs(current - last1) > 3 && Math.abs(current - last2) > 3) { 5968 value = current; 5969 onInterrupt && onInterrupt(); 5970 } 5971 last2 = last1; 5972 last1 = value; 5973 return value; 5974 }; 5975 }, 5976 _getTweenCreator = function _getTweenCreator(scroller, direction) { 5977 var getScroll = _getScrollFunc(scroller, direction), 5978 prop = "_scroll" + direction.p2, 5979 getTween = function getTween(scrollTo, vars, initialValue, change1, change2) { 5980 var tween = getTween.tween, 5981 onComplete = vars.onComplete, 5982 modifiers = {}; 5983 initialValue = initialValue || getScroll(); 5984 var checkForInterruption = _interruptionTracker(getScroll, initialValue, function () { 5985 tween.kill(); 5986 getTween.tween = 0; 5987 }); 5988 change2 = change1 && change2 || 0; 5989 change1 = change1 || scrollTo - initialValue; 5990 tween && tween.kill(); 5991 vars[prop] = scrollTo; 5992 vars.modifiers = modifiers; 5993 modifiers[prop] = function () { 5994 return checkForInterruption(initialValue + change1 * tween.ratio + change2 * tween.ratio * tween.ratio); 5995 }; 5996 vars.onUpdate = function () { 5997 _scrollers.cache++; 5998 _updateAll(); 5999 }; 6000 vars.onComplete = function () { 6001 getTween.tween = 0; 6002 onComplete && onComplete.call(tween); 6003 }; 6004 tween = getTween.tween = gsap$1.to(scroller, vars); 6005 return tween; 6006 }; 6007 scroller[prop] = getScroll; 6008 getScroll.wheelHandler = function () { 6009 return getTween.tween && getTween.tween.kill() && (getTween.tween = 0); 6010 };
vendor: 5,228 bytes, lines 6011-6145
6011 _addListener$1(scroller, "wheel", getScroll.wheelHandler); 6012 ScrollTrigger$1.isTouch && _addListener$1(scroller, "touchmove", getScroll.wheelHandler); 6013 return getTween; 6014 }; 6015 var ScrollTrigger$1 = function () { 6016 function ScrollTrigger(vars, animation) { 6017 _coreInitted$1 || ScrollTrigger.register(gsap$1) || console.warn("Please gsap.registerPlugin(ScrollTrigger)"); 6018 this.init(vars, animation); 6019 } 6020 var _proto = ScrollTrigger.prototype; 6021 _proto.init = function init(vars, animation) { 6022 this.progress = this.start = 0; 6023 this.vars && this.kill(true, true); 6024 if (!_enabled) { 6025 this.update = this.refresh = this.kill = _passThrough; 6026 return; 6027 } 6028 vars = _setDefaults(_isString(vars) || _isNumber(vars) || vars.nodeType ? { 6029 trigger: vars 6030 } : vars, _defaults); 6031 var _vars = vars, 6032 onUpdate = _vars.onUpdate, 6033 toggleClass = _vars.toggleClass, 6034 id = _vars.id, 6035 onToggle = _vars.onToggle, 6036 onRefresh = _vars.onRefresh, 6037 scrub = _vars.scrub, 6038 trigger = _vars.trigger, 6039 pin = _vars.pin, 6040 pinSpacing = _vars.pinSpacing, 6041 invalidateOnRefresh = _vars.invalidateOnRefresh, 6042 anticipatePin = _vars.anticipatePin, 6043 onScrubComplete = _vars.onScrubComplete, 6044 onSnapComplete = _vars.onSnapComplete, 6045 once = _vars.once, 6046 snap = _vars.snap, 6047 pinReparent = _vars.pinReparent, 6048 pinSpacer = _vars.pinSpacer, 6049 containerAnimation = _vars.containerAnimation, 6050 fastScrollEnd = _vars.fastScrollEnd, 6051 preventOverlaps = _vars.preventOverlaps, 6052 direction = vars.horizontal || vars.containerAnimation && vars.horizontal !== false ? _horizontal : _vertical, 6053 isToggle = !scrub && scrub !== 0, 6054 scroller = _getTarget(vars.scroller || _win$1), 6055 scrollerCache = gsap$1.core.getCache(scroller), 6056 isViewport = _isViewport$1(scroller), 6057 useFixedPosition = ("pinType" in vars ? vars.pinType : _getProxyProp(scroller, "pinType") || isViewport && "fixed") === "fixed", 6058 callbacks = [vars.onEnter, vars.onLeave, vars.onEnterBack, vars.onLeaveBack], 6059 toggleActions = isToggle && vars.toggleActions.split(" "), 6060 markers = "markers" in vars ? vars.markers : _defaults.markers, 6061 borderWidth = isViewport ? 0 : parseFloat(_getComputedStyle(scroller)["border" + direction.p2 + _Width]) || 0, 6062 self = this, 6063 onRefreshInit = vars.onRefreshInit && function () { 6064 return vars.onRefreshInit(self); 6065 }, 6066 getScrollerSize = _getSizeFunc(scroller, isViewport, direction), 6067 getScrollerOffsets = _getOffsetsFunc(scroller, isViewport), 6068 lastSnap = 0, 6069 lastRefresh = 0, 6070 scrollFunc = _getScrollFunc(scroller, direction), 6071 tweenTo, 6072 pinCache, 6073 snapFunc, 6074 scroll1, 6075 scroll2, 6076 start, 6077 end, 6078 markerStart, 6079 markerEnd, 6080 markerStartTrigger, 6081 markerEndTrigger, 6082 markerVars, 6083 change, 6084 pinOriginalState, 6085 pinActiveState, 6086 pinState, 6087 spacer, 6088 offset, 6089 pinGetter, 6090 pinSetter, 6091 pinStart, 6092 pinChange, 6093 spacingStart, 6094 spacerState, 6095 markerStartSetter, 6096 pinMoves, 6097 markerEndSetter, 6098 cs, 6099 snap1, 6100 snap2, 6101 scrubTween, 6102 scrubSmooth, 6103 snapDurClamp, 6104 snapDelayedCall, 6105 prevProgress, 6106 prevScroll, 6107 prevAnimProgress, 6108 caMarkerSetter, 6109 customRevertReturn; 6110 _context$1(self); 6111 self._dir = direction; 6112 anticipatePin *= 45; 6113 self.scroller = scroller; 6114 self.scroll = containerAnimation ? containerAnimation.time.bind(containerAnimation) : scrollFunc; 6115 scroll1 = scrollFunc(); 6116 self.vars = vars; 6117 animation = animation || vars.animation; 6118 if ("refreshPriority" in vars) { 6119 _sort = 1; 6120 vars.refreshPriority === -9999 && (_primary = self); 6121 } 6122 scrollerCache.tweenScroll = scrollerCache.tweenScroll || { 6123 top: _getTweenCreator(scroller, _vertical), 6124 left: _getTweenCreator(scroller, _horizontal) 6125 }; 6126 self.tweenTo = tweenTo = scrollerCache.tweenScroll[direction.p]; 6127 self.scrubDuration = function (value) { 6128 scrubSmooth = _isNumber(value) && value; 6129 if (!scrubSmooth) { 6130 scrubTween && scrubTween.progress(1).kill(); 6131 scrubTween = 0; 6132 } else { 6133 scrubTween ? scrubTween.duration(value) : scrubTween = gsap$1.to(animation, { 6134 ease: "expo", 6135 totalProgress: "+=0.001", 6136 duration: scrubSmooth, 6137 paused: true, 6138 onComplete: function onComplete() { 6139 return onScrubComplete && onScrubComplete(self); 6140 } 6141 }); 6142 } 6143 }; 6144 if (animation) { 6145 animation.vars.lazy = false;
vendor: 9,961 bytes, lines 6146-6341
6146 animation._initted || animation.vars.immediateRender !== false && vars.immediateRender !== false && animation.duration() && animation.render(0, true, true); 6147 self.animation = animation.pause(); 6148 animation.scrollTrigger = self; 6149 self.scrubDuration(scrub); 6150 scrubTween && scrubTween.resetTo && scrubTween.resetTo("totalProgress", 0); 6151 snap1 = 0; 6152 id || (id = animation.vars.id); 6153 } 6154 _triggers.push(self); 6155 if (snap) { 6156 if (!_isObject(snap) || snap.push) { 6157 snap = { 6158 snapTo: snap 6159 }; 6160 } 6161 "scrollBehavior" in _body$1.style && gsap$1.set(isViewport ? [_body$1, _docEl$1] : scroller, { 6162 scrollBehavior: "auto" 6163 }); 6164 _scrollers.forEach(function (o) { 6165 return _isFunction(o) && o.target === (isViewport ? _doc$1.scrollingElement || _docEl$1 : scroller) && (o.smooth = false); 6166 }); 6167 snapFunc = _isFunction(snap.snapTo) ? snap.snapTo : snap.snapTo === "labels" ? _getClosestLabel(animation) : snap.snapTo === "labelsDirectional" ? _getLabelAtDirection(animation) : snap.directional !== false ? function (value, st) { 6168 return _snapDirectional(snap.snapTo)(value, _getTime$1() - lastRefresh < 500 ? 0 : st.direction); 6169 } : gsap$1.utils.snap(snap.snapTo); 6170 snapDurClamp = snap.duration || { 6171 min: 0.1, 6172 max: 2 6173 }; 6174 snapDurClamp = _isObject(snapDurClamp) ? _clamp$1(snapDurClamp.min, snapDurClamp.max) : _clamp$1(snapDurClamp, snapDurClamp); 6175 snapDelayedCall = gsap$1.delayedCall(snap.delay || scrubSmooth / 2 || 0.1, function () { 6176 var scroll = scrollFunc(), 6177 refreshedRecently = _getTime$1() - lastRefresh < 500, 6178 tween = tweenTo.tween; 6179 if ((refreshedRecently || Math.abs(self.getVelocity()) < 10) && !tween && !_pointerIsDown && lastSnap !== scroll) { 6180 var progress = (scroll - start) / change, 6181 totalProgress = animation && !isToggle ? animation.totalProgress() : progress, 6182 velocity = refreshedRecently ? 0 : (totalProgress - snap2) / (_getTime$1() - _time2) * 1000 || 0, 6183 change1 = gsap$1.utils.clamp(-progress, 1 - progress, _abs(velocity / 2) * velocity / 0.185), 6184 naturalEnd = progress + (snap.inertia === false ? 0 : change1), 6185 endValue = _clamp$1(0, 1, snapFunc(naturalEnd, self)), 6186 endScroll = Math.round(start + endValue * change), 6187 _snap = snap, 6188 onStart = _snap.onStart, 6189 _onInterrupt = _snap.onInterrupt, 6190 _onComplete = _snap.onComplete; 6191 if (scroll <= end && scroll >= start && endScroll !== scroll) { 6192 if (tween && !tween._initted && tween.data <= _abs(endScroll - scroll)) { 6193 return; 6194 } 6195 if (snap.inertia === false) { 6196 change1 = endValue - progress; 6197 } 6198 tweenTo(endScroll, { 6199 duration: snapDurClamp(_abs(Math.max(_abs(naturalEnd - totalProgress), _abs(endValue - totalProgress)) * 0.185 / velocity / 0.05 || 0)), 6200 ease: snap.ease || "power3", 6201 data: _abs(endScroll - scroll), 6202 onInterrupt: function onInterrupt() { 6203 return snapDelayedCall.restart(true) && _onInterrupt && _onInterrupt(self); 6204 }, 6205 onComplete: function onComplete() { 6206 self.update(); 6207 lastSnap = scrollFunc(); 6208 snap1 = snap2 = animation && !isToggle ? animation.totalProgress() : self.progress; 6209 onSnapComplete && onSnapComplete(self); 6210 _onComplete && _onComplete(self); 6211 } 6212 }, scroll, change1 * change, endScroll - scroll - change1 * change); 6213 onStart && onStart(self, tweenTo.tween); 6214 } 6215 } else if (self.isActive && lastSnap !== scroll) { 6216 snapDelayedCall.restart(true); 6217 } 6218 }).pause(); 6219 } 6220 id && (_ids[id] = self); 6221 trigger = self.trigger = _getTarget(trigger || pin); 6222 customRevertReturn = trigger && trigger._gsap && trigger._gsap.stRevert; 6223 customRevertReturn && (customRevertReturn = customRevertReturn(self)); 6224 pin = pin === true ? trigger : _getTarget(pin); 6225 _isString(toggleClass) && (toggleClass = { 6226 targets: trigger, 6227 className: toggleClass 6228 }); 6229 if (pin) { 6230 pinSpacing === false || pinSpacing === _margin || (pinSpacing = !pinSpacing && pin.parentNode && pin.parentNode.style && _getComputedStyle(pin.parentNode).display === "flex" ? false : _padding); 6231 self.pin = pin; 6232 pinCache = gsap$1.core.getCache(pin); 6233 if (!pinCache.spacer) { 6234 if (pinSpacer) { 6235 pinSpacer = _getTarget(pinSpacer); 6236 pinSpacer && !pinSpacer.nodeType && (pinSpacer = pinSpacer.current || pinSpacer.nativeElement); 6237 pinCache.spacerIsNative = !!pinSpacer; 6238 pinSpacer && (pinCache.spacerState = _getState(pinSpacer)); 6239 } 6240 pinCache.spacer = spacer = pinSpacer || _doc$1.createElement("div"); 6241 spacer.classList.add("pin-spacer"); 6242 id && spacer.classList.add("pin-spacer-" + id); 6243 pinCache.pinState = pinOriginalState = _getState(pin); 6244 } else { 6245 pinOriginalState = pinCache.pinState; 6246 } 6247 vars.force3D !== false && gsap$1.set(pin, { 6248 force3D: true 6249 }); 6250 self.spacer = spacer = pinCache.spacer; 6251 cs = _getComputedStyle(pin); 6252 spacingStart = cs[pinSpacing + direction.os2]; 6253 pinGetter = gsap$1.getProperty(pin); 6254 pinSetter = gsap$1.quickSetter(pin, direction.a, _px); 6255 _swapPinIn(pin, spacer, cs); 6256 pinState = _getState(pin); 6257 } 6258 if (markers) { 6259 markerVars = _isObject(markers) ? _setDefaults(markers, _markerDefaults) : _markerDefaults; 6260 markerStartTrigger = _createMarker("scroller-start", id, scroller, direction, markerVars, 0); 6261 markerEndTrigger = _createMarker("scroller-end", id, scroller, direction, markerVars, 0, markerStartTrigger); 6262 offset = markerStartTrigger["offset" + direction.op.d2]; 6263 var content = _getTarget(_getProxyProp(scroller, "content") || scroller); 6264 markerStart = this.markerStart = _createMarker("start", id, content, direction, markerVars, offset, 0, containerAnimation); 6265 markerEnd = this.markerEnd = _createMarker("end", id, content, direction, markerVars, offset, 0, containerAnimation); 6266 containerAnimation && (caMarkerSetter = gsap$1.quickSetter([markerStart, markerEnd], direction.a, _px)); 6267 if (!useFixedPosition && !(_proxies.length && _getProxyProp(scroller, "fixedMarkers") === true)) { 6268 _makePositionable(isViewport ? _body$1 : scroller); 6269 gsap$1.set([markerStartTrigger, markerEndTrigger], { 6270 force3D: true 6271 }); 6272 markerStartSetter = gsap$1.quickSetter(markerStartTrigger, direction.a, _px); 6273 markerEndSetter = gsap$1.quickSetter(markerEndTrigger, direction.a, _px); 6274 } 6275 } 6276 if (containerAnimation) { 6277 var oldOnUpdate = containerAnimation.vars.onUpdate, 6278 oldParams = containerAnimation.vars.onUpdateParams; 6279 containerAnimation.eventCallback("onUpdate", function () { 6280 self.update(0, 0, 1); 6281 oldOnUpdate && oldOnUpdate.apply(containerAnimation, oldParams || []); 6282 }); 6283 } 6284 self.previous = function () { 6285 return _triggers[_triggers.indexOf(self) - 1]; 6286 }; 6287 self.next = function () { 6288 return _triggers[_triggers.indexOf(self) + 1]; 6289 }; 6290 self.revert = function (revert, temp) { 6291 if (!temp) { 6292 return self.kill(true); 6293 } 6294 var r = revert !== false || !self.enabled, 6295 prevRefreshing = _refreshing; 6296 if (r !== self.isReverted) { 6297 if (r) { 6298 prevScroll = Math.max(scrollFunc(), self.scroll.rec || 0); 6299 prevProgress = self.progress; 6300 prevAnimProgress = animation && animation.progress(); 6301 } 6302 markerStart && [markerStart, markerEnd, markerStartTrigger, markerEndTrigger].forEach(function (m) { 6303 return m.style.display = r ? "none" : "block"; 6304 }); 6305 if (r) { 6306 _refreshing = self; 6307 self.update(r); 6308 } 6309 if (pin && (!pinReparent || !self.isActive)) { 6310 if (r) { 6311 _swapPinOut(pin, spacer, pinOriginalState); 6312 } else { 6313 _swapPinIn(pin, spacer, _getComputedStyle(pin), spacerState); 6314 } 6315 } 6316 r || self.update(r); 6317 _refreshing = prevRefreshing; 6318 self.isReverted = r; 6319 } 6320 }; 6321 self.refresh = function (soft, force) { 6322 if ((_refreshing || !self.enabled) && !force) { 6323 return; 6324 } 6325 if (pin && soft && _lastScrollTime) { 6326 _addListener$1(ScrollTrigger, "scrollEnd", _softRefresh); 6327 return; 6328 } 6329 !_refreshingAll && onRefreshInit && onRefreshInit(self); 6330 _refreshing = self; 6331 lastRefresh = _getTime$1(); 6332 if (tweenTo.tween) { 6333 tweenTo.tween.kill(); 6334 tweenTo.tween = 0; 6335 } 6336 scrubTween && scrubTween.pause(); 6337 invalidateOnRefresh && animation && animation.revert({ 6338 kill: false 6339 }).invalidate(); 6340 self.isReverted || self.revert(true, true); 6341 self._subPinOffset = false;
vendor: 19,627 bytes, lines 6342-6724
6342 var size = getScrollerSize(), 6343 scrollerBounds = getScrollerOffsets(), 6344 max = containerAnimation ? containerAnimation.duration() : _maxScroll(scroller, direction), 6345 isFirstRefresh = change <= 0.01, 6346 offset = 0, 6347 otherPinOffset = 0, 6348 parsedEnd = vars.end, 6349 parsedEndTrigger = vars.endTrigger || trigger, 6350 parsedStart = vars.start || (vars.start === 0 || !trigger ? 0 : pin ? "0 0" : "0 100%"), 6351 pinnedContainer = self.pinnedContainer = vars.pinnedContainer && _getTarget(vars.pinnedContainer), 6352 triggerIndex = trigger && Math.max(0, _triggers.indexOf(self)) || 0, 6353 i = triggerIndex, 6354 cs, 6355 bounds, 6356 scroll, 6357 isVertical, 6358 override, 6359 curTrigger, 6360 curPin, 6361 oppositeScroll, 6362 initted, 6363 revertedPins, 6364 forcedOverflow; 6365 while (i--) { 6366 curTrigger = _triggers[i]; 6367 curTrigger.end || curTrigger.refresh(0, 1) || (_refreshing = self); 6368 curPin = curTrigger.pin; 6369 if (curPin && (curPin === trigger || curPin === pin || curPin === pinnedContainer) && !curTrigger.isReverted) { 6370 revertedPins || (revertedPins = []); 6371 revertedPins.unshift(curTrigger); 6372 curTrigger.revert(true, true); 6373 } 6374 if (curTrigger !== _triggers[i]) { 6375 triggerIndex--; 6376 i--; 6377 } 6378 } 6379 _isFunction(parsedStart) && (parsedStart = parsedStart(self)); 6380 start = _parsePosition(parsedStart, trigger, size, direction, scrollFunc(), markerStart, markerStartTrigger, self, scrollerBounds, borderWidth, useFixedPosition, max, containerAnimation) || (pin ? -0.001 : 0); 6381 _isFunction(parsedEnd) && (parsedEnd = parsedEnd(self)); 6382 if (_isString(parsedEnd) && !parsedEnd.indexOf("+=")) { 6383 if (~parsedEnd.indexOf(" ")) { 6384 parsedEnd = (_isString(parsedStart) ? parsedStart.split(" ")[0] : "") + parsedEnd; 6385 } else { 6386 offset = _offsetToPx(parsedEnd.substr(2), size); 6387 parsedEnd = _isString(parsedStart) ? parsedStart : (containerAnimation ? gsap$1.utils.mapRange(0, containerAnimation.duration(), containerAnimation.scrollTrigger.start, containerAnimation.scrollTrigger.end, start) : start) + offset; 6388 parsedEndTrigger = trigger; 6389 } 6390 } 6391 end = Math.max(start, _parsePosition(parsedEnd || (parsedEndTrigger ? "100% 0" : max), parsedEndTrigger, size, direction, scrollFunc() + offset, markerEnd, markerEndTrigger, self, scrollerBounds, borderWidth, useFixedPosition, max, containerAnimation)) || -0.001; 6392 change = end - start || (start -= 0.01) && 0.001; 6393 offset = 0; 6394 i = triggerIndex; 6395 while (i--) { 6396 curTrigger = _triggers[i]; 6397 curPin = curTrigger.pin; 6398 if (curPin && curTrigger.start - curTrigger._pinPush <= start && !containerAnimation && curTrigger.end > 0) { 6399 cs = curTrigger.end - curTrigger.start; 6400 if ((curPin === trigger && curTrigger.start - curTrigger._pinPush < start || curPin === pinnedContainer) && !_isNumber(parsedStart)) { 6401 offset += cs * (1 - curTrigger.progress); 6402 } 6403 curPin === pin && (otherPinOffset += cs); 6404 } 6405 } 6406 start += offset; 6407 end += offset; 6408 if (isFirstRefresh) { 6409 prevProgress = gsap$1.utils.clamp(0, 1, gsap$1.utils.normalize(start, end, prevScroll)); 6410 } 6411 self._pinPush = otherPinOffset; 6412 if (markerStart && offset) { 6413 cs = {}; 6414 cs[direction.a] = "+=" + offset; 6415 pinnedContainer && (cs[direction.p] = "-=" + scrollFunc()); 6416 gsap$1.set([markerStart, markerEnd], cs); 6417 } 6418 if (pin) { 6419 cs = _getComputedStyle(pin); 6420 isVertical = direction === _vertical; 6421 scroll = scrollFunc(); 6422 pinStart = parseFloat(pinGetter(direction.a)) + otherPinOffset; 6423 if (!max && end > 1) { 6424 forcedOverflow = (isViewport ? _doc$1.scrollingElement || _docEl$1 : scroller).style; 6425 forcedOverflow = { 6426 style: forcedOverflow, 6427 value: forcedOverflow["overflow" + direction.a.toUpperCase()] 6428 }; 6429 forcedOverflow.style["overflow" + direction.a.toUpperCase()] = "scroll"; 6430 } 6431 _swapPinIn(pin, spacer, cs); 6432 pinState = _getState(pin); 6433 bounds = _getBounds(pin, true); 6434 oppositeScroll = useFixedPosition && _getScrollFunc(scroller, isVertical ? _horizontal : _vertical)(); 6435 if (pinSpacing) { 6436 spacerState = [pinSpacing + direction.os2, change + otherPinOffset + _px]; 6437 spacerState.t = spacer; 6438 i = pinSpacing === _padding ? _getSize(pin, direction) + change + otherPinOffset : 0; 6439 i && spacerState.push(direction.d, i + _px); 6440 _setState(spacerState); 6441 if (pinnedContainer) { 6442 _triggers.forEach(function (t) { 6443 if (t.pin === pinnedContainer && t.vars.pinSpacing !== false) { 6444 t._subPinOffset = true; 6445 } 6446 }); 6447 } 6448 useFixedPosition && scrollFunc(prevScroll); 6449 } 6450 if (useFixedPosition) { 6451 override = { 6452 top: bounds.top + (isVertical ? scroll - start : oppositeScroll) + _px, 6453 left: bounds.left + (isVertical ? oppositeScroll : scroll - start) + _px, 6454 boxSizing: "border-box", 6455 position: "fixed" 6456 }; 6457 override[_width] = override["max" + _Width] = Math.ceil(bounds.width) + _px; 6458 override[_height] = override["max" + _Height] = Math.ceil(bounds.height) + _px; 6459 override[_margin] = override[_margin + _Top] = override[_margin + _Right] = override[_margin + _Bottom] = override[_margin + _Left] = "0"; 6460 override[_padding] = cs[_padding]; 6461 override[_padding + _Top] = cs[_padding + _Top]; 6462 override[_padding + _Right] = cs[_padding + _Right]; 6463 override[_padding + _Bottom] = cs[_padding + _Bottom]; 6464 override[_padding + _Left] = cs[_padding + _Left]; 6465 pinActiveState = _copyState(pinOriginalState, override, pinReparent); 6466 _refreshingAll && scrollFunc(0); 6467 } 6468 if (animation) { 6469 initted = animation._initted; 6470 _suppressOverwrites(1); 6471 animation.render(animation.duration(), true, true); 6472 pinChange = pinGetter(direction.a) - pinStart + change + otherPinOffset; 6473 pinMoves = Math.abs(change - pinChange) > 1; 6474 useFixedPosition && pinMoves && pinActiveState.splice(pinActiveState.length - 2, 2); 6475 animation.render(0, true, true); 6476 initted || animation.invalidate(true); 6477 animation.parent || animation.totalTime(animation.totalTime()); 6478 _suppressOverwrites(0); 6479 } else { 6480 pinChange = change; 6481 } 6482 forcedOverflow && (forcedOverflow.value ? forcedOverflow.style["overflow" + direction.a.toUpperCase()] = forcedOverflow.value : forcedOverflow.style.removeProperty("overflow-" + direction.a)); 6483 } else if (trigger && scrollFunc() && !containerAnimation) { 6484 bounds = trigger.parentNode; 6485 while (bounds && bounds !== _body$1) { 6486 if (bounds._pinOffset) { 6487 start -= bounds._pinOffset; 6488 end -= bounds._pinOffset; 6489 } 6490 bounds = bounds.parentNode; 6491 } 6492 } 6493 revertedPins && revertedPins.forEach(function (t) { 6494 return t.revert(false, true); 6495 }); 6496 self.start = start; 6497 self.end = end; 6498 scroll1 = scroll2 = _refreshingAll ? prevScroll : scrollFunc(); 6499 if (!containerAnimation && !_refreshingAll) { 6500 scroll1 < prevScroll && scrollFunc(prevScroll); 6501 self.scroll.rec = 0; 6502 } 6503 self.revert(false, true); 6504 if (snapDelayedCall) { 6505 lastSnap = -1; 6506 self.isActive && scrollFunc(start + change * prevProgress); 6507 snapDelayedCall.restart(true); 6508 } 6509 _refreshing = 0; 6510 animation && isToggle && (animation._initted || prevAnimProgress) && animation.progress() !== prevAnimProgress && animation.progress(prevAnimProgress, true).render(animation.time(), true, true); 6511 if (isFirstRefresh || prevProgress !== self.progress || containerAnimation) { 6512 animation && !isToggle && animation.totalProgress(containerAnimation && start < -0.001 && !prevProgress ? gsap$1.utils.normalize(start, end, 0) : prevProgress, true); 6513 self.progress = (scroll1 - start) / change === prevProgress ? 0 : prevProgress; 6514 } 6515 pin && pinSpacing && (spacer._pinOffset = Math.round(self.progress * pinChange)); 6516 scrubTween && scrubTween.invalidate(); 6517 onRefresh && !_refreshingAll && onRefresh(self); 6518 }; 6519 self.getVelocity = function () { 6520 return (scrollFunc() - scroll2) / (_getTime$1() - _time2) * 1000 || 0; 6521 }; 6522 self.endAnimation = function () { 6523 _endAnimation(self.callbackAnimation); 6524 if (animation) { 6525 scrubTween ? scrubTween.progress(1) : !animation.paused() ? _endAnimation(animation, animation.reversed()) : isToggle || _endAnimation(animation, self.direction < 0, 1); 6526 } 6527 }; 6528 self.labelToScroll = function (label) { 6529 return animation && animation.labels && (start || self.refresh() || start) + animation.labels[label] / animation.duration() * change || 0; 6530 }; 6531 self.getTrailing = function (name) { 6532 var i = _triggers.indexOf(self), 6533 a = self.direction > 0 ? _triggers.slice(0, i).reverse() : _triggers.slice(i + 1); 6534 return (_isString(name) ? a.filter(function (t) { 6535 return t.vars.preventOverlaps === name; 6536 }) : a).filter(function (t) { 6537 return self.direction > 0 ? t.end <= start : t.start >= end; 6538 }); 6539 }; 6540 self.update = function (reset, recordVelocity, forceFake) { 6541 if (containerAnimation && !forceFake && !reset) { 6542 return; 6543 } 6544 var scroll = _refreshingAll === true ? prevScroll : self.scroll(), 6545 p = reset ? 0 : (scroll - start) / change, 6546 clipped = p < 0 ? 0 : p > 1 ? 1 : p || 0, 6547 prevProgress = self.progress, 6548 isActive, 6549 wasActive, 6550 toggleState, 6551 action, 6552 stateChanged, 6553 toggled, 6554 isAtMax, 6555 isTakingAction; 6556 if (recordVelocity) { 6557 scroll2 = scroll1; 6558 scroll1 = containerAnimation ? scrollFunc() : scroll; 6559 if (snap) { 6560 snap2 = snap1; 6561 snap1 = animation && !isToggle ? animation.totalProgress() : clipped; 6562 } 6563 } 6564 anticipatePin && !clipped && pin && !_refreshing && !_startup$1 && _lastScrollTime && start < scroll + (scroll - scroll2) / (_getTime$1() - _time2) * anticipatePin && (clipped = 0.0001); 6565 if (clipped !== prevProgress && self.enabled) { 6566 isActive = self.isActive = !!clipped && clipped < 1; 6567 wasActive = !!prevProgress && prevProgress < 1; 6568 toggled = isActive !== wasActive; 6569 stateChanged = toggled || !!clipped !== !!prevProgress; 6570 self.direction = clipped > prevProgress ? 1 : -1; 6571 self.progress = clipped; 6572 if (stateChanged && !_refreshing) { 6573 toggleState = clipped && !prevProgress ? 0 : clipped === 1 ? 1 : prevProgress === 1 ? 2 : 3; 6574 if (isToggle) { 6575 action = !toggled && toggleActions[toggleState + 1] !== "none" && toggleActions[toggleState + 1] || toggleActions[toggleState]; 6576 isTakingAction = animation && (action === "complete" || action === "reset" || action in animation); 6577 } 6578 } 6579 preventOverlaps && (toggled || isTakingAction) && (isTakingAction || scrub || !animation) && (_isFunction(preventOverlaps) ? preventOverlaps(self) : self.getTrailing(preventOverlaps).forEach(function (t) { 6580 return t.endAnimation(); 6581 })); 6582 if (!isToggle) { 6583 if (scrubTween && !_refreshing && !_startup$1) { 6584 scrubTween._dp._time - scrubTween._start !== scrubTween._time && scrubTween.render(scrubTween._dp._time - scrubTween._start); 6585 if (scrubTween.resetTo) { 6586 scrubTween.resetTo("totalProgress", clipped, animation._tTime / animation._tDur); 6587 } else { 6588 scrubTween.vars.totalProgress = clipped; 6589 scrubTween.invalidate().restart(); 6590 } 6591 } else if (animation) { 6592 animation.totalProgress(clipped, !!_refreshing); 6593 } 6594 } 6595 if (pin) { 6596 reset && pinSpacing && (spacer.style[pinSpacing + direction.os2] = spacingStart); 6597 if (!useFixedPosition) { 6598 pinSetter(_round(pinStart + pinChange * clipped)); 6599 } else if (stateChanged) { 6600 isAtMax = !reset && clipped > prevProgress && end + 1 > scroll && scroll + 1 >= _maxScroll(scroller, direction); 6601 if (pinReparent) { 6602 if (!reset && (isActive || isAtMax)) { 6603 var bounds = _getBounds(pin, true), 6604 _offset = scroll - start; 6605 _reparent(pin, _body$1, bounds.top + (direction === _vertical ? _offset : 0) + _px, bounds.left + (direction === _vertical ? 0 : _offset) + _px); 6606 } else { 6607 _reparent(pin, spacer); 6608 } 6609 } 6610 _setState(isActive || isAtMax ? pinActiveState : pinState); 6611 pinMoves && clipped < 1 && isActive || pinSetter(pinStart + (clipped === 1 && !isAtMax ? pinChange : 0)); 6612 } 6613 } 6614 snap && !tweenTo.tween && !_refreshing && !_startup$1 && snapDelayedCall.restart(true); 6615 toggleClass && (toggled || once && clipped && (clipped < 1 || !_limitCallbacks)) && _toArray(toggleClass.targets).forEach(function (el) { 6616 return el.classList[isActive || once ? "add" : "remove"](toggleClass.className); 6617 }); 6618 onUpdate && !isToggle && !reset && onUpdate(self); 6619 if (stateChanged && !_refreshing) { 6620 if (isToggle) { 6621 if (isTakingAction) { 6622 if (action === "complete") { 6623 animation.pause().totalProgress(1); 6624 } else if (action === "reset") { 6625 animation.restart(true).pause(); 6626 } else if (action === "restart") { 6627 animation.restart(true); 6628 } else { 6629 animation[action](); 6630 } 6631 } 6632 onUpdate && onUpdate(self); 6633 } 6634 if (toggled || !_limitCallbacks) { 6635 onToggle && toggled && _callback(self, onToggle); 6636 callbacks[toggleState] && _callback(self, callbacks[toggleState]); 6637 once && (clipped === 1 ? self.kill(false, 1) : callbacks[toggleState] = 0); 6638 if (!toggled) { 6639 toggleState = clipped === 1 ? 1 : 3; 6640 callbacks[toggleState] && _callback(self, callbacks[toggleState]); 6641 } 6642 } 6643 if (fastScrollEnd && !isActive && Math.abs(self.getVelocity()) > (_isNumber(fastScrollEnd) ? fastScrollEnd : 2500)) { 6644 _endAnimation(self.callbackAnimation); 6645 scrubTween ? scrubTween.progress(1) : _endAnimation(animation, action === "reverse" ? 1 : !clipped, 1); 6646 } 6647 } else if (isToggle && onUpdate && !_refreshing) { 6648 onUpdate(self); 6649 } 6650 } 6651 if (markerEndSetter) { 6652 var n = containerAnimation ? scroll / containerAnimation.duration() * (containerAnimation._caScrollDist || 0) : scroll; 6653 markerStartSetter(n + (markerStartTrigger._isFlipped ? 1 : 0)); 6654 markerEndSetter(n); 6655 } 6656 caMarkerSetter && caMarkerSetter(-scroll / containerAnimation.duration() * (containerAnimation._caScrollDist || 0)); 6657 }; 6658 self.enable = function (reset, refresh) { 6659 if (!self.enabled) { 6660 self.enabled = true; 6661 _addListener$1(scroller, "resize", _onResize); 6662 _addListener$1(isViewport ? _doc$1 : scroller, "scroll", _onScroll$1); 6663 onRefreshInit && _addListener$1(ScrollTrigger, "refreshInit", onRefreshInit); 6664 if (reset !== false) { 6665 self.progress = prevProgress = 0; 6666 scroll1 = scroll2 = lastSnap = scrollFunc(); 6667 } 6668 refresh !== false && self.refresh(); 6669 } 6670 }; 6671 self.getTween = function (snap) { 6672 return snap && tweenTo ? tweenTo.tween : scrubTween; 6673 }; 6674 self.setPositions = function (newStart, newEnd) { 6675 if (pin) { 6676 pinStart += newStart - start; 6677 pinChange += newEnd - newStart - change; 6678 pinSpacing === _padding && self.adjustPinSpacing(newEnd - newStart - change); 6679 } 6680 self.start = start = newStart; 6681 self.end = end = newEnd; 6682 change = newEnd - newStart; 6683 self.update(); 6684 }; 6685 self.adjustPinSpacing = function (amount) { 6686 if (spacerState && amount) { 6687 var i = spacerState.indexOf(direction.d) + 1; 6688 spacerState[i] = parseFloat(spacerState[i]) + amount + _px; 6689 spacerState[1] = parseFloat(spacerState[1]) + amount + _px; 6690 _setState(spacerState); 6691 } 6692 }; 6693 self.disable = function (reset, allowAnimation) { 6694 if (self.enabled) { 6695 reset !== false && self.revert(true, true); 6696 self.enabled = self.isActive = false; 6697 allowAnimation || scrubTween && scrubTween.pause(); 6698 prevScroll = 0; 6699 pinCache && (pinCache.uncache = 1); 6700 onRefreshInit && _removeListener$1(ScrollTrigger, "refreshInit", onRefreshInit); 6701 if (snapDelayedCall) { 6702 snapDelayedCall.pause(); 6703 tweenTo.tween && tweenTo.tween.kill() && (tweenTo.tween = 0); 6704 } 6705 if (!isViewport) { 6706 var i = _triggers.length; 6707 while (i--) { 6708 if (_triggers[i].scroller === scroller && _triggers[i] !== self) { 6709 return; 6710 } 6711 } 6712 _removeListener$1(scroller, "resize", _onResize); 6713 _removeListener$1(scroller, "scroll", _onScroll$1); 6714 } 6715 } 6716 }; 6717 self.kill = function (revert, allowAnimation) { 6718 self.disable(revert, allowAnimation); 6719 scrubTween && !allowAnimation && scrubTween.kill(); 6720 id && delete _ids[id]; 6721 var i = _triggers.indexOf(self); 6722 i >= 0 && _triggers.splice(i, 1); 6723 i === _i && _direction > 0 && _i--; 6724 i = 0;
vendor: 17,363 bytes, lines 6725-7114
6725 _triggers.forEach(function (t) { 6726 return t.scroller === self.scroller && (i = 1); 6727 }); 6728 i || _refreshingAll || (self.scroll.rec = 0); 6729 if (animation) { 6730 animation.scrollTrigger = null; 6731 revert && animation.revert({ 6732 kill: false 6733 }); 6734 allowAnimation || animation.kill(); 6735 } 6736 markerStart && [markerStart, markerEnd, markerStartTrigger, markerEndTrigger].forEach(function (m) { 6737 return m.parentNode && m.parentNode.removeChild(m); 6738 }); 6739 _primary === self && (_primary = 0); 6740 if (pin) { 6741 pinCache && (pinCache.uncache = 1); 6742 i = 0; 6743 _triggers.forEach(function (t) { 6744 return t.pin === pin && i++; 6745 }); 6746 i || (pinCache.spacer = 0); 6747 } 6748 vars.onKill && vars.onKill(self); 6749 }; 6750 self.enable(false, false); 6751 customRevertReturn && customRevertReturn(self); 6752 !animation || !animation.add || change ? self.refresh() : gsap$1.delayedCall(0.01, function () { 6753 return start || end || self.refresh(); 6754 }) && (change = 0.01) && (start = end = 0); 6755 pin && _queueRefreshAll(); 6756 }; 6757 ScrollTrigger.register = function register(core) { 6758 if (!_coreInitted$1) { 6759 gsap$1 = core || _getGSAP$1(); 6760 _windowExists() && window.document && ScrollTrigger.enable(); 6761 _coreInitted$1 = _enabled; 6762 } 6763 return _coreInitted$1; 6764 }; 6765 ScrollTrigger.defaults = function defaults(config) { 6766 if (config) { 6767 for (var p in config) { 6768 _defaults[p] = config[p]; 6769 } 6770 } 6771 return _defaults; 6772 }; 6773 ScrollTrigger.disable = function disable(reset, kill) { 6774 _enabled = 0; 6775 _triggers.forEach(function (trigger) { 6776 return trigger[kill ? "kill" : "disable"](reset); 6777 }); 6778 _removeListener$1(_win$1, "wheel", _onScroll$1); 6779 _removeListener$1(_doc$1, "scroll", _onScroll$1); 6780 clearInterval(_syncInterval); 6781 _removeListener$1(_doc$1, "touchcancel", _passThrough); 6782 _removeListener$1(_body$1, "touchstart", _passThrough); 6783 _multiListener(_removeListener$1, _doc$1, "pointerdown,touchstart,mousedown", _pointerDownHandler); 6784 _multiListener(_removeListener$1, _doc$1, "pointerup,touchend,mouseup", _pointerUpHandler); 6785 _resizeDelay.kill(); 6786 _iterateAutoRefresh(_removeListener$1); 6787 for (var i = 0; i < _scrollers.length; i += 3) { 6788 _wheelListener(_removeListener$1, _scrollers[i], _scrollers[i + 1]); 6789 _wheelListener(_removeListener$1, _scrollers[i], _scrollers[i + 2]); 6790 } 6791 }; 6792 ScrollTrigger.enable = function enable() { 6793 _win$1 = window; 6794 _doc$1 = document; 6795 _docEl$1 = _doc$1.documentElement; 6796 _body$1 = _doc$1.body; 6797 if (gsap$1) { 6798 _toArray = gsap$1.utils.toArray; 6799 _clamp$1 = gsap$1.utils.clamp; 6800 _context$1 = gsap$1.core.context || _passThrough; 6801 _suppressOverwrites = gsap$1.core.suppressOverwrites || _passThrough; 6802 _scrollRestoration = _win$1.history.scrollRestoration || "auto"; 6803 _lastScroll = _win$1.pageYOffset; 6804 gsap$1.core.globals("ScrollTrigger", ScrollTrigger); 6805 if (_body$1) { 6806 _enabled = 1; 6807 _rafBugFix(); 6808 Observer.register(gsap$1); 6809 ScrollTrigger.isTouch = Observer.isTouch; 6810 _fixIOSBug = Observer.isTouch && /(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent); 6811 _addListener$1(_win$1, "wheel", _onScroll$1); 6812 _root$1 = [_win$1, _doc$1, _docEl$1, _body$1]; 6813 if (gsap$1.matchMedia) { 6814 ScrollTrigger.matchMedia = function (vars) { 6815 var mm = gsap$1.matchMedia(), 6816 p; 6817 for (p in vars) { 6818 mm.add(p, vars[p]); 6819 } 6820 return mm; 6821 }; 6822 gsap$1.addEventListener("matchMediaInit", function () { 6823 return _revertAll(); 6824 }); 6825 gsap$1.addEventListener("matchMediaRevert", function () { 6826 return _revertRecorded(); 6827 }); 6828 gsap$1.addEventListener("matchMedia", function () { 6829 _refreshAll(0, 1); 6830 _dispatch("matchMedia"); 6831 }); 6832 gsap$1.matchMedia("(orientation: portrait)", function () { 6833 _setBaseDimensions(); 6834 return _setBaseDimensions; 6835 }); 6836 } else { 6837 console.warn("Requires GSAP 3.11.0 or later"); 6838 } 6839 _setBaseDimensions(); 6840 _addListener$1(_doc$1, "scroll", _onScroll$1); 6841 var bodyStyle = _body$1.style, 6842 border = bodyStyle.borderTopStyle, 6843 AnimationProto = gsap$1.core.Animation.prototype, 6844 bounds, 6845 i; 6846 AnimationProto.revert || Object.defineProperty(AnimationProto, "revert", { 6847 value: function value() { 6848 return this.time(-0.01, true); 6849 } 6850 }); 6851 bodyStyle.borderTopStyle = "solid"; 6852 bounds = _getBounds(_body$1); 6853 _vertical.m = Math.round(bounds.top + _vertical.sc()) || 0; 6854 _horizontal.m = Math.round(bounds.left + _horizontal.sc()) || 0; 6855 border ? bodyStyle.borderTopStyle = border : bodyStyle.removeProperty("border-top-style"); 6856 _syncInterval = setInterval(_sync, 250); 6857 gsap$1.delayedCall(0.5, function () { 6858 return _startup$1 = 0; 6859 }); 6860 _addListener$1(_doc$1, "touchcancel", _passThrough); 6861 _addListener$1(_body$1, "touchstart", _passThrough); 6862 _multiListener(_addListener$1, _doc$1, "pointerdown,touchstart,mousedown", _pointerDownHandler); 6863 _multiListener(_addListener$1, _doc$1, "pointerup,touchend,mouseup", _pointerUpHandler); 6864 _transformProp = gsap$1.utils.checkPrefix("transform"); 6865 _stateProps.push(_transformProp); 6866 _coreInitted$1 = _getTime$1(); 6867 _resizeDelay = gsap$1.delayedCall(0.2, _refreshAll).pause(); 6868 _autoRefresh = [_doc$1, "visibilitychange", function () { 6869 var w = _win$1.innerWidth, 6870 h = _win$1.innerHeight; 6871 if (_doc$1.hidden) { 6872 _prevWidth = w; 6873 _prevHeight = h; 6874 } else if (_prevWidth !== w || _prevHeight !== h) { 6875 _onResize(); 6876 } 6877 }, _doc$1, "DOMContentLoaded", _refreshAll, _win$1, "load", _refreshAll, _win$1, "resize", _onResize]; 6878 _iterateAutoRefresh(_addListener$1); 6879 _triggers.forEach(function (trigger) { 6880 return trigger.enable(0, 1); 6881 }); 6882 for (i = 0; i < _scrollers.length; i += 3) { 6883 _wheelListener(_removeListener$1, _scrollers[i], _scrollers[i + 1]); 6884 _wheelListener(_removeListener$1, _scrollers[i], _scrollers[i + 2]); 6885 } 6886 } 6887 } 6888 }; 6889 ScrollTrigger.config = function config(vars) { 6890 "limitCallbacks" in vars && (_limitCallbacks = !!vars.limitCallbacks); 6891 var ms = vars.syncInterval; 6892 ms && clearInterval(_syncInterval) || (_syncInterval = ms) && setInterval(_sync, ms); 6893 "ignoreMobileResize" in vars && (_ignoreMobileResize = ScrollTrigger.isTouch === 1 && vars.ignoreMobileResize); 6894 if ("autoRefreshEvents" in vars) { 6895 _iterateAutoRefresh(_removeListener$1) || _iterateAutoRefresh(_addListener$1, vars.autoRefreshEvents || "none"); 6896 _ignoreResize = (vars.autoRefreshEvents + "").indexOf("resize") === -1; 6897 } 6898 }; 6899 ScrollTrigger.scrollerProxy = function scrollerProxy(target, vars) { 6900 var t = _getTarget(target), 6901 i = _scrollers.indexOf(t), 6902 isViewport = _isViewport$1(t); 6903 if (~i) { 6904 _scrollers.splice(i, isViewport ? 6 : 2); 6905 } 6906 if (vars) { 6907 isViewport ? _proxies.unshift(_win$1, vars, _body$1, vars, _docEl$1, vars) : _proxies.unshift(t, vars); 6908 } 6909 }; 6910 ScrollTrigger.clearMatchMedia = function clearMatchMedia(query) { 6911 _triggers.forEach(function (t) { 6912 return t._ctx && t._ctx.query === query && t._ctx.kill(true, true); 6913 }); 6914 }; 6915 ScrollTrigger.isInViewport = function isInViewport(element, ratio, horizontal) { 6916 var bounds = (_isString(element) ? _getTarget(element) : element).getBoundingClientRect(), 6917 offset = bounds[horizontal ? _width : _height] * ratio || 0; 6918 return horizontal ? bounds.right - offset > 0 && bounds.left + offset < _win$1.innerWidth : bounds.bottom - offset > 0 && bounds.top + offset < _win$1.innerHeight; 6919 }; 6920 ScrollTrigger.positionInViewport = function positionInViewport(element, referencePoint, horizontal) { 6921 _isString(element) && (element = _getTarget(element)); 6922 var bounds = element.getBoundingClientRect(), 6923 size = bounds[horizontal ? _width : _height], 6924 offset = referencePoint == null ? size / 2 : referencePoint in _keywords ? _keywords[referencePoint] * size : ~referencePoint.indexOf("%") ? parseFloat(referencePoint) * size / 100 : parseFloat(referencePoint) || 0; 6925 return horizontal ? (bounds.left + offset) / _win$1.innerWidth : (bounds.top + offset) / _win$1.innerHeight; 6926 }; 6927 ScrollTrigger.killAll = function killAll(allowListeners) { 6928 _triggers.slice(0).forEach(function (t) { 6929 return t.vars.id !== "ScrollSmoother" && t.kill(); 6930 }); 6931 if (allowListeners !== true) { 6932 var listeners = _listeners.killAll || []; 6933 _listeners = {}; 6934 listeners.forEach(function (f) { 6935 return f(); 6936 }); 6937 } 6938 }; 6939 return ScrollTrigger; 6940 }(); 6941 ScrollTrigger$1.version = "3.11.5"; 6942 ScrollTrigger$1.saveStyles = function (targets) { 6943 return targets ? _toArray(targets).forEach(function (target) { 6944 if (target && target.style) { 6945 var i = _savedStyles.indexOf(target); 6946 i >= 0 && _savedStyles.splice(i, 5); 6947 _savedStyles.push(target, target.style.cssText, target.getBBox && target.getAttribute("transform"), gsap$1.core.getCache(target), _context$1()); 6948 } 6949 }) : _savedStyles; 6950 }; 6951 ScrollTrigger$1.revert = function (soft, media) { 6952 return _revertAll(!soft, media); 6953 }; 6954 ScrollTrigger$1.create = function (vars, animation) { 6955 return new ScrollTrigger$1(vars, animation); 6956 }; 6957 ScrollTrigger$1.refresh = function (safe) { 6958 return safe ? _onResize() : (_coreInitted$1 || ScrollTrigger$1.register()) && _refreshAll(true); 6959 }; 6960 ScrollTrigger$1.update = function (force) { 6961 return ++_scrollers.cache && _updateAll(force === true ? 2 : 0); 6962 }; 6963 ScrollTrigger$1.clearScrollMemory = _clearScrollMemory; 6964 ScrollTrigger$1.maxScroll = function (element, horizontal) { 6965 return _maxScroll(element, horizontal ? _horizontal : _vertical); 6966 }; 6967 ScrollTrigger$1.getScrollFunc = function (element, horizontal) { 6968 return _getScrollFunc(_getTarget(element), horizontal ? _horizontal : _vertical); 6969 }; 6970 ScrollTrigger$1.getById = function (id) { 6971 return _ids[id]; 6972 }; 6973 ScrollTrigger$1.getAll = function () { 6974 return _triggers.filter(function (t) { 6975 return t.vars.id !== "ScrollSmoother"; 6976 }); 6977 }; 6978 ScrollTrigger$1.isScrolling = function () { 6979 return !!_lastScrollTime; 6980 }; 6981 ScrollTrigger$1.snapDirectional = _snapDirectional; 6982 ScrollTrigger$1.addEventListener = function (type, callback) { 6983 var a = _listeners[type] || (_listeners[type] = []); 6984 ~a.indexOf(callback) || a.push(callback); 6985 }; 6986 ScrollTrigger$1.removeEventListener = function (type, callback) { 6987 var a = _listeners[type], 6988 i = a && a.indexOf(callback); 6989 i >= 0 && a.splice(i, 1); 6990 }; 6991 ScrollTrigger$1.batch = function (targets, vars) { 6992 var result = [], 6993 varsCopy = {}, 6994 interval = vars.interval || 0.016, 6995 batchMax = vars.batchMax || 1e9, 6996 proxyCallback = function proxyCallback(type, callback) { 6997 var elements = [], 6998 triggers = [], 6999 delay = gsap$1.delayedCall(interval, function () { 7000 callback(elements, triggers); 7001 elements = []; 7002 triggers = []; 7003 }).pause(); 7004 return function (self) { 7005 elements.length || delay.restart(true); 7006 elements.push(self.trigger); 7007 triggers.push(self); 7008 batchMax <= elements.length && delay.progress(1); 7009 }; 7010 }, 7011 p; 7012 for (p in vars) { 7013 varsCopy[p] = p.substr(0, 2) === "on" && _isFunction(vars[p]) && p !== "onRefreshInit" ? proxyCallback(p, vars[p]) : vars[p]; 7014 } 7015 if (_isFunction(batchMax)) { 7016 batchMax = batchMax(); 7017 _addListener$1(ScrollTrigger$1, "refresh", function () { 7018 return batchMax = vars.batchMax(); 7019 }); 7020 } 7021 _toArray(targets).forEach(function (target) { 7022 var config = {}; 7023 for (p in varsCopy) { 7024 config[p] = varsCopy[p]; 7025 } 7026 config.trigger = target; 7027 result.push(ScrollTrigger$1.create(config)); 7028 }); 7029 return result; 7030 }; 7031 var _clampScrollAndGetDurationMultiplier = function _clampScrollAndGetDurationMultiplier(scrollFunc, current, end, max) { 7032 current > max ? scrollFunc(max) : current < 0 && scrollFunc(0); 7033 return end > max ? (max - current) / (end - current) : end < 0 ? current / (current - end) : 1; 7034 }, 7035 _allowNativePanning = function _allowNativePanning(target, direction) { 7036 if (direction === true) { 7037 target.style.removeProperty("touch-action"); 7038 } else { 7039 target.style.touchAction = direction === true ? "auto" : direction ? "pan-" + direction + (Observer.isTouch ? " pinch-zoom" : "") : "none"; 7040 } 7041 target === _docEl$1 && _allowNativePanning(_body$1, direction); 7042 }, 7043 _overflow = { 7044 auto: 1, 7045 scroll: 1 7046 }, 7047 _nestedScroll = function _nestedScroll(_ref5) { 7048 var event = _ref5.event, 7049 target = _ref5.target, 7050 axis = _ref5.axis; 7051 var node = (event.changedTouches ? event.changedTouches[0] : event).target, 7052 cache = node._gsap || gsap$1.core.getCache(node), 7053 time = _getTime$1(), 7054 cs; 7055 if (!cache._isScrollT || time - cache._isScrollT > 2000) { 7056 while (node && node !== _body$1 && (node.scrollHeight <= node.clientHeight && node.scrollWidth <= node.clientWidth || !(_overflow[(cs = _getComputedStyle(node)).overflowY] || _overflow[cs.overflowX]))) { 7057 node = node.parentNode; 7058 } 7059 cache._isScroll = node && node !== target && !_isViewport$1(node) && (_overflow[(cs = _getComputedStyle(node)).overflowY] || _overflow[cs.overflowX]); 7060 cache._isScrollT = time; 7061 } 7062 if (cache._isScroll || axis === "x") { 7063 event.stopPropagation(); 7064 event._gsapAllow = true; 7065 } 7066 }, 7067 _inputObserver = function _inputObserver(target, type, inputs, nested) { 7068 return Observer.create({ 7069 target: target, 7070 capture: true, 7071 debounce: false, 7072 lockAxis: true, 7073 type: type, 7074 onWheel: nested = nested && _nestedScroll, 7075 onPress: nested, 7076 onDrag: nested, 7077 onScroll: nested, 7078 onEnable: function onEnable() { 7079 return inputs && _addListener$1(_doc$1, Observer.eventTypes[0], _captureInputs, false, true); 7080 }, 7081 onDisable: function onDisable() { 7082 return _removeListener$1(_doc$1, Observer.eventTypes[0], _captureInputs, true); 7083 } 7084 }); 7085 }, 7086 _inputExp = /(input|label|select|textarea)/i, 7087 _inputIsFocused, 7088 _captureInputs = function _captureInputs(e) { 7089 var isInput = _inputExp.test(e.target.tagName); 7090 if (isInput || _inputIsFocused) { 7091 e._gsapAllow = true; 7092 _inputIsFocused = isInput; 7093 } 7094 }, 7095 _getScrollNormalizer = function _getScrollNormalizer(vars) { 7096 _isObject(vars) || (vars = {}); 7097 vars.preventDefault = vars.isNormalizer = vars.allowClicks = true; 7098 vars.type || (vars.type = "wheel,touch"); 7099 vars.debounce = !!vars.debounce; 7100 vars.id = vars.id || "normalizer"; 7101 var _vars2 = vars, 7102 normalizeScrollX = _vars2.normalizeScrollX, 7103 momentum = _vars2.momentum, 7104 allowNestedScroll = _vars2.allowNestedScroll, 7105 onRelease = _vars2.onRelease, 7106 self, 7107 maxY, 7108 target = _getTarget(vars.target) || _docEl$1, 7109 smoother = gsap$1.core.globals().ScrollSmoother, 7110 smootherInstance = smoother && smoother.get(), 7111 content = _fixIOSBug && (vars.content && _getTarget(vars.content) || smootherInstance && vars.content !== false && !smootherInstance.smooth() && smootherInstance.content()), 7112 scrollFuncY = _getScrollFunc(target, _vertical), 7113 scrollFuncX = _getScrollFunc(target, _horizontal), 7114 scale = 1,
vendor: 4,936 bytes, lines 7115-7217
7115 initialScale = (Observer.isTouch && _win$1.visualViewport ? _win$1.visualViewport.scale * _win$1.visualViewport.width : _win$1.outerWidth) / _win$1.innerWidth, 7116 wheelRefresh = 0, 7117 resolveMomentumDuration = _isFunction(momentum) ? function () { 7118 return momentum(self); 7119 } : function () { 7120 return momentum || 2.8; 7121 }, 7122 lastRefreshID, 7123 skipTouchMove, 7124 inputObserver = _inputObserver(target, vars.type, true, allowNestedScroll), 7125 resumeTouchMove = function resumeTouchMove() { 7126 return skipTouchMove = false; 7127 }, 7128 scrollClampX = _passThrough, 7129 scrollClampY = _passThrough, 7130 updateClamps = function updateClamps() { 7131 maxY = _maxScroll(target, _vertical); 7132 scrollClampY = _clamp$1(_fixIOSBug ? 1 : 0, maxY); 7133 normalizeScrollX && (scrollClampX = _clamp$1(0, _maxScroll(target, _horizontal))); 7134 lastRefreshID = _refreshID; 7135 }, 7136 removeContentOffset = function removeContentOffset() { 7137 content._gsap.y = _round(parseFloat(content._gsap.y) + scrollFuncY.offset) + "px"; 7138 content.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + parseFloat(content._gsap.y) + ", 0, 1)"; 7139 scrollFuncY.offset = scrollFuncY.cacheID = 0; 7140 }, 7141 ignoreDrag = function ignoreDrag() { 7142 if (skipTouchMove) { 7143 requestAnimationFrame(resumeTouchMove); 7144 var offset = _round(self.deltaY / 2), 7145 scroll = scrollClampY(scrollFuncY.v - offset); 7146 if (content && scroll !== scrollFuncY.v + scrollFuncY.offset) { 7147 scrollFuncY.offset = scroll - scrollFuncY.v; 7148 var y = _round((parseFloat(content && content._gsap.y) || 0) - scrollFuncY.offset); 7149 content.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + y + ", 0, 1)"; 7150 content._gsap.y = y + "px"; 7151 scrollFuncY.cacheID = _scrollers.cache; 7152 _updateAll(); 7153 } 7154 return true; 7155 } 7156 scrollFuncY.offset && removeContentOffset(); 7157 skipTouchMove = true; 7158 }, 7159 tween, 7160 startScrollX, 7161 startScrollY, 7162 onStopDelayedCall, 7163 onResize = function onResize() { 7164 updateClamps(); 7165 if (tween.isActive() && tween.vars.scrollY > maxY) { 7166 scrollFuncY() > maxY ? tween.progress(1) && scrollFuncY(maxY) : tween.resetTo("scrollY", maxY); 7167 } 7168 }; 7169 content && gsap$1.set(content, { 7170 y: "+=0" 7171 }); 7172 vars.ignoreCheck = function (e) { 7173 return _fixIOSBug && e.type === "touchmove" && ignoreDrag() || scale > 1.05 && e.type !== "touchstart" || self.isGesturing || e.touches && e.touches.length > 1; 7174 }; 7175 vars.onPress = function () { 7176 skipTouchMove = false; 7177 var prevScale = scale; 7178 scale = _round((_win$1.visualViewport && _win$1.visualViewport.scale || 1) / initialScale); 7179 tween.pause(); 7180 prevScale !== scale && _allowNativePanning(target, scale > 1.01 ? true : normalizeScrollX ? false : "x"); 7181 startScrollX = scrollFuncX(); 7182 startScrollY = scrollFuncY(); 7183 updateClamps(); 7184 lastRefreshID = _refreshID; 7185 }; 7186 vars.onRelease = vars.onGestureStart = function (self, wasDragging) { 7187 scrollFuncY.offset && removeContentOffset(); 7188 if (!wasDragging) { 7189 onStopDelayedCall.restart(true); 7190 } else { 7191 _scrollers.cache++; 7192 var dur = resolveMomentumDuration(), 7193 currentScroll, 7194 endScroll; 7195 if (normalizeScrollX) { 7196 currentScroll = scrollFuncX(); 7197 endScroll = currentScroll + dur * 0.05 * -self.velocityX / 0.227; 7198 dur *= _clampScrollAndGetDurationMultiplier(scrollFuncX, currentScroll, endScroll, _maxScroll(target, _horizontal)); 7199 tween.vars.scrollX = scrollClampX(endScroll); 7200 } 7201 currentScroll = scrollFuncY(); 7202 endScroll = currentScroll + dur * 0.05 * -self.velocityY / 0.227; 7203 dur *= _clampScrollAndGetDurationMultiplier(scrollFuncY, currentScroll, endScroll, _maxScroll(target, _vertical)); 7204 tween.vars.scrollY = scrollClampY(endScroll); 7205 tween.invalidate().duration(dur).play(0.01); 7206 if (_fixIOSBug && tween.vars.scrollY >= maxY || currentScroll >= maxY - 1) { 7207 gsap$1.to({}, { 7208 onUpdate: onResize, 7209 duration: dur 7210 }); 7211 } 7212 } 7213 onRelease && onRelease(self); 7214 }; 7215 vars.onWheel = function () { 7216 tween._ts && tween.pause(); 7217 if (_getTime$1() - wheelRefresh > 1000) {
7218 lastRefreshID = 0; 7219 wheelRefresh = _getTime$1(); 7220 } 7221 }; 7222 vars.onChange = function (self, dx, dy, xArray, yArray) { 7223 _refreshID !== lastRefreshID && updateClamps(); 7224 dx && normalizeScrollX && scrollFuncX(scrollClampX(xArray[2] === dx ? startScrollX + (self.startX - self.x) : scrollFuncX() + dx - xArray[1])); 7225 if (dy) { 7226 scrollFuncY.offset && removeContentOffset(); 7227 var isTouch = yArray[2] === dy, 7228 y = isTouch ? startScrollY + self.startY - self.y : scrollFuncY() + dy - yArray[1], 7229 yClamped = scrollClampY(y); 7230 isTouch && y !== yClamped && (startScrollY += yClamped - y); 7231 scrollFuncY(yClamped); 7232 } 7233 (dy || dx) && _updateAll(); 7234 }; 7235 vars.onEnable = function () { 7236 _allowNativePanning(target, normalizeScrollX ? false : "x"); 7237 ScrollTrigger$1.addEventListener("refresh", onResize); 7238 _addListener$1(_win$1, "resize", onResize); 7239 if (scrollFuncY.smooth) { 7240 scrollFuncY.target.style.scrollBehavior = "auto"; 7241 scrollFuncY.smooth = scrollFuncX.smooth = false; 7242 } 7243 inputObserver.enable(); 7244 }; 7245 vars.onDisable = function () { 7246 _allowNativePanning(target, true); 7247 _removeListener$1(_win$1, "resize", onResize); 7248 ScrollTrigger$1.removeEventListener("refresh", onResize); 7249 inputObserver.kill(); 7250 }; 7251 vars.lockAxis = vars.lockAxis !== false; 7252 self = new Observer(vars); 7253 self.iOS = _fixIOSBug; 7254 _fixIOSBug && !scrollFuncY() && scrollFuncY(1); 7255 _fixIOSBug && gsap$1.ticker.add(_passThrough); 7256 onStopDelayedCall = self._dc; 7257 tween = gsap$1.to(self, { 7258 ease: "power4", 7259 paused: true, 7260 scrollX: normalizeScrollX ? "+=0.1" : "+=0", 7261 scrollY: "+=0.1", 7262 modifiers: { 7263 scrollY: _interruptionTracker(scrollFuncY, scrollFuncY(), function () { 7264 return tween.pause(); 7265 }) 7266 }, 7267 onUpdate: _updateAll, 7268 onComplete: onStopDelayedCall.vars.onComplete 7269 }); 7270 return self; 7271 }; 7272 ScrollTrigger$1.sort = function (func) { 7273 return _triggers.sort(func || function (a, b) { 7274 return (a.vars.refreshPriority || 0) * -1e6 + a.start - (b.start + (b.vars.refreshPriority || 0) * -1e6); 7275 }); 7276 }; 7277 ScrollTrigger$1.observe = function (vars) { 7278 return new Observer(vars); 7279 }; 7280 ScrollTrigger$1.normalizeScroll = function (vars) { 7281 if (typeof vars === "undefined") { 7282 return _normalizer$1; 7283 } 7284 if (vars === true && _normalizer$1) { 7285 return _normalizer$1.enable(); 7286 } 7287 if (vars === false) { 7288 return _normalizer$1 && _normalizer$1.kill(); 7289 } 7290 var normalizer = vars instanceof Observer ? vars : _getScrollNormalizer(vars); 7291 _normalizer$1 && _normalizer$1.target === normalizer.target && _normalizer$1.kill(); 7292 _isViewport$1(normalizer.target) && (_normalizer$1 = normalizer); 7293 return normalizer; 7294 }; 7295 ScrollTrigger$1.core = { 7296 _getVelocityProp: _getVelocityProp, 7297 _inputObserver: _inputObserver, 7298 _scrollers: _scrollers, 7299 _proxies: _proxies, 7300 bridge: { 7301 ss: function ss() { 7302 _lastScrollTime || _dispatch("scrollStart"); 7303 _lastScrollTime = _getTime$1(); 7304 }, 7305 ref: function ref() { 7306 return _refreshing; 7307 } 7308 } 7309 }; 7310 _getGSAP$1() && gsap$1.registerPlugin(ScrollTrigger$1); 7311 exports.ScrollTrigger = ScrollTrigger$1; 7312 exports.default = ScrollTrigger$1; 7313 if (typeof window === 'undefined' || window !== exports) { 7314 Object.defineProperty(exports, '__esModule', { 7315 value: true 7316 }); 7317 } else { 7318 delete window.default; 7319 } 7320 }); 7321})(ScrollTrigger, ScrollTrigger.exports); 7322var ScrollTriggerExports = ScrollTrigger.exports; 7323 7324var ScrollSmoother = {exports: {}}; 7325 7326(function (module, exports) { 7327 (function (global, factory) { 7328 factory(exports) ; 7329 })(commonjsGlobal, function (exports) { 7330 7331 function _defineProperties(target, props) { 7332 for (var i = 0; i < props.length; i++) { 7333 var descriptor = props[i]; 7334 descriptor.enumerable = descriptor.enumerable || false; 7335 descriptor.configurable = true; 7336 if ("value" in descriptor) descriptor.writable = true; 7337 Object.defineProperty(target, descriptor.key, descriptor); 7338 } 7339 } 7340 function _createClass(Constructor, protoProps, staticProps) { 7341 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 7342 if (staticProps) _defineProperties(Constructor, staticProps); 7343 return Constructor; 7344 } 7345 7346 /*! 7347 * ScrollSmoother 3.11.5 7348 * https://greensock.com 7349 * 7350 * @license Copyright 2008-2023, GreenSock. All rights reserved. 7351 * Subject to the terms at https://greensock.com/standard-license or for 7352 * Club GreenSock members, the agreement issued with that membership. 7353 * @author: Jack Doyle, [email protected] 7354 */ 7355 var gsap, 7356 _coreInitted, 7357 _win, 7358 _doc, 7359 _docEl, 7360 _body, 7361 _toArray, 7362 _clamp, 7363 ScrollTrigger, 7364 _mainInstance, 7365 _expo, 7366 _getVelocityProp, 7367 _inputObserver, 7368 _context, 7369 _onResizeDelayedCall, 7370 _windowExists = function _windowExists() { 7371 return typeof window !== "undefined"; 7372 }, 7373 _getGSAP = function _getGSAP() { 7374 return gsap || _windowExists() && (gsap = window.gsap) && gsap.registerPlugin && gsap; 7375 }, 7376 _round = function _round(value) { 7377 return Math.round(value * 100000) / 100000 || 0; 7378 }, 7379 _autoDistance = function _autoDistance(el, progress) { 7380 var parent = el.parentNode || _docEl, 7381 b1 = el.getBoundingClientRect(), 7382 b2 = parent.getBoundingClientRect(), 7383 gapTop = b2.top - b1.top, 7384 gapBottom = b2.bottom - b1.bottom, 7385 change = (Math.abs(gapTop) > Math.abs(gapBottom) ? gapTop : gapBottom) / (1 - progress), 7386 offset = -change * progress, 7387 ratio, 7388 extraChange; 7389 if (change > 0) { 7390 ratio = b2.height / (_win.innerHeight + b2.height); 7391 extraChange = ratio === 0.5 ? b2.height * 2 : Math.min(b2.height, -change * ratio / (2 * ratio - 1)) * 2 * (progress || 1); 7392 offset += progress ? -extraChange * progress : -extraChange / 2;
vendor: 2,298 bytes, lines 7393-7458
7393 change += extraChange; 7394 } 7395 return { 7396 change: change, 7397 offset: offset 7398 }; 7399 }, 7400 _wrap = function _wrap(el) { 7401 var wrapper = _doc.querySelector(".ScrollSmoother-wrapper"); 7402 if (!wrapper) { 7403 wrapper = _doc.createElement("div"); 7404 wrapper.classList.add("ScrollSmoother-wrapper"); 7405 el.parentNode.insertBefore(wrapper, el); 7406 wrapper.appendChild(el); 7407 } 7408 return wrapper; 7409 }; 7410 var ScrollSmoother = function () { 7411 function ScrollSmoother(vars) { 7412 var _this = this; 7413 _coreInitted || ScrollSmoother.register(gsap) || console.warn("Please gsap.registerPlugin(ScrollSmoother)"); 7414 vars = this.vars = vars || {}; 7415 _mainInstance && _mainInstance.kill(); 7416 _mainInstance = this; 7417 _context(this); 7418 var _vars = vars, 7419 smoothTouch = _vars.smoothTouch, 7420 _onUpdate = _vars.onUpdate, 7421 onStop = _vars.onStop, 7422 smooth = _vars.smooth, 7423 onFocusIn = _vars.onFocusIn, 7424 normalizeScroll = _vars.normalizeScroll, 7425 wholePixels = _vars.wholePixels, 7426 content, 7427 wrapper, 7428 height, 7429 mainST, 7430 effects, 7431 sections, 7432 intervalID, 7433 wrapperCSS, 7434 contentCSS, 7435 paused, 7436 pausedNormalizer, 7437 recordedRefreshScroll, 7438 recordedRefreshScrub, 7439 self = this, 7440 effectsPrefix = vars.effectsPrefix || "", 7441 scrollFunc = ScrollTrigger.getScrollFunc(_win), 7442 smoothDuration = ScrollTrigger.isTouch === 1 ? smoothTouch === true ? 0.8 : parseFloat(smoothTouch) || 0 : smooth === 0 || smooth === false ? 0 : parseFloat(smooth) || 0.8, 7443 speed = smoothDuration && +vars.speed || 1, 7444 currentY = 0, 7445 delta = 0, 7446 startupPhase = 1, 7447 tracker = _getVelocityProp(0), 7448 updateVelocity = function updateVelocity() { 7449 return tracker.update(-currentY); 7450 }, 7451 scroll = { 7452 y: 0 7453 }, 7454 removeScroll = function removeScroll() { 7455 return content.style.overflow = "visible"; 7456 }, 7457 isProxyScrolling, 7458 killScrub = function killScrub(trigger) {
7459 trigger.update(); 7460 var scrub = trigger.getTween(); 7461 if (scrub) { 7462 scrub.pause(); 7463 scrub._time = scrub._dur; 7464 scrub._tTime = scrub._tDur; 7465 } 7466 isProxyScrolling = false; 7467 trigger.animation.progress(trigger.progress, true); 7468 }, 7469 render = function render(y, force) { 7470 if (y !== currentY && !paused || force) { 7471 wholePixels && (y = Math.round(y)); 7472 if (smoothDuration) { 7473 content.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + y + ", 0, 1)"; 7474 content._gsap.y = y + "px"; 7475 } 7476 delta = y - currentY; 7477 currentY = y; 7478 ScrollTrigger.isUpdating || ScrollSmoother.isRefreshing || ScrollTrigger.update(); 7479 } 7480 }, 7481 scrollTop = function scrollTop(value) { 7482 if (arguments.length) { 7483 value < 0 && (value = 0); 7484 scroll.y = -value; 7485 isProxyScrolling = true; 7486 paused ? currentY = -value : render(-value); 7487 ScrollTrigger.isRefreshing ? mainST.update() : scrollFunc(value / speed); 7488 return this; 7489 } 7490 return -currentY; 7491 }, 7492 resizeObserver = typeof ResizeObserver !== "undefined" && vars.autoResize !== false && new ResizeObserver(function () { 7493 if (!ScrollTrigger.isRefreshing) { 7494 var max = ScrollTrigger.maxScroll(wrapper); 7495 max < -currentY && scrollTop(max); 7496 _onResizeDelayedCall.restart(true); 7497 } 7498 }), 7499 lastFocusElement, 7500 _onFocusIn = function _onFocusIn(e) { 7501 wrapper.scrollTop = 0; 7502 if (e.target.contains && e.target.contains(wrapper) || onFocusIn && onFocusIn(_this, e) === false) { 7503 return; 7504 } 7505 ScrollTrigger.isInViewport(e.target) || e.target === lastFocusElement || _this.scrollTo(e.target, false, "center center"); 7506 lastFocusElement = e.target; 7507 }, 7508 adjustParallaxPosition = function adjustParallaxPosition(triggers, createdAfterEffectWasApplied) { 7509 var pins, start, dif, markers; 7510 effects.forEach(function (st) { 7511 pins = st.pins; 7512 markers = st.markers; 7513 triggers.forEach(function (trig) { 7514 if (st.trigger && trig.trigger && st !== trig && (trig.trigger === st.trigger || trig.pinnedContainer === st.trigger || st.trigger.contains(trig.trigger))) { 7515 start = trig.start; 7516 dif = (start - st.start - st.offset) / st.ratio - (start - st.start); 7517 pins.forEach(function (p) { 7518 return dif -= p.distance / st.ratio - p.distance; 7519 }); 7520 trig.setPositions(start + dif, trig.end + dif); 7521 trig.markerStart && markers.push(gsap.quickSetter([trig.markerStart, trig.markerEnd], "y", "px")); 7522 if (trig.pin && trig.end > 0) { 7523 dif = trig.end - trig.start; 7524 pins.push({ 7525 start: trig.start, 7526 end: trig.end, 7527 distance: dif, 7528 trig: trig 7529 }); 7530 st.setPositions(st.start, st.end + dif); 7531 st.vars.onRefresh(st); 7532 } 7533 } 7534 }); 7535 }); 7536 }, 7537 onRefresh = function onRefresh() { 7538 removeScroll(); 7539 requestAnimationFrame(removeScroll); 7540 if (effects) { 7541 effects.forEach(function (st) { 7542 var start = st.start, 7543 end = st.auto ? Math.min(ScrollTrigger.maxScroll(st.scroller), st.end) : start + (st.end - start) / st.ratio, 7544 offset = (end - st.end) / 2; 7545 start -= offset; 7546 end -= offset; 7547 st.offset = offset || 0.0001; 7548 st.pins.length = 0; 7549 st.setPositions(Math.min(start, end), Math.max(start, end)); 7550 st.vars.onRefresh(st); 7551 }); 7552 adjustParallaxPosition(ScrollTrigger.sort()); 7553 } 7554 tracker.reset(); 7555 }, 7556 addOnRefresh = function addOnRefresh() { 7557 return ScrollTrigger.addEventListener("refresh", onRefresh); 7558 }, 7559 restoreEffects = function restoreEffects() {
7560 return effects && effects.forEach(function (st) { 7561 return st.vars.onRefresh(st); 7562 }); 7563 }, 7564 revertEffects = function revertEffects() { 7565 effects && effects.forEach(function (st) { 7566 return st.vars.onRefreshInit(st); 7567 }); 7568 return restoreEffects; 7569 }, 7570 effectValueGetter = function effectValueGetter(name, value, index, el) { 7571 return function () { 7572 var v = typeof value === "function" ? value(index, el) : value; 7573 v || v === 0 || (v = el.getAttribute("data-" + effectsPrefix + name) || (name === "speed" ? 1 : 0)); 7574 el.setAttribute("data-" + effectsPrefix + name, v); 7575 return v === "auto" ? v : parseFloat(v); 7576 }; 7577 }, 7578 createEffect = function createEffect(el, speed, lag, index, effectsPadding) { 7579 effectsPadding = (typeof effectsPadding === "function" ? effectsPadding(index, el) : effectsPadding) || 0; 7580 var getSpeed = effectValueGetter("speed", speed, index, el), 7581 getLag = effectValueGetter("lag", lag, index, el), 7582 startY = gsap.getProperty(el, "y"), 7583 cache = el._gsap, 7584 ratio, 7585 st, 7586 autoSpeed, 7587 scrub, 7588 progressOffset, 7589 yOffset, 7590 initDynamicValues = function initDynamicValues() { 7591 speed = getSpeed(); 7592 lag = getLag(); 7593 ratio = parseFloat(speed) || 1; 7594 autoSpeed = speed === "auto"; 7595 progressOffset = autoSpeed ? 0 : 0.5; 7596 scrub && scrub.kill(); 7597 scrub = lag && gsap.to(el, { 7598 ease: _expo, 7599 overwrite: false, 7600 y: "+=0", 7601 duration: lag 7602 }); 7603 if (st) { 7604 st.ratio = ratio; 7605 st.autoSpeed = autoSpeed; 7606 } 7607 }, 7608 revert = function revert() { 7609 cache.y = startY + "px"; 7610 cache.renderTransform(1); 7611 initDynamicValues(); 7612 }, 7613 pins = [], 7614 markers = [], 7615 change = 0, 7616 updateChange = function updateChange(self) { 7617 if (autoSpeed) { 7618 revert(); 7619 var auto = _autoDistance(el, _clamp(0, 1, -self.start / (self.end - self.start))); 7620 change = auto.change; 7621 yOffset = auto.offset; 7622 } else { 7623 change = (self.end - self.start) * (1 - ratio); 7624 yOffset = 0; 7625 } 7626 pins.forEach(function (p) { 7627 return change -= p.distance * (1 - ratio); 7628 }); 7629 self.vars.onUpdate(self); 7630 scrub && scrub.progress(1); 7631 }; 7632 initDynamicValues(); 7633 if (ratio !== 1 || autoSpeed || scrub) { 7634 st = ScrollTrigger.create({ 7635 trigger: autoSpeed ? el.parentNode : el, 7636 start: "top bottom+=" + effectsPadding, 7637 end: "bottom top-=" + effectsPadding, 7638 scroller: wrapper, 7639 scrub: true, 7640 refreshPriority: -999, 7641 onRefreshInit: revert, 7642 onRefresh: updateChange, 7643 onKill: function onKill(self) { 7644 var i = effects.indexOf(self); 7645 i >= 0 && effects.splice(i, 1); 7646 revert(); 7647 }, 7648 onUpdate: function onUpdate(self) { 7649 var y = startY + change * (self.progress - progressOffset), 7650 i = pins.length, 7651 extraY = 0, 7652 pin, 7653 scrollY, 7654 end; 7655 if (self.offset) { 7656 if (i) { 7657 scrollY = -currentY; 7658 end = self.end; 7659 while (i--) { 7660 pin = pins[i]; 7661 if (pin.trig.isActive || scrollY >= pin.start && scrollY <= pin.end) { 7662 if (scrub) { 7663 pin.trig.progress += pin.trig.direction < 0 ? 0.001 : -0.001; 7664 pin.trig.update(0, 0, 1); 7665 scrub.resetTo("y", parseFloat(cache.y), -delta, true); 7666 startupPhase && scrub.progress(1); 7667 } 7668 return; 7669 } 7670 scrollY > pin.end && (extraY += pin.distance); 7671 end -= pin.distance; 7672 } 7673 y = startY + extraY + change * ((gsap.utils.clamp(self.start, self.end, scrollY) - self.start - extraY) / (end - self.start) - progressOffset); 7674 } 7675 y = _round(y + yOffset); 7676 markers.length && !autoSpeed && markers.forEac
vendor: 4,152 bytes, lines 7676-7791
7676h(function (setter) { 7677 return setter(y - extraY); 7678 }); 7679 if (scrub) { 7680 scrub.resetTo("y", y, -delta, true); 7681 startupPhase && scrub.progress(1); 7682 } else { 7683 cache.y = y + "px"; 7684 cache.renderTransform(1); 7685 } 7686 } 7687 } 7688 }); 7689 updateChange(st); 7690 gsap.core.getCache(st.trigger).stRevert = revertEffects; 7691 st.startY = startY; 7692 st.pins = pins; 7693 st.markers = markers; 7694 st.ratio = ratio; 7695 st.autoSpeed = autoSpeed; 7696 el.style.willChange = "transform"; 7697 } 7698 return st; 7699 }; 7700 addOnRefresh(); 7701 ScrollTrigger.addEventListener("killAll", addOnRefresh); 7702 gsap.delayedCall(0.5, function () { 7703 return startupPhase = 0; 7704 }); 7705 this.scrollTop = scrollTop; 7706 this.scrollTo = function (target, smooth, position) { 7707 var p = gsap.utils.clamp(0, ScrollTrigger.maxScroll(_win), isNaN(target) ? _this.offset(target, position) : +target); 7708 !smooth ? scrollTop(p) : paused ? gsap.to(_this, { 7709 duration: smoothDuration, 7710 scrollTop: p, 7711 overwrite: "auto", 7712 ease: _expo 7713 }) : scrollFunc(p); 7714 }; 7715 this.offset = function (target, position) { 7716 target = _toArray(target)[0]; 7717 var cssText = target.style.cssText, 7718 st = ScrollTrigger.create({ 7719 trigger: target, 7720 start: position || "top top" 7721 }), 7722 y; 7723 effects && adjustParallaxPosition([st]); 7724 y = st.start / speed; 7725 st.kill(false); 7726 target.style.cssText = cssText; 7727 gsap.core.getCache(target).uncache = 1; 7728 return y; 7729 }; 7730 function refreshHeight() { 7731 height = content.clientHeight; 7732 content.style.overflow = "visible"; 7733 _body.style.height = _win.innerHeight + (height - _win.innerHeight) / speed + "px"; 7734 return height - _win.innerHeight; 7735 } 7736 this.content = function (element) { 7737 if (arguments.length) { 7738 var newContent = _toArray(element || "#smooth-content")[0] || console.warn("ScrollSmoother needs a valid content element.") || _body.children[0]; 7739 if (newContent !== content) { 7740 content = newContent; 7741 contentCSS = content.getAttribute("style") || ""; 7742 resizeObserver && resizeObserver.observe(content); 7743 gsap.set(content, { 7744 overflow: "visible", 7745 width: "100%", 7746 boxSizing: "border-box", 7747 y: "+=0" 7748 }); 7749 smoothDuration || gsap.set(content, { 7750 clearProps: "transform" 7751 }); 7752 } 7753 return this; 7754 } 7755 return content; 7756 }; 7757 this.wrapper = function (element) { 7758 if (arguments.length) { 7759 wrapper = _toArray(element || "#smooth-wrapper")[0] || _wrap(content); 7760 wrapperCSS = wrapper.getAttribute("style") || ""; 7761 refreshHeight(); 7762 gsap.set(wrapper, smoothDuration ? { 7763 overflow: "hidden", 7764 position: "fixed", 7765 height: "100%", 7766 width: "100%", 7767 top: 0, 7768 left: 0, 7769 right: 0, 7770 bottom: 0 7771 } : { 7772 overflow: "visible", 7773 position: "relative", 7774 width: "100%", 7775 height: "auto", 7776 top: "auto", 7777 bottom: "auto", 7778 left: "auto", 7779 right: "auto" 7780 }); 7781 return this; 7782 } 7783 return wrapper; 7784 }; 7785 this.effects = function (targets, config) { 7786 var _effects; 7787 effects || (effects = []); 7788 if (!targets) { 7789 return effects.slice(0); 7790 } 7791 targets = _toArray(targets);
vendor: 5,098 bytes, lines 7792-7927
7792 targets.forEach(function (target) { 7793 var i = effects.length; 7794 while (i--) { 7795 effects[i].trigger === target && effects[i].kill(); 7796 } 7797 }); 7798 config = config || {}; 7799 var _config = config, 7800 speed = _config.speed, 7801 lag = _config.lag, 7802 effectsPadding = _config.effectsPadding, 7803 effectsToAdd = [], 7804 i, 7805 st; 7806 for (i = 0; i < targets.length; i++) { 7807 st = createEffect(targets[i], speed, lag, i, effectsPadding); 7808 st && effectsToAdd.push(st); 7809 } 7810 (_effects = effects).push.apply(_effects, effectsToAdd); 7811 return effectsToAdd; 7812 }; 7813 this.sections = function (targets, config) { 7814 var _sections; 7815 sections || (sections = []); 7816 if (!targets) { 7817 return sections.slice(0); 7818 } 7819 var newSections = _toArray(targets).map(function (el) { 7820 return ScrollTrigger.create({ 7821 trigger: el, 7822 start: "top 120%", 7823 end: "bottom -20%", 7824 onToggle: function onToggle(self) { 7825 el.style.opacity = self.isActive ? "1" : "0"; 7826 el.style.pointerEvents = self.isActive ? "all" : "none"; 7827 } 7828 }); 7829 }); 7830 config && config.add ? (_sections = sections).push.apply(_sections, newSections) : sections = newSections.slice(0); 7831 return newSections; 7832 }; 7833 this.content(vars.content); 7834 this.wrapper(vars.wrapper); 7835 this.render = function (y) { 7836 return render(y || y === 0 ? y : currentY); 7837 }; 7838 this.getVelocity = function () { 7839 return tracker.getVelocity(-currentY); 7840 }; 7841 ScrollTrigger.scrollerProxy(wrapper, { 7842 scrollTop: scrollTop, 7843 scrollHeight: function scrollHeight() { 7844 return refreshHeight() && _body.scrollHeight; 7845 }, 7846 fixedMarkers: vars.fixedMarkers !== false && !!smoothDuration, 7847 content: content, 7848 getBoundingClientRect: function getBoundingClientRect() { 7849 return { 7850 top: 0, 7851 left: 0, 7852 width: _win.innerWidth, 7853 height: _win.innerHeight 7854 }; 7855 } 7856 }); 7857 ScrollTrigger.defaults({ 7858 scroller: wrapper 7859 }); 7860 var existingScrollTriggers = ScrollTrigger.getAll().filter(function (st) { 7861 return st.scroller === _win || st.scroller === wrapper; 7862 }); 7863 existingScrollTriggers.forEach(function (st) { 7864 return st.revert(true, true); 7865 }); 7866 mainST = ScrollTrigger.create({ 7867 animation: gsap.fromTo(scroll, { 7868 y: 0 7869 }, { 7870 y: function y() { 7871 return -refreshHeight(); 7872 }, 7873 immediateRender: false, 7874 ease: "none", 7875 data: "ScrollSmoother", 7876 duration: 100, 7877 onUpdate: function onUpdate() { 7878 if (this._dur) { 7879 var force = isProxyScrolling; 7880 if (force) { 7881 killScrub(mainST); 7882 scroll.y = currentY; 7883 } 7884 render(scroll.y, force); 7885 updateVelocity(); 7886 _onUpdate && !paused && _onUpdate(self); 7887 } 7888 } 7889 }), 7890 onRefreshInit: function onRefreshInit(self) { 7891 ScrollSmoother.isRefreshing = true; 7892 if (effects) { 7893 var pins = ScrollTrigger.getAll().filter(function (st) { 7894 return !!st.pin; 7895 }); 7896 effects.forEach(function (st) { 7897 if (!st.vars.pinnedContainer) { 7898 pins.forEach(function (pinST) { 7899 if (pinST.pin.contains(st.trigger)) { 7900 var v = st.vars; 7901 v.pinnedContainer = pinST.pin; 7902 st.vars = null; 7903 st.init(v, st.animation); 7904 } 7905 }); 7906 } 7907 }); 7908 } 7909 var scrub = self.getTween(); 7910 recordedRefreshScrub = scrub && scrub._end > scrub._dp._time; 7911 recordedRefreshScroll = currentY; 7912 scroll.y = 0; 7913 if (smoothDuration) { 7914 ScrollTrigger.isTouch === 1 && (wrapper.style.position = "absolute"); 7915 wrapper.scrollTop = 0; 7916 ScrollTrigger.isTouch === 1 && (wrapper.style.position = "fixed"); 7917 } 7918 }, 7919 onRefresh: function onRefresh(self) { 7920 self.animation.invalidate(); 7921 self.setPositions(self.start, refreshHeight() / speed); 7922 recordedRefreshScrub || killScrub(self); 7923 scroll.y = -scrollFunc() * speed; 7924 render(scroll.y); 7925 startupPhase || self.animation.progress(gsap.utils.clamp(0, 1, recordedRefreshScroll / speed / -self.end)); 7926 if (recordedRefreshScrub) { 7927 self.progress -= 0.001;
vendor: 7,223 bytes, lines 7928-8111
7928 self.update(); 7929 } 7930 ScrollSmoother.isRefreshing = false; 7931 }, 7932 id: "ScrollSmoother", 7933 scroller: _win, 7934 invalidateOnRefresh: true, 7935 start: 0, 7936 refreshPriority: -9999, 7937 end: function end() { 7938 return refreshHeight() / speed; 7939 }, 7940 onScrubComplete: function onScrubComplete() { 7941 tracker.reset(); 7942 onStop && onStop(_this); 7943 }, 7944 scrub: smoothDuration || true 7945 }); 7946 this.smooth = function (value) { 7947 if (arguments.length) { 7948 smoothDuration = value || 0; 7949 speed = smoothDuration && +vars.speed || 1; 7950 mainST.scrubDuration(value); 7951 } 7952 return mainST.getTween() ? mainST.getTween().duration() : 0; 7953 }; 7954 mainST.getTween() && (mainST.getTween().vars.ease = vars.ease || _expo); 7955 this.scrollTrigger = mainST; 7956 vars.effects && this.effects(vars.effects === true ? "[data-" + effectsPrefix + "speed], [data-" + effectsPrefix + "lag]" : vars.effects, { 7957 effectsPadding: vars.effectsPadding 7958 }); 7959 vars.sections && this.sections(vars.sections === true ? "[data-section]" : vars.sections); 7960 existingScrollTriggers.forEach(function (st) { 7961 st.vars.scroller = wrapper; 7962 st.revert(false, true); 7963 st.init(st.vars, st.animation); 7964 }); 7965 this.paused = function (value, allowNestedScroll) { 7966 if (arguments.length) { 7967 if (!!paused !== value) { 7968 if (value) { 7969 mainST.getTween() && mainST.getTween().pause(); 7970 scrollFunc(-currentY / speed); 7971 tracker.reset(); 7972 pausedNormalizer = ScrollTrigger.normalizeScroll(); 7973 pausedNormalizer && pausedNormalizer.disable(); 7974 paused = ScrollTrigger.observe({ 7975 preventDefault: true, 7976 type: "wheel,touch,scroll", 7977 debounce: false, 7978 allowClicks: true, 7979 onChangeY: function onChangeY() { 7980 return scrollTop(-currentY); 7981 } 7982 }); 7983 paused.nested = _inputObserver(_docEl, "wheel,touch,scroll", true, allowNestedScroll !== false); 7984 } else { 7985 paused.nested.kill(); 7986 paused.kill(); 7987 paused = 0; 7988 pausedNormalizer && pausedNormalizer.enable(); 7989 mainST.progress = (-currentY / speed - mainST.start) / (mainST.end - mainST.start); 7990 killScrub(mainST); 7991 } 7992 } 7993 return this; 7994 } 7995 return !!paused; 7996 }; 7997 this.kill = this.revert = function () { 7998 _this.paused(false); 7999 killScrub(mainST); 8000 mainST.kill(); 8001 var triggers = (effects || []).concat(sections || []), 8002 i = triggers.length; 8003 while (i--) { 8004 triggers[i].kill(); 8005 } 8006 ScrollTrigger.scrollerProxy(wrapper); 8007 ScrollTrigger.removeEventListener("killAll", addOnRefresh); 8008 ScrollTrigger.removeEventListener("refresh", onRefresh); 8009 wrapper.style.cssText = wrapperCSS; 8010 content.style.cssText = contentCSS; 8011 var defaults = ScrollTrigger.defaults({}); 8012 defaults && defaults.scroller === wrapper && ScrollTrigger.defaults({ 8013 scroller: _win 8014 }); 8015 _this.normalizer && ScrollTrigger.normalizeScroll(false); 8016 clearInterval(intervalID); 8017 _mainInstance = null; 8018 resizeObserver && resizeObserver.disconnect(); 8019 _body.style.removeProperty("height"); 8020 _win.removeEventListener("focusin", _onFocusIn); 8021 }; 8022 this.refresh = function (soft, force) { 8023 return mainST.refresh(soft, force); 8024 }; 8025 if (normalizeScroll) { 8026 this.normalizer = ScrollTrigger.normalizeScroll(normalizeScroll === true ? { 8027 debounce: true, 8028 content: !smoothDuration && content 8029 } : normalizeScroll); 8030 } 8031 ScrollTrigger.config(vars); 8032 "overscrollBehavior" in _win.getComputedStyle(_body) && gsap.set([_body, _docEl], { 8033 overscrollBehavior: "none" 8034 }); 8035 "scrollBehavior" in _win.getComputedStyle(_body) && gsap.set([_body, _docEl], { 8036 scrollBehavior: "auto" 8037 }); 8038 _win.addEventListener("focusin", _onFocusIn); 8039 intervalID = setInterval(updateVelocity, 250); 8040 _doc.readyState === "loading" || requestAnimationFrame(function () { 8041 return ScrollTrigger.refresh(); 8042 }); 8043 } 8044 ScrollSmoother.register = function register(core) { 8045 if (!_coreInitted) { 8046 gsap = core || _getGSAP(); 8047 if (_windowExists() && window.document) { 8048 _win = window; 8049 _doc = document; 8050 _docEl = _doc.documentElement; 8051 _body = _doc.body; 8052 } 8053 if (gsap) { 8054 _toArray = gsap.utils.toArray; 8055 _clamp = gsap.utils.clamp; 8056 _expo = gsap.parseEase("expo"); 8057 _context = gsap.core.context || function () {}; 8058 _onResizeDelayedCall = gsap.delayedCall(0.2, function () { 8059 return ScrollTrigger.isRefreshing || _mainInstance && _mainInstance.refresh(); 8060 }).pause(); 8061 ScrollTrigger = gsap.core.globals().ScrollTrigger; 8062 gsap.core.globals("ScrollSmoother", ScrollSmoother); 8063 if (_body && ScrollTrigger) { 8064 _getVelocityProp = ScrollTrigger.core._getVelocityProp; 8065 _inputObserver = ScrollTrigger.core._inputObserver; 8066 ScrollSmoother.refresh = ScrollTrigger.refresh; 8067 _coreInitted = 1; 8068 } 8069 } 8070 } 8071 return _coreInitted; 8072 }; 8073 _createClass(ScrollSmoother, [{ 8074 key: "progress", 8075 get: function get() { 8076 return this.scrollTrigger ? this.scrollTrigger.animation._time / 100 : 0; 8077 } 8078 }]); 8079 return ScrollSmoother; 8080 }(); 8081 ScrollSmoother.version = "3.11.5"; 8082 ScrollSmoother.create = function (vars) { 8083 return _mainInstance && vars && _mainInstance.content() === _toArray(vars.content)[0] ? _mainInstance : new ScrollSmoother(vars); 8084 }; 8085 ScrollSmoother.get = function () { 8086 return _mainInstance; 8087 }; 8088 _getGSAP() && gsap.registerPlugin(ScrollSmoother); 8089 exports.ScrollSmoother = ScrollSmoother; 8090 exports.default = ScrollSmoother; 8091 if (typeof window === 'undefined' || window !== exports) { 8092 Object.defineProperty(exports, '__esModule', { 8093 value: true 8094 }); 8095 } else { 8096 delete window.default; 8097 } 8098 }); 8099})(ScrollSmoother, ScrollSmoother.exports); 8100var ScrollSmootherExports = ScrollSmoother.exports; 8101 8102var ScrollToPlugin = {exports: {}}; 8103 8104/*! 8105 * ScrollToPlugin 3.11.5 8106 * https://greensock.com 8107 * 8108 * @license Copyright 2023, GreenSock. All rights reserved. 8109 * Subject to the terms at https://greensock.com/standard-license or for Club GreenSock members, the agreement issued with that membership. 8110 * @author: Jack Doyle, [email protected] 8111 */
vendor: 4,271 bytes, lines 8112-8206
8112(function (module, exports) { 8113 !function (e, t) { 8114 t(exports) ; 8115 }(commonjsGlobal, function (e) { 8116 8117 function l() { 8118 return "undefined" != typeof window; 8119 } 8120 function m() { 8121 return f || l() && (f = window.gsap) && f.registerPlugin && f; 8122 } 8123 function n(e) { 8124 return "string" == typeof e; 8125 } 8126 function o(e) { 8127 return "function" == typeof e; 8128 } 8129 function p(e, t) { 8130 var o = "x" === t ? "Width" : "Height", 8131 n = "scroll" + o, 8132 l = "client" + o; 8133 return e === T || e === i || e === c ? Math.max(i[n], c[n]) - (T["inner" + o] || i[l] || c[l]) : e[n] - e["offset" + o]; 8134 } 8135 function q(e, t) { 8136 var o = "scroll" + ("x" === t ? "Left" : "Top"); 8137 return e === T && (null != e.pageXOffset ? o = "page" + t.toUpperCase() + "Offset" : e = null != i[o] ? i : c), function () { 8138 return e[o]; 8139 }; 8140 } 8141 function s(e, t) { 8142 if (!(e = y(e)[0]) || !e.getBoundingClientRect) return console.warn("scrollTo target doesn't exist. Using 0") || { 8143 x: 0, 8144 y: 0 8145 }; 8146 var o = e.getBoundingClientRect(), 8147 n = !t || t === T || t === c, 8148 l = n ? { 8149 top: i.clientTop - (T.pageYOffset || i.scrollTop || c.scrollTop || 0), 8150 left: i.clientLeft - (T.pageXOffset || i.scrollLeft || c.scrollLeft || 0) 8151 } : t.getBoundingClientRect(), 8152 r = { 8153 x: o.left - l.left, 8154 y: o.top - l.top 8155 }; 8156 return !n && t && (r.x += q(t, "x")(), r.y += q(t, "y")()), r; 8157 } 8158 function t(e, t, o, l, r) { 8159 return isNaN(e) || "object" == typeof e ? n(e) && "=" === e.charAt(1) ? parseFloat(e.substr(2)) * ("-" === e.charAt(0) ? -1 : 1) + l - r : "max" === e ? p(t, o) - r : Math.min(p(t, o), s(e, t)[o] - r) : parseFloat(e) - r; 8160 } 8161 function u() { 8162 f = m(), l() && f && "undefined" != typeof document && document.body && (T = window, c = document.body, i = document.documentElement, y = f.utils.toArray, f.config({ 8163 autoKillThreshold: 7 8164 }), v = f.config(), a = 1); 8165 } 8166 var f, 8167 a, 8168 T, 8169 i, 8170 c, 8171 y, 8172 v, 8173 h, 8174 r = { 8175 version: "3.11.5", 8176 name: "scrollTo", 8177 rawVars: 1, 8178 register: function register(e) { 8179 f = e, u(); 8180 }, 8181 init: function init(e, l, r, s, i) { 8182 a || u(); 8183 var p = this, 8184 c = f.getProperty(e, "scrollSnapType"); 8185 p.isWin = e === T, p.target = e, p.tween = r, l = function _clean(e, t, l, r) { 8186 if (o(e) && (e = e(t, l, r)), "object" != typeof e) return n(e) && "max" !== e && "=" !== e.charAt(1) ? { 8187 x: e, 8188 y: e 8189 } : { 8190 y: e 8191 }; 8192 if (e.nodeType) return { 8193 y: e, 8194 x: e 8195 }; 8196 var s, 8197 i = {}; 8198 for (s in e) i[s] = "onAutoKill" !== s && o(e[s]) ? e[s](t, l, r) : e[s]; 8199 return i; 8200 }(l, s, e, i), p.vars = l, p.autoKill = !!l.autoKill, p.getX = q(e, "x"), p.getY = q(e, "y"), p.x = p.xPrev = p.getX(), p.y = p.yPrev = p.getY(), h = h || f.core.globals().ScrollTrigger, "smooth" === f.getProperty(e, "scrollBehavior") && f.set(e, { 8201 scrollBehavior: "auto" 8202 }), c && "none" !== c && (p.snap = 1, p.snapInline = e.style.scrollSnapType, e.style.scrollSnapType = "none"), null != l.x ? (p.add(p, "x", p.x, t(l.x, e, "x", p.x, l.offsetX || 0), s, i), p._props.push("scrollTo_x")) : p.skipX = 1, null != l.y ? (p.add(p, "y", p.y, t(l.y, e, "y", p.y, l.offsetY || 0), s, i), p._props.push("scrollTo_y")) : p.skipY = 1; 8203 }, 8204 render: function render(e, t) { 8205 for (var o, n, l, r, s, i = t._pt, c = t.target, u = t.tween, f = t.autoKill, a = t.xPrev, y = t.yPrev, d = t.isWin, g = t.snap, x = t.snapInline; i;) i.r(e, i.d), i = i._next; 8206 o = d || !t.skipX ? t.getX() : a, l = (n = d || !t.skipY ? t.getY() : y) - y, r = o - a, s = v.autoKillThreshold, t.x < 0 && (t.x = 0), t.y < 0 && (t.y = 0), f && (!t.skipX && (s < r || r < -s) && o < p(c, "x") && (t.skipX = 1), !t.skipY && (s < l || l < -s) && n < p(c, "y") && (t.skipY = 1), t.skipX && t.skipY && (u.kill(), t.vars.onAutoKill && t.vars.onAutoKill.apply(u, t.vars.onAutoKillParam
8206s || []))), d ? T.scrollTo(t.skipX ? o : t.x, t.skipY ? n : t.y) : (t.skipY || (c.scrollTop = t.y), t.skipX || (c.scrollLeft = t.x)), !g || 1 !== e && 0 !== e || (n = c.scrollTop, o = c.scrollLeft, x ? c.style.scrollSnapType = x : c.style.removeProperty("scroll-snap-type"), c.scrollTop = n + 1, c.scrollLeft = o + 1, c.scrollTop = n, c.scrollLeft = o), t.xPrev = t.x, t.yPrev = t.y, h && h.update(); 8207 }, 8208 kill: function kill(e) { 8209 var t = "scrollTo" === e; 8210 !t && "scrollTo_x" !== e || (this.skipX = 1), !t && "scrollTo_y" !== e || (this.skipY = 1); 8211 } 8212 }; 8213 r.max = p, r.getOffset = s, r.buildGetter = q, m() && f.registerPlugin(r), e.ScrollToPlugin = r, e.default = r; 8214 if (typeof window === "undefined" || window !== e) { 8215 Object.defineProperty(e, "__esModule", { 8216 value: !0 8217 }); 8218 } else { 8219 delete e.default; 8220 } 8221 }); 8222})(ScrollToPlugin, ScrollToPlugin.exports); 8223var ScrollToPluginExports = ScrollToPlugin.exports; 8224 8225var MorphSVGPlugin = {exports: {}}; 8226 8227(function (module, exports) { 8228 (function (global, factory) { 8229 factory(exports) ; 8230 })(commonjsGlobal, function (exports) { 8231 8232 var _svgPathExp = /[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, 8233 _numbersExp = /(?:(-)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig, 8234 _scientific = /[\+\-]?\d*\.?\d+e[\+\-]?\d+/ig, 8235 _selectorExp = /(^[#\.][a-z]|[a-y][a-z])/i, 8236 _DEG2RAD = Math.PI / 180, 8237 _sin = Math.sin, 8238 _cos = Math.cos, 8239 _abs = Math.abs, 8240 _sqrt = Math.sqrt, 8241 _isString = function _isString(value) { 8242 return typeof value === "string"; 8243 }, 8244 _isNumber = function _isNumber(value) { 8245 return typeof value === "number"; 8246 }, 8247 _roundingNum = 1e5, 8248 _round = function _round(value) { 8249 return Math.round(value * _roundingNum) / _roundingNum || 0; 8250 }; 8251 function getRawPath(value) { 8252 value = _isString(value) && _selectorExp.test(value) ? document.querySelector(value) || value : value; 8253 var e = value.getAttribute ? value : 0, 8254 rawPath; 8255 if (e && (value = value.getAttribute("d"))) { 8256 if (!e._gsPath) { 8257 e._gsPath = {}; 8258 } 8259 rawPath = e._gsPath[value]; 8260 return rawPath && !rawPath._dirty ? rawPath : e._gsPath[value] = stringToRawPath(value); 8261 } 8262 return !value ? console.warn("Expecting a <path> element or an SVG path data string") : _isString(value) ? stringToRawPath(value) : _isNumber(value[0]) ? [value] : value; 8263 } 8264 function reverseSegment(segment) { 8265 var i = 0, 8266 y; 8267 segment.reverse(); 8268 for (; i < segment.length; i += 2) { 8269 y = segment[i]; 8270 segment[i] = segment[i + 1]; 8271 segment[i + 1] = y; 8272 } 8273 segment.reversed = !segment.reversed; 8274 } 8275 var _createPath = function _createPath(e, ignore) { 8276 var path = document.createElementNS("http://www.w3.org/2000/svg", "path"), 8277 attr = [].slice.call(e.attributes), 8278 i = attr.length, 8279 name; 8280 ignore = "," + ignore + ","; 8281 while (--i > -1) { 8282 name = attr[i].nodeName.toLowerCase(); 8283 if (ignore.indexOf("," + name + ",") < 0) { 8284 path.setAttributeNS(null, name, attr[i].nodeValue); 8285 } 8286 } 8287 return path; 8288 }, 8289 _typeAttrs = { 8290 rect: "rx,ry,x,y,width,height", 8291 circle: "r,cx,cy", 8292 ellipse: "rx,ry,cx,cy", 8293 line: "x1,x2,y1,y2" 8294 }, 8295 _attrToObj = function _attrToObj(e, attrs) { 8296 var props = attrs ? attrs.split(",") : [], 8297 obj = {}, 8298 i = props.length; 8299 while (--i > -1) { 8300 obj[props[i]] = +e.getAttribute(props[i]) || 0; 8301 } 8302 return obj; 8303 }; 8304 function convertToPath(element, swap) { 8305 var type = element.tagName.toLowerCase(), 8306 circ = 0.552284749831, 8307 data, 8308 x, 8309 y, 8310 r, 8311 ry, 8312 path, 8313 rcirc, 8314 rycirc, 8315 points, 8316 w, 8317 h, 8318 x2, 8319 x3, 8320 x4, 8321 x5, 8322 x6, 8323 y2, 8324 y3, 8325 y4, 8326 y5, 8327 y6, 8328 attr; 8329 if (type === "path" || !element.getBBox) { 8330 return element; 8331 } 8332 path = _createPath(element, "x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points"); 8333 attr = _attrToObj(element, _typeAttrs[type]); 8334 if (type === "rect") { 8335 r = attr.rx; 8336 ry = attr.ry || r; 8337 x = attr.x; 8338 y = attr.y; 8339 w = attr.width - r * 2; 8340 h = attr.height - ry * 2; 8341 if (r || ry) { 8342 x2 = x + r * (1 - circ); 8343 x3 = x + r; 8344 x4 = x3 + w; 8345 x5 = x4 + r * circ; 8346 x6 = x4 + r; 8347 y2 = y + ry * (1 - circ); 8348 y3 = y + ry; 8349 y4 = y3 + h; 8350 y5 = y4 + ry * circ; 8351 y6 = y4 + ry; 8352 data = "M" + x6 + "," + y3 + " V" + y4 + " C" + [x6, y5, x5, y6, x4, y6, x4 - (x4 - x3) / 3, y6, x3 + (x4 - x3) / 3, y6, x3, y6, x2, y6, x, y5, x, y4, x, y4 - (y4 - y3) / 3, x, y3 + (y4 - y3) / 3, x, y3, x, y2, x2, y, x3, y, x3 + (x4 - x3) / 3, y, x4 - (x4 - x3) / 3, y, x4, y, x5, y, x6, y2, x6, y3].join(",") + "z"; 8353 } else { 8354 data = "M" + (x + w) + "," + y + " v" + h + " h" + -w + " v" +
vendor: 10,332 bytes, lines 8354-8654
8354-h + " h" + w + "z"; 8355 } 8356 } else if (type === "circle" || type === "ellipse") { 8357 if (type === "circle") { 8358 r = ry = attr.r; 8359 rycirc = r * circ; 8360 } else { 8361 r = attr.rx; 8362 ry = attr.ry; 8363 rycirc = ry * circ; 8364 } 8365 x = attr.cx; 8366 y = attr.cy; 8367 rcirc = r * circ; 8368 data = "M" + (x + r) + "," + y + " C" + [x + r, y + rycirc, x + rcirc, y + ry, x, y + ry, x - rcirc, y + ry, x - r, y + rycirc, x - r, y, x - r, y - rycirc, x - rcirc, y - ry, x, y - ry, x + rcirc, y - ry, x + r, y - rycirc, x + r, y].join(",") + "z"; 8369 } else if (type === "line") { 8370 data = "M" + attr.x1 + "," + attr.y1 + " L" + attr.x2 + "," + attr.y2; 8371 } else if (type === "polyline" || type === "polygon") { 8372 points = (element.getAttribute("points") + "").match(_numbersExp) || []; 8373 x = points.shift(); 8374 y = points.shift(); 8375 data = "M" + x + "," + y + " L" + points.join(","); 8376 if (type === "polygon") { 8377 data += "," + x + "," + y + "z"; 8378 } 8379 } 8380 path.setAttribute("d", rawPathToString(path._gsRawPath = stringToRawPath(data))); 8381 if (swap && element.parentNode) { 8382 element.parentNode.insertBefore(path, element); 8383 element.parentNode.removeChild(element); 8384 } 8385 return path; 8386 } 8387 function arcToSegment(lastX, lastY, rx, ry, angle, largeArcFlag, sweepFlag, x, y) { 8388 if (lastX === x && lastY === y) { 8389 return; 8390 } 8391 rx = _abs(rx); 8392 ry = _abs(ry); 8393 var angleRad = angle % 360 * _DEG2RAD, 8394 cosAngle = _cos(angleRad), 8395 sinAngle = _sin(angleRad), 8396 PI = Math.PI, 8397 TWOPI = PI * 2, 8398 dx2 = (lastX - x) / 2, 8399 dy2 = (lastY - y) / 2, 8400 x1 = cosAngle * dx2 + sinAngle * dy2, 8401 y1 = -sinAngle * dx2 + cosAngle * dy2, 8402 x1_sq = x1 * x1, 8403 y1_sq = y1 * y1, 8404 radiiCheck = x1_sq / (rx * rx) + y1_sq / (ry * ry); 8405 if (radiiCheck > 1) { 8406 rx = _sqrt(radiiCheck) * rx; 8407 ry = _sqrt(radiiCheck) * ry; 8408 } 8409 var rx_sq = rx * rx, 8410 ry_sq = ry * ry, 8411 sq = (rx_sq * ry_sq - rx_sq * y1_sq - ry_sq * x1_sq) / (rx_sq * y1_sq + ry_sq * x1_sq); 8412 if (sq < 0) { 8413 sq = 0; 8414 } 8415 var coef = (largeArcFlag === sweepFlag ? -1 : 1) * _sqrt(sq), 8416 cx1 = coef * (rx * y1 / ry), 8417 cy1 = coef * -(ry * x1 / rx), 8418 sx2 = (lastX + x) / 2, 8419 sy2 = (lastY + y) / 2, 8420 cx = sx2 + (cosAngle * cx1 - sinAngle * cy1), 8421 cy = sy2 + (sinAngle * cx1 + cosAngle * cy1), 8422 ux = (x1 - cx1) / rx, 8423 uy = (y1 - cy1) / ry, 8424 vx = (-x1 - cx1) / rx, 8425 vy = (-y1 - cy1) / ry, 8426 temp = ux * ux + uy * uy, 8427 angleStart = (uy < 0 ? -1 : 1) * Math.acos(ux / _sqrt(temp)), 8428 angleExtent = (ux * vy - uy * vx < 0 ? -1 : 1) * Math.acos((ux * vx + uy * vy) / _sqrt(temp * (vx * vx + vy * vy))); 8429 isNaN(angleExtent) && (angleExtent = PI); 8430 if (!sweepFlag && angleExtent > 0) { 8431 angleExtent -= TWOPI; 8432 } else if (sweepFlag && angleExtent < 0) { 8433 angleExtent += TWOPI; 8434 } 8435 angleStart %= TWOPI; 8436 angleExtent %= TWOPI; 8437 var segments = Math.ceil(_abs(angleExtent) / (TWOPI / 4)), 8438 rawPath = [], 8439 angleIncrement = angleExtent / segments, 8440 controlLength = 4 / 3 * _sin(angleIncrement / 2) / (1 + _cos(angleIncrement / 2)), 8441 ma = cosAngle * rx, 8442 mb = sinAngle * rx, 8443 mc = sinAngle * -ry, 8444 md = cosAngle * ry, 8445 i; 8446 for (i = 0; i < segments; i++) { 8447 angle = angleStart + i * angleIncrement; 8448 x1 = _cos(angle); 8449 y1 = _sin(angle); 8450 ux = _cos(angle += angleIncrement); 8451 uy = _sin(angle); 8452 rawPath.push(x1 - controlLength * y1, y1 + controlLength * x1, ux + controlLength * uy, uy - controlLength * ux, ux, uy); 8453 } 8454 for (i = 0; i < rawPath.length; i += 2) { 8455 x1 = rawPath[i]; 8456 y1 = rawPath[i + 1]; 8457 rawPath[i] = x1 * ma + y1 * mc + cx; 8458 rawPath[i + 1] = x1 * mb + y1 * md + cy; 8459 } 8460 rawPath[i - 2] = x; 8461 rawPath[i - 1] = y; 8462 return rawPath; 8463 } 8464 function stringToRawPath(d) { 8465 var a = (d + "").replace(_scientific, function (m) { 8466 var n = +m; 8467 return n < 0.0001 && n > -0.0001 ? 0 : n; 8468 }).match(_svgPathExp) || [], 8469 path = [], 8470 relativeX = 0, 8471 relativeY = 0, 8472 twoThirds = 2 / 3, 8473 elements = a.length, 8474 points = 0, 8475 errorMessage = "ERROR: malformed path: " + d, 8476 i, 8477 j, 8478 x, 8479 y, 8480 command, 8481 isRelative, 8482 segment, 8483 startX, 8484 startY, 8485 difX, 8486 difY, 8487 beziers, 8488 prevCommand, 8489 flag1, 8490 flag2, 8491 line = function line(sx, sy, ex, ey) { 8492 difX = (ex - sx) / 3; 8493 difY = (ey - sy) / 3; 8494 segment.push(sx + difX, sy + difY, ex - difX, ey - difY, ex, ey); 8495 }; 8496 if (!d || !isNaN(a[0]) || isNaN(a[1])) { 8497 console.log(errorMessage); 8498 return path; 8499 } 8500 for (i = 0; i < elements; i++) { 8501 prevCommand = command; 8502 if (isNaN(a[i])) { 8503 command = a[i].toUpperCase(); 8504 isRelative = command !== a[i]; 8505 } else { 8506 i--; 8507 } 8508 x = +a[i + 1]; 8509 y = +a[i + 2]; 8510 if (isRelative) { 8511 x += relativeX; 8512 y += relativeY; 8513 } 8514 if (!i) { 8515 startX = x; 8516 startY = y; 8517 } 8518 if (command === "M") { 8519 if (segment) { 8520 if (segment.length < 8) { 8521 path.length -= 1; 8522 } else { 8523 points += segment.length; 8524 } 8525 } 8526 relativeX = startX = x; 8527 relativeY = startY = y; 8528 segment = [x, y]; 8529 path.push(segment); 8530 i += 2; 8531 command = "L"; 8532 } else if (command === "C") { 8533 if (!segment) { 8534 segment = [0, 0]; 8535 } 8536 if (!isRelative) { 8537 relativeX = relativeY = 0; 8538 } 8539 segment.push(x, y, relativeX + a[i + 3] * 1, relativeY + a[i + 4] * 1, relativeX += a[i + 5] * 1, relativeY += a[i + 6] * 1); 8540 i += 6; 8541 } else if (command === "S") { 8542 difX = relativeX; 8543 difY = relativeY; 8544 if (prevCommand === "C" || prevCommand === "S") { 8545 difX += relativeX - segment[segment.length - 4]; 8546 difY += relativeY - segment[segment.length - 3]; 8547 } 8548 if (!isRelative) { 8549 relativeX = relativeY = 0; 8550 } 8551 segment.push(difX, difY, x, y, relativeX += a[i + 3] * 1, relativeY += a[i + 4] * 1); 8552 i += 4; 8553 } else if (command === "Q") { 8554 difX = relativeX + (x - relativeX) * twoThirds; 8555 difY = relativeY + (y - relativeY) * twoThirds; 8556 if (!isRelative) { 8557 relativeX = relativeY = 0; 8558 } 8559 relativeX += a[i + 3] * 1; 8560 relativeY += a[i + 4] * 1; 8561 segment.push(difX, difY, relativeX + (x - relativeX) * twoThirds, relativeY + (y - relativeY) * twoThirds, relativeX, relativeY); 8562 i += 4; 8563 } else if (command === "T") { 8564 difX = relativeX - segment[segment.length - 4]; 8565 difY = relativeY - segment[segment.length - 3]; 8566 segment.push(relativeX + difX, relativeY + difY, x + (relativeX + difX * 1.5 - x) * twoThirds, y + (relativeY + difY * 1.5 - y) * twoThirds, relativeX = x, relativeY = y); 8567 i += 2; 8568 } else if (command === "H") { 8569 line(relativeX, relativeY, relativeX = x, relativeY); 8570 i += 1; 8571 } else if (command === "V") { 8572 line(relativeX, relativeY, relativeX, relativeY = x + (isRelative ? relativeY - relativeX : 0)); 8573 i += 1; 8574 } else if (command === "L" || command === "Z") { 8575 if (command === "Z") { 8576 x = startX; 8577 y = startY; 8578 segment.closed = true; 8579 } 8580 if (command === "L" || _abs(relativeX - x) > 0.5 || _abs(relativeY - y) > 0.5) { 8581 line(relativeX, relativeY, x, y); 8582 if (command === "L") { 8583 i += 2; 8584 } 8585 } 8586 relativeX = x; 8587 relativeY = y; 8588 } else if (command === "A") { 8589 flag1 = a[i + 4]; 8590 flag2 = a[i + 5]; 8591 difX = a[i + 6]; 8592 difY = a[i + 7]; 8593 j = 7; 8594 if (flag1.length > 1) { 8595 if (flag1.length < 3) { 8596 difY = difX; 8597 difX = flag2; 8598 j--; 8599 } else { 8600 difY = flag2; 8601 difX = flag1.substr(2); 8602 j -= 2; 8603 } 8604 flag2 = flag1.charAt(1); 8605 flag1 = flag1.charAt(0); 8606 } 8607 beziers = arcToSegment(relativeX, relativeY, +a[i + 1], +a[i + 2], +a[i + 3], +flag1, +flag2, (isRelative ? relativeX : 0) + difX * 1, (isRelative ? relativeY : 0) + difY * 1); 8608 i += j; 8609 if (beziers) { 8610 for (j = 0; j < beziers.length; j++) { 8611 segment.push(beziers[j]); 8612 } 8613 } 8614 relativeX = segment[segment.length - 2]; 8615 relativeY = segment[segment.length - 1]; 8616 } else { 8617 console.log(errorMessage); 8618 } 8619 } 8620 i = segment.length; 8621 if (i < 6) { 8622 path.pop(); 8623 i = 0; 8624 } else if (segment[0] === segment[i - 2] && segment[1] === segment[i - 1]) { 8625 segment.closed = true; 8626 } 8627 path.totalPoints = points + i; 8628 return path; 8629 } 8630 function rawPathToString(rawPath) { 8631 if (_isNumber(rawPath[0])) { 8632 rawPath = [rawPath]; 8633 } 8634 var result = "", 8635 l = rawPath.length, 8636 sl, 8637 s, 8638 i, 8639 segment; 8640 for (s = 0; s < l; s++) { 8641 segment = rawPath[s]; 8642 result += "M" + _round(segment[0]) + "," + _round(segment[1]) + " C"; 8643 sl = segment.length; 8644 for (i = 2; i < sl; i++) { 8645 result += _round(segment[i++]) + "," + _round(segment[i++]) + " " + _round(segment[i++]) + "," + _round(segment[i++]) + " " + _round(segment[i++]) + "," + _round(segment[i]) + " "; 8646 } 8647 if (segment.closed) { 8648 result += "z"; 8649 } 8650 } 8651 return result; 8652 } 8653 8654 /*!
vendor: 5,449 bytes, lines 8655-8834
8655 * MorphSVGPlugin 3.11.5 8656 * https://greensock.com 8657 * 8658 * @license Copyright 2008-2023, GreenSock. All rights reserved. 8659 * Subject to the terms at https://greensock.com/standard-license or for 8660 * Club GreenSock members, the agreement issued with that membership. 8661 * @author: Jack Doyle, [email protected] 8662 */ 8663 8664 var gsap, 8665 _toArray, 8666 _lastLinkedAnchor, 8667 _coreInitted, 8668 PluginClass, 8669 _getGSAP = function _getGSAP() { 8670 return gsap || typeof window !== "undefined" && (gsap = window.gsap) && gsap.registerPlugin && gsap; 8671 }, 8672 _isFunction = function _isFunction(value) { 8673 return typeof value === "function"; 8674 }, 8675 _atan2 = Math.atan2, 8676 _cos$1 = Math.cos, 8677 _sin$1 = Math.sin, 8678 _sqrt$1 = Math.sqrt, 8679 _PI = Math.PI, 8680 _2PI = _PI * 2, 8681 _angleMin = _PI * 0.3, 8682 _angleMax = _PI * 0.7, 8683 _bigNum = 1e20, 8684 _numExp = /[-+=\.]*\d+[\.e\-\+]*\d*[e\-\+]*\d*/gi, 8685 _selectorExp$1 = /(^[#\.][a-z]|[a-y][a-z])/i, 8686 _commands = /[achlmqstvz]/i, 8687 _log = function _log(message) { 8688 return console && console.warn(message); 8689 }, 8690 _bonusValidated = 1, 8691 _getAverageXY = function _getAverageXY(segment) { 8692 var l = segment.length, 8693 x = 0, 8694 y = 0, 8695 i; 8696 for (i = 0; i < l; i++) { 8697 x += segment[i++]; 8698 y += segment[i]; 8699 } 8700 return [x / (l / 2), y / (l / 2)]; 8701 }, 8702 _getSize = function _getSize(segment) { 8703 var l = segment.length, 8704 xMax = segment[0], 8705 xMin = xMax, 8706 yMax = segment[1], 8707 yMin = yMax, 8708 x, 8709 y, 8710 i; 8711 for (i = 6; i < l; i += 6) { 8712 x = segment[i]; 8713 y = segment[i + 1]; 8714 if (x > xMax) { 8715 xMax = x; 8716 } else if (x < xMin) { 8717 xMin = x; 8718 } 8719 if (y > yMax) { 8720 yMax = y; 8721 } else if (y < yMin) { 8722 yMin = y; 8723 } 8724 } 8725 segment.centerX = (xMax + xMin) / 2; 8726 segment.centerY = (yMax + yMin) / 2; 8727 return segment.size = (xMax - xMin) * (yMax - yMin); 8728 }, 8729 _getTotalSize = function _getTotalSize(rawPath, samplesPerBezier) { 8730 if (samplesPerBezier === void 0) { 8731 samplesPerBezier = 3; 8732 } 8733 var j = rawPath.length, 8734 xMax = rawPath[0][0], 8735 xMin = xMax, 8736 yMax = rawPath[0][1], 8737 yMin = yMax, 8738 inc = 1 / samplesPerBezier, 8739 l, 8740 x, 8741 y, 8742 i, 8743 segment, 8744 k, 8745 t, 8746 inv, 8747 x1, 8748 y1, 8749 x2, 8750 x3, 8751 x4, 8752 y2, 8753 y3, 8754 y4; 8755 while (--j > -1) { 8756 segment = rawPath[j]; 8757 l = segment.length; 8758 for (i = 6; i < l; i += 6) { 8759 x1 = segment[i]; 8760 y1 = segment[i + 1]; 8761 x2 = segment[i + 2] - x1; 8762 y2 = segment[i + 3] - y1; 8763 x3 = segment[i + 4] - x1; 8764 y3 = segment[i + 5] - y1; 8765 x4 = segment[i + 6] - x1; 8766 y4 = segment[i + 7] - y1; 8767 k = samplesPerBezier; 8768 while (--k > -1) { 8769 t = inc * k; 8770 inv = 1 - t; 8771 x = (t * t * x4 + 3 * inv * (t * x3 + inv * x2)) * t + x1; 8772 y = (t * t * y4 + 3 * inv * (t * y3 + inv * y2)) * t + y1; 8773 if (x > xMax) { 8774 xMax = x; 8775 } else if (x < xMin) { 8776 xMin = x; 8777 } 8778 if (y > yMax) { 8779 yMax = y; 8780 } else if (y < yMin) { 8781 yMin = y; 8782 } 8783 } 8784 } 8785 } 8786 rawPath.centerX = (xMax + xMin) / 2; 8787 rawPath.centerY = (yMax + yMin) / 2; 8788 rawPath.left = xMin; 8789 rawPath.width = xMax - xMin; 8790 rawPath.top = yMin; 8791 rawPath.height = yMax - yMin; 8792 return rawPath.size = (xMax - xMin) * (yMax - yMin); 8793 }, 8794 _sortByComplexity = function _sortByComplexity(a, b) { 8795 return b.length - a.length; 8796 }, 8797 _sortBySize = function _sortBySize(a, b) { 8798 var sizeA = a.size || _getSize(a), 8799 sizeB = b.size || _getSize(b); 8800 return Math.abs(sizeB - sizeA) < (sizeA + sizeB) / 20 ? b.centerX - a.centerX || b.centerY - a.centerY : sizeB - sizeA; 8801 }, 8802 _offsetSegment = function _offsetSegment(segment, shapeIndex) { 8803 var a = segment.slice(0), 8804 l = segment.length, 8805 wrap = l - 2, 8806 i, 8807 index; 8808 shapeIndex = shapeIndex | 0; 8809 for (i = 0; i < l; i++) { 8810 index = (i + shapeIndex) % wrap; 8811 segment[i++] = a[index]; 8812 segment[i] = a[index + 1]; 8813 } 8814 }, 8815 _getTotalMovement = function _getTotalMovement(sb, eb, shapeIndex, offsetX, offsetY) { 8816 var l = sb.length, 8817 d = 0, 8818 wrap = l - 2, 8819 index, 8820 i, 8821 x, 8822 y; 8823 shapeIndex *= 6; 8824 for (i = 0; i < l; i += 6) { 8825 index = (i + shapeIndex) % wrap; 8826 y = sb[index] - (eb[i] - offsetX); 8827 x = sb[index + 1] - (eb[i + 1] - offsetY); 8828 d += _sqrt$1(x * x + y * y); 8829 } 8830 return d; 8831 }, 8832 _getClosestShapeIndex = function _getClosestShapeIndex(sb, eb, checkReverse) { 8833 var l = sb.length, 8834 sCenter = _getAverageXY(sb),
vendor: 7,688 bytes, lines 8835-9048
8835 eCenter = _getAverageXY(eb), 8836 offsetX = eCenter[0] - sCenter[0], 8837 offsetY = eCenter[1] - sCenter[1], 8838 min = _getTotalMovement(sb, eb, 0, offsetX, offsetY), 8839 minIndex = 0, 8840 copy, 8841 d, 8842 i; 8843 for (i = 6; i < l; i += 6) { 8844 d = _getTotalMovement(sb, eb, i / 6, offsetX, offsetY); 8845 if (d < min) { 8846 min = d; 8847 minIndex = i; 8848 } 8849 } 8850 if (checkReverse) { 8851 copy = sb.slice(0); 8852 reverseSegment(copy); 8853 for (i = 6; i < l; i += 6) { 8854 d = _getTotalMovement(copy, eb, i / 6, offsetX, offsetY); 8855 if (d < min) { 8856 min = d; 8857 minIndex = -i; 8858 } 8859 } 8860 } 8861 return minIndex / 6; 8862 }, 8863 _getClosestAnchor = function _getClosestAnchor(rawPath, x, y) { 8864 var j = rawPath.length, 8865 closestDistance = _bigNum, 8866 closestX = 0, 8867 closestY = 0, 8868 segment, 8869 dx, 8870 dy, 8871 d, 8872 i, 8873 l; 8874 while (--j > -1) { 8875 segment = rawPath[j]; 8876 l = segment.length; 8877 for (i = 0; i < l; i += 6) { 8878 dx = segment[i] - x; 8879 dy = segment[i + 1] - y; 8880 d = _sqrt$1(dx * dx + dy * dy); 8881 if (d < closestDistance) { 8882 closestDistance = d; 8883 closestX = segment[i]; 8884 closestY = segment[i + 1]; 8885 } 8886 } 8887 } 8888 return [closestX, closestY]; 8889 }, 8890 _getClosestSegment = function _getClosestSegment(bezier, pool, startIndex, sortRatio, offsetX, offsetY) { 8891 var l = pool.length, 8892 index = 0, 8893 minSize = Math.min(bezier.size || _getSize(bezier), pool[startIndex].size || _getSize(pool[startIndex])) * sortRatio, 8894 min = _bigNum, 8895 cx = bezier.centerX + offsetX, 8896 cy = bezier.centerY + offsetY, 8897 size, 8898 i, 8899 dx, 8900 dy, 8901 d; 8902 for (i = startIndex; i < l; i++) { 8903 size = pool[i].size || _getSize(pool[i]); 8904 if (size < minSize) { 8905 break; 8906 } 8907 dx = pool[i].centerX - cx; 8908 dy = pool[i].centerY - cy; 8909 d = _sqrt$1(dx * dx + dy * dy); 8910 if (d < min) { 8911 index = i; 8912 min = d; 8913 } 8914 } 8915 d = pool[index]; 8916 pool.splice(index, 1); 8917 return d; 8918 }, 8919 _subdivideSegmentQty = function _subdivideSegmentQty(segment, quantity) { 8920 var tally = 0, 8921 max = 0.999999, 8922 l = segment.length, 8923 newPointsPerSegment = quantity / ((l - 2) / 6), 8924 ax, 8925 ay, 8926 cp1x, 8927 cp1y, 8928 cp2x, 8929 cp2y, 8930 bx, 8931 by, 8932 x1, 8933 y1, 8934 x2, 8935 y2, 8936 i, 8937 t; 8938 for (i = 2; i < l; i += 6) { 8939 tally += newPointsPerSegment; 8940 while (tally > max) { 8941 ax = segment[i - 2]; 8942 ay = segment[i - 1]; 8943 cp1x = segment[i]; 8944 cp1y = segment[i + 1]; 8945 cp2x = segment[i + 2]; 8946 cp2y = segment[i + 3]; 8947 bx = segment[i + 4]; 8948 by = segment[i + 5]; 8949 t = 1 / ((Math.floor(tally) || 1) + 1); 8950 x1 = ax + (cp1x - ax) * t; 8951 x2 = cp1x + (cp2x - cp1x) * t; 8952 x1 += (x2 - x1) * t; 8953 x2 += (cp2x + (bx - cp2x) * t - x2) * t; 8954 y1 = ay + (cp1y - ay) * t; 8955 y2 = cp1y + (cp2y - cp1y) * t; 8956 y1 += (y2 - y1) * t; 8957 y2 += (cp2y + (by - cp2y) * t - y2) * t; 8958 segment.splice(i, 4, ax + (cp1x - ax) * t, ay + (cp1y - ay) * t, x1, y1, x1 + (x2 - x1) * t, y1 + (y2 - y1) * t, x2, y2, cp2x + (bx - cp2x) * t, cp2y + (by - cp2y) * t); 8959 i += 6; 8960 l += 6; 8961 tally--; 8962 } 8963 } 8964 return segment; 8965 }, 8966 _equalizeSegmentQuantity = function _equalizeSegmentQuantity(start, end, shapeIndex, map, fillSafe) { 8967 var dif = end.length - start.length, 8968 longer = dif > 0 ? end : start, 8969 shorter = dif > 0 ? start : end, 8970 added = 0, 8971 sortMethod = map === "complexity" ? _sortByComplexity : _sortBySize, 8972 sortRatio = map === "position" ? 0 : typeof map === "number" ? map : 0.8, 8973 i = shorter.length, 8974 shapeIndices = typeof shapeIndex === "object" && shapeIndex.push ? shapeIndex.slice(0) : [shapeIndex], 8975 reverse = shapeIndices[0] === "reverse" || shapeIndices[0] < 0, 8976 log = shapeIndex === "log", 8977 eb, 8978 sb, 8979 b, 8980 x, 8981 y, 8982 offsetX, 8983 offsetY; 8984 if (!shorter[0]) { 8985 return; 8986 } 8987 if (longer.length > 1) { 8988 start.sort(sortMethod); 8989 end.sort(sortMethod); 8990 offsetX = longer.size || _getTotalSize(longer); 8991 offsetX = shorter.size || _getTotalSize(shorter); 8992 offsetX = longer.centerX - shorter.centerX; 8993 offsetY = longer.centerY - shorter.centerY; 8994 if (sortMethod === _sortBySize) { 8995 for (i = 0; i < shorter.length; i++) { 8996 longer.splice(i, 0, _getClosestSegment(shorter[i], longer, i, sortRatio, offsetX, offsetY)); 8997 } 8998 } 8999 } 9000 if (dif) { 9001 if (dif < 0) { 9002 dif = -dif; 9003 } 9004 if (longer[0].length > shorter[0].length) { 9005 _subdivideSegmentQty(shorter[0], (longer[0].length - shorter[0].length) / 6 | 0); 9006 } 9007 i = shorter.length; 9008 while (added < dif) { 9009 x = longer[i].size || _getSize(longer[i]); 9010 b = _getClosestAnchor(shorter, longer[i].centerX, longer[i].centerY); 9011 x = b[0]; 9012 y = b[1]; 9013 shorter[i++] = [x, y, x, y, x, y, x, y]; 9014 shorter.totalPoints += 8; 9015 added++; 9016 } 9017 } 9018 for (i = 0; i < start.length; i++) { 9019 eb = end[i]; 9020 sb = start[i]; 9021 dif = eb.length - sb.length; 9022 if (dif < 0) { 9023 _subdivideSegmentQty(eb, -dif / 6 | 0); 9024 } else if (dif > 0) { 9025 _subdivideSegmentQty(sb, dif / 6 | 0); 9026 } 9027 if (reverse && fillSafe !== false && !sb.reversed) { 9028 reverseSegment(sb); 9029 } 9030 shapeIndex = shapeIndices[i] || shapeIndices[i] === 0 ? shapeIndices[i] : "auto"; 9031 if (shapeIndex) { 9032 if (sb.closed || Math.abs(sb[0] - sb[sb.length - 2]) < 0.5 && Math.abs(sb[1] - sb[sb.length - 1]) < 0.5) { 9033 if (shapeIndex === "auto" || shapeIndex === "log") { 9034 shapeIndices[i] = shapeIndex = _getClosestShapeIndex(sb, eb, !i || fillSafe === false); 9035 if (shapeIndex < 0) { 9036 reverse = true; 9037 reverseSegment(sb); 9038 shapeIndex = -shapeIndex; 9039 } 9040 _offsetSegment(sb, shapeIndex * 6); 9041 } else if (shapeIndex !== "reverse") { 9042 if (i && shapeIndex < 0) { 9043 reverseSegment(sb); 9044 } 9045 _offsetSegment(sb, (shapeIndex < 0 ? -shapeIndex : shapeIndex) * 6); 9046 } 9047 } else if (!reverse && (shapeIndex === "auto" && Math.abs(eb[0] - sb[0]) + Math.abs(eb[1] - sb[1]) + Math.abs(eb[eb.length - 2] - sb[sb.length - 2]) + Math.abs(eb[eb.length - 1] - sb[sb.length - 1]) > Math.abs(eb[0] - sb[sb.length - 2]) + Math.abs(eb[1] - sb[sb.length - 1]) + Math.abs(eb[eb.length - 2] - sb[0]) + Math.abs(eb[eb.length - 1] - sb[1]) || shapeIndex % 2)) { 9048 reverseSegment(sb);
vendor: 4,065 bytes, lines 9049-9168
9049 shapeIndices[i] = -1; 9050 reverse = true; 9051 } else if (shapeIndex === "auto") { 9052 shapeIndices[i] = 0; 9053 } else if (shapeIndex === "reverse") { 9054 shapeIndices[i] = -1; 9055 } 9056 if (sb.closed !== eb.closed) { 9057 sb.closed = eb.closed = false; 9058 } 9059 } 9060 } 9061 log && _log("shapeIndex:[" + shapeIndices.join(",") + "]"); 9062 start.shapeIndex = shapeIndices; 9063 return shapeIndices; 9064 }, 9065 _pathFilter = function _pathFilter(a, shapeIndex, map, precompile, fillSafe) { 9066 var start = stringToRawPath(a[0]), 9067 end = stringToRawPath(a[1]); 9068 if (!_equalizeSegmentQuantity(start, end, shapeIndex || shapeIndex === 0 ? shapeIndex : "auto", map, fillSafe)) { 9069 return; 9070 } 9071 a[0] = rawPathToString(start); 9072 a[1] = rawPathToString(end); 9073 if (precompile === "log" || precompile === true) { 9074 _log('precompile:["' + a[0] + '","' + a[1] + '"]'); 9075 } 9076 }, 9077 _offsetPoints = function _offsetPoints(text, offset) { 9078 if (!offset) { 9079 return text; 9080 } 9081 var a = text.match(_numExp) || [], 9082 l = a.length, 9083 s = "", 9084 inc, 9085 i, 9086 j; 9087 if (offset === "reverse") { 9088 i = l - 1; 9089 inc = -2; 9090 } else { 9091 i = ((parseInt(offset, 10) || 0) * 2 + 1 + l * 100) % l; 9092 inc = 2; 9093 } 9094 for (j = 0; j < l; j += 2) { 9095 s += a[i - 1] + "," + a[i] + " "; 9096 i = (i + inc) % l; 9097 } 9098 return s; 9099 }, 9100 _equalizePointQuantity = function _equalizePointQuantity(a, quantity) { 9101 var tally = 0, 9102 x = parseFloat(a[0]), 9103 y = parseFloat(a[1]), 9104 s = x + "," + y + " ", 9105 max = 0.999999, 9106 newPointsPerSegment, 9107 i, 9108 l, 9109 j, 9110 factor, 9111 nextX, 9112 nextY; 9113 l = a.length; 9114 newPointsPerSegment = quantity * 0.5 / (l * 0.5 - 1); 9115 for (i = 0; i < l - 2; i += 2) { 9116 tally += newPointsPerSegment; 9117 nextX = parseFloat(a[i + 2]); 9118 nextY = parseFloat(a[i + 3]); 9119 if (tally > max) { 9120 factor = 1 / (Math.floor(tally) + 1); 9121 j = 1; 9122 while (tally > max) { 9123 s += (x + (nextX - x) * factor * j).toFixed(2) + "," + (y + (nextY - y) * factor * j).toFixed(2) + " "; 9124 tally--; 9125 j++; 9126 } 9127 } 9128 s += nextX + "," + nextY + " "; 9129 x = nextX; 9130 y = nextY; 9131 } 9132 return s; 9133 }, 9134 _pointsFilter = function _pointsFilter(a) { 9135 var startNums = a[0].match(_numExp) || [], 9136 endNums = a[1].match(_numExp) || [], 9137 dif = endNums.length - startNums.length; 9138 if (dif > 0) { 9139 a[0] = _equalizePointQuantity(startNums, dif); 9140 } else { 9141 a[1] = _equalizePointQuantity(endNums, -dif); 9142 } 9143 }, 9144 _buildPointsFilter = function _buildPointsFilter(shapeIndex) { 9145 return !isNaN(shapeIndex) ? function (a) { 9146 _pointsFilter(a); 9147 a[1] = _offsetPoints(a[1], parseInt(shapeIndex, 10)); 9148 } : _pointsFilter; 9149 }, 9150 _parseShape = function _parseShape(shape, forcePath, target) { 9151 var isString = typeof shape === "string", 9152 e, 9153 type; 9154 if (!isString || _selectorExp$1.test(shape) || (shape.match(_numExp) || []).length < 3) { 9155 e = _toArray(shape)[0]; 9156 if (e) { 9157 type = (e.nodeName + "").toUpperCase(); 9158 if (forcePath && type !== "PATH") { 9159 e = convertToPath(e, false); 9160 type = "PATH"; 9161 } 9162 shape = e.getAttribute(type === "PATH" ? "d" : "points") || ""; 9163 if (e === target) { 9164 shape = e.getAttributeNS(null, "data-original") || shape; 9165 } 9166 } else { 9167 _log("WARNING: invalid morph to: " + shape); 9168 shape = false;
9169 } 9170 } 9171 return shape; 9172 }, 9173 _populateSmoothData = function _populateSmoothData(rawPath, tolerance) { 9174 var j = rawPath.length, 9175 limit = 0.2 * (tolerance || 1), 9176 smooth, 9177 segment, 9178 x, 9179 y, 9180 x2, 9181 y2, 9182 i, 9183 l, 9184 a, 9185 a2, 9186 isSmooth, 9187 smoothData; 9188 while (--j > -1) { 9189 segment = rawPath[j]; 9190 isSmooth = segment.isSmooth = segment.isSmooth || [0, 0, 0, 0]; 9191 smoothData = segment.smoothData = segment.smoothData || [0, 0, 0, 0]; 9192 isSmooth.length = 4; 9193 l = segment.length - 2; 9194 for (i = 6; i < l; i += 6) { 9195 x = segment[i] - segment[i - 2]; 9196 y = segment[i + 1] - segment[i - 1]; 9197 x2 = segment[i + 2] - segment[i]; 9198 y2 = segment[i + 3] - segment[i + 1]; 9199 a = _atan2(y, x); 9200 a2 = _atan2(y2, x2); 9201 smooth = Math.abs(a - a2) < limit; 9202 if (smooth) { 9203 smoothData[i - 2] = a; 9204 smoothData[i + 2] = a2; 9205 smoothData[i - 1] = _sqrt$1(x * x + y * y); 9206 smoothData[i + 3] = _sqrt$1(x2 * x2 + y2 * y2); 9207 } 9208 isSmooth.push(smooth, smooth, 0, 0, smooth, smooth); 9209 } 9210 if (segment[l] === segment[0] && segment[l + 1] === segment[1]) { 9211 x = segment[0] - segment[l - 2]; 9212 y = segment[1] - segment[l - 1]; 9213 x2 = segment[2] - segment[0]; 9214 y2 = segment[3] - segment[1]; 9215 a = _atan2(y, x); 9216 a2 = _atan2(y2, x2); 9217 if (Math.abs(a - a2) < limit) { 9218 smoothData[l - 2] = a; 9219 smoothData[2] = a2; 9220 smoothData[l - 1] = _sqrt$1(x * x + y * y); 9221 smoothData[3] = _sqrt$1(x2 * x2 + y2 * y2); 9222 isSmooth[l - 2] = isSmooth[l - 1] = true; 9223 } 9224 } 9225 } 9226 return rawPath; 9227 }, 9228 _parseOriginFactors = function _parseOriginFactors(v) { 9229 var a = v.trim().split(" "), 9230 x = ~v.indexOf("left") ? 0 : ~v.indexOf("right") ? 100 : isNaN(parseFloat(a[0])) ? 50 : parseFloat(a[0]), 9231 y = ~v.indexOf("top") ? 0 : ~v.indexOf("bottom") ? 100 : isNaN(parseFloat(a[1])) ? 50 : parseFloat(a[1]); 9232 return { 9233 x: x / 100, 9234 y: y / 100 9235 }; 9236 }, 9237 _shortAngle = function _shortAngle(dif) { 9238 return dif !== dif % _PI ? dif + (dif < 0 ? _2PI : -_2PI) : dif; 9239 }, 9240 _morphMessage = "Use MorphSVGPlugin.convertToPath() to convert to a path before morphing.", 9241 _tweenRotation = function _tweenRotation(start, end, i, linkedPT) { 9242 var so = this._origin, 9243 eo = this._eOrigin, 9244 dx = start[i] - so.x, 9245 dy = start[i + 1] - so.y, 9246 d = _sqrt$1(dx * dx + dy * dy), 9247 sa = _atan2(dy, dx), 9248 angleDif, 9249 _short; 9250 dx = end[i] - eo.x; 9251 dy = end[i + 1] - eo.y; 9252 angleDif = _atan2(dy, dx) - sa; 9253 _short = _shortAngle(angleDif); 9254 if (!linkedPT && _lastLinkedAnchor && Math.abs(_short + _lastLinkedAnchor.ca) < _angleMin) { 9255 linkedPT = _lastLinkedAnchor; 9256 } 9257 return this._anchorPT = _lastLinkedAnchor = { 9258 _next: this._anchorPT, 9259 t: start, 9260 sa: sa, 9261 ca: linkedPT && _short * linkedPT.ca < 0 && Math.abs(_short) > _angleMax ? angleDif : _short, 9262 sl: d, 9263 cl: _sqrt$1(dx * dx + dy * dy) - d, 9264 i: i 9265 }; 9266 }, 9267 _initCore = function _initCore(required) { 9268 gsap = _getGSAP(); 9269 PluginClass = PluginClass || gsap && gsap.plugins.morphSVG; 9270 if (gsap && PluginClass) { 9271 _toArray = gsap.utils.toArray; 9272 PluginClass.prototype._tweenRotation = _tweenRotation; 9273 _coreInitted = 1; 9274 } else if (required) { 9275 _log("Please gsap.registerPlugin(MorphSVGPlugin)"); 9276 } 9277 }; 9278 var MorphSVGPlugin = { 9279 version: "3.11.5", 9280 name: "morphSVG", 9281 rawVars: 1, 9282 register: function register(core, Plugin) { 9283 gsap = core; 9284 PluginClass = Plugin; 9285 _initCore(); 9286 }, 9287 init: function init(target, value, tween, index, targets) { 9288 _coreInitted || _initCore(1); 9289 if (!value) { 9290 _log("invalid shape"); 9291 return false;
9292 } 9293 _isFunction(value) && (value = value.call(tween, index, target, targets)); 9294 var type, p, pt, shape, isPoly, shapeIndex, map, startSmooth, endSmooth, start, end, i, j, l, startSeg, endSeg, precompiled, sData, eData, originFactors, useRotation, offset; 9295 if (typeof value === "string" || value.getBBox || value[0]) { 9296 value = { 9297 shape: value 9298 }; 9299 } else if (typeof value === "object") { 9300 type = {}; 9301 for (p in value) { 9302 type[p] = _isFunction(value[p]) && p !== "render" ? value[p].call(tween, index, target, targets) : value[p]; 9303 } 9304 value = type; 9305 } 9306 var cs = target.nodeType ? window.getComputedStyle(target) : {}, 9307 fill = cs.fill + "", 9308 fillSafe = !(fill === "none" || (fill.match(_numExp) || [])[3] === "0" || cs.fillRule === "evenodd"), 9309 origins = (value.origin || "50 50").split(","); 9310 type = (target.nodeName + "").toUpperCase(); 9311 isPoly = type === "POLYLINE" || type === "POLYGON"; 9312 if (type !== "PATH" && !isPoly && !value.prop) { 9313 _log("Cannot morph a <" + type + "> element. " + _morphMessage); 9314 return false; 9315 } 9316 p = type === "PATH" ? "d" : "points"; 9317 if (!value.prop && !_isFunction(target.setAttribute)) { 9318 return false; 9319 } 9320 shape = _parseShape(value.shape || value.d || value.points || "", p === "d", target); 9321 if (isPoly && _commands.test(shape)) { 9322 _log("A <" + type + "> cannot accept path data. " + _morphMessage); 9323 return false; 9324 } 9325 shapeIndex = value.shapeIndex || value.shapeIndex === 0 ? value.shapeIndex : "auto"; 9326 map = value.map || MorphSVGPlugin.defaultMap; 9327 this._prop = value.prop; 9328 this._render = value.render || MorphSVGPlugin.defaultRender; 9329 this._apply = "updateTarget" in value ? value.updateTarget : MorphSVGPlugin.defaultUpdateTarget; 9330 this._rnd = Math.pow(10, isNaN(value.precision) ? 2 : +value.precision); 9331 this._tween = tween; 9332 if (shape) { 9333 this._target = target; 9334 precompiled = typeof value.precompile === "object"; 9335 start = this._prop ? target[this._prop] : target.getAttribute(p); 9336 if (!this._prop && !target.getAttributeNS(null, "data-original")) { 9337 target.setAttributeNS(null, "data-original", start); 9338 } 9339 if (p === "d" || this._prop) { 9340 start = stringToRawPath(precompiled ? value.precompile[0] : start); 9341 end = stringToRawPath(precompiled ? value.precompile[1] : shape); 9342 if (!precompiled && !_equalizeSegmentQuantity(start, end, shapeIndex, map, fillSafe)) { 9343 return false; 9344 } 9345 if (value.precompile === "log" || value.precompile === true) { 9346 _log('precompile:["' + rawPathToString(start) + '","' + rawPathToString(end) + '"]'); 9347 } 9348 useRotation = (value.type || MorphSVGPlugin.defaultType) !== "linear"; 9349 if (useRotation) { 9350 start = _populateSmoothData(start, value.smoothTolerance); 9351 end = _populateSmoothData(end, value.smoothTolerance); 9352 if (!start.size) { 9353 _getTotalSize(start); 9354 } 9355 if (!end.size) { 9356 _getTotalSize(end); 9357 } 9358 originFactors = _parseOriginFactors(origins[0]); 9359 this._origin = start.origin = { 9360 x: start.left + originFactors.x * start.width, 9361 y: start.top + originFactors.y * start.height 9362 }; 9363 if (origins[1]) { 9364 originFactors = _parseOriginFactors(origins[1]); 9365 } 9366 this._eOrigin = { 9367 x: end.left + originFactors.x * end.width, 9368 y: end.top + originFactors.y * end.height 9369 }; 9370 } 9371 this._rawPath = target._gsRawPath = start; 9372 j = start.length; 9373 while (--j > -1) { 9374 startSeg = start[j]; 9375 endSeg = end[j]; 9376 startSmooth = startSeg.isSmooth || []; 9377 endSmooth = endSeg.isSmooth || []; 9378 l = startSeg.length; 9379 _lastLinkedAnchor = 0; 9380 for (i = 0; i < l; i += 2) { 9381 if (endSeg[i] !== startSeg[i] || endSeg[i + 1] !== startSeg[i + 1]) { 9382 if (useRotation) { 9383 if (startSmooth[i] && endSmooth[i]) { 9384 sData = startSeg.smoothData; 9385 eData = endSeg.smoothData; 9386 offset = i + (i === l - 4 ? 7 - l : 5); 9387 this._controlPT = { 9388 _next: this._controlPT, 9389 i: i, 9390 j: j, 9391 l1s: sData[i + 1], 9392 l1c: eData[i + 1] - sData[i + 1], 9393 l2s: sData[offset],
9394 l2c: eData[offset] - sData[offset] 9395 }; 9396 pt = this._tweenRotation(startSeg, endSeg, i + 2); 9397 this._tweenRotation(startSeg, endSeg, i, pt); 9398 this._tweenRotation(startSeg, endSeg, offset - 1, pt); 9399 i += 4; 9400 } else { 9401 this._tweenRotation(startSeg, endSeg, i); 9402 } 9403 } else { 9404 pt = this.add(startSeg, i, startSeg[i], endSeg[i], 0, 0, 0, 0, 0, 1); 9405 pt = this.add(startSeg, i + 1, startSeg[i + 1], endSeg[i + 1], 0, 0, 0, 0, 0, 1) || pt; 9406 } 9407 } 9408 } 9409 } 9410 } else { 9411 pt = this.add(target, "setAttribute", target.getAttribute(p) + "", shape + "", index, targets, 0, _buildPointsFilter(shapeIndex), p); 9412 } 9413 if (useRotation) { 9414 this.add(this._origin, "x", this._origin.x, this._eOrigin.x, 0, 0, 0, 0, 0, 1); 9415 pt = this.add(this._origin, "y", this._origin.y, this._eOrigin.y, 0, 0, 0, 0, 0, 1); 9416 } 9417 if (pt) { 9418 this._props.push("morphSVG"); 9419 pt.end = shape; 9420 pt.endProp = p; 9421 } 9422 } 9423 return _bonusValidated; 9424 }, 9425 render: function render(ratio, data) { 9426 var rawPath = data._rawPath, 9427 controlPT = data._controlPT, 9428 anchorPT = data._anchorPT, 9429 rnd = data._rnd, 9430 target = data._target, 9431 pt = data._pt, 9432 s, 9433 space, 9434 easeInOut, 9435 segment, 9436 l, 9437 angle, 9438 i, 9439 j, 9440 x, 9441 y, 9442 sin, 9443 cos, 9444 offset; 9445 while (pt) { 9446 pt.r(ratio, pt.d); 9447 pt = pt._next; 9448 } 9449 if (ratio === 1 && data._apply) { 9450 pt = data._pt; 9451 while (pt) { 9452 if (pt.end) { 9453 if (data._prop) { 9454 target[data._prop] = pt.end; 9455 } else { 9456 target.setAttribute(pt.endProp, pt.end); 9457 } 9458 } 9459 pt = pt._next; 9460 } 9461 } else if (rawPath) { 9462 while (anchorPT) { 9463 angle = anchorPT.sa + ratio * anchorPT.ca; 9464 l = anchorPT.sl + ratio * anchorPT.cl; 9465 anchorPT.t[anchorPT.i] = data._origin.x + _cos$1(angle) * l; 9466 anchorPT.t[anchorPT.i + 1] = data._origin.y + _sin$1(angle) * l; 9467 anchorPT = anchorPT._next; 9468 } 9469 easeInOut = ratio < 0.5 ? 2 * ratio * ratio : (4 - 2 * ratio) * ratio - 1; 9470 while (controlPT) { 9471 i = controlPT.i; 9472 segment = rawPath[controlPT.j]; 9473 offset = i + (i === segment.length - 4 ? 7 - segment.length : 5); 9474 angle = _atan2(segment[offset] - segment[i + 1], segment[offset - 1] - segment[i]); 9475 sin = _sin$1(angle); 9476 cos = _cos$1(angle); 9477 x = segment[i + 2]; 9478 y = segment[i + 3]; 9479 l = controlPT.l1s + easeInOut * controlPT.l1c; 9480 segment[i] = x - cos * l; 9481 segment[i + 1] = y - sin * l; 9482 l = controlPT.l2s + easeInOut * controlPT.l2c; 9483 segment[offset - 1] = x + cos * l; 9484 segment[offset] = y + sin * l; 9485 controlPT = controlPT._next; 9486 } 9487 target._gsRawPath = rawPath; 9488 if (data._apply) { 9489 s = ""; 9490 space = " "; 9491 for (j = 0; j < rawPath.length; j++) { 9492 segment = rawPath[j]; 9493 l = segment.length; 9494 s += "M" + (segment[0] * rnd | 0) / rnd + space + (segment[1] * rnd | 0) / rnd + " C"; 9495 for (i = 2; i < l; i++) { 9496 s += (segment[i] * rnd | 0) / rnd + space; 9497 } 9498 } 9499 if (data._prop) { 9500 target[data._prop] = s; 9501 } else { 9502 target.setAttribute("d", s); 9503 } 9504 } 9505 } 9506 data._render && rawPath && data._render.call(data._tween, rawPath, target); 9507 }, 9508 kill: function kill(property) { 9509 this._pt = this._rawPath = 0; 9510 }, 9511 getRawPath: getRawPath,
9512 stringToRawPath: stringToRawPath, 9513 rawPathToString: rawPathToString, 9514 normalizeStrings: function normalizeStrings(shape1, shape2, _ref) { 9515 var shapeIndex = _ref.shapeIndex, 9516 map = _ref.map; 9517 var result = [shape1, shape2]; 9518 _pathFilter(result, shapeIndex, map); 9519 return result; 9520 }, 9521 pathFilter: _pathFilter, 9522 pointsFilter: _pointsFilter, 9523 getTotalSize: _getTotalSize, 9524 equalizeSegmentQuantity: _equalizeSegmentQuantity, 9525 convertToPath: function convertToPath$1(targets, swap) { 9526 return _toArray(targets).map(function (target) { 9527 return convertToPath(target, swap !== false); 9528 }); 9529 }, 9530 defaultType: "linear", 9531 defaultUpdateTarget: true, 9532 defaultMap: "size" 9533 }; 9534 _getGSAP() && gsap.registerPlugin(MorphSVGPlugin); 9535 exports.MorphSVGPlugin = MorphSVGPlugin; 9536 exports.default = MorphSVGPlugin; 9537 Object.defineProperty(exports, '__esModule', { 9538 value: true 9539 }); 9540 }); 9541})(MorphSVGPlugin, MorphSVGPlugin.exports); 9542var MorphSVGPluginExports = MorphSVGPlugin.exports; 9543 9544let semiMaskOffset = null; 9545gsapExports.gsap.registerPlugin(ScrollTriggerExports.ScrollTrigger, ScrollSmootherExports.ScrollSmoother, ScrollToPluginExports.ScrollToPlugin); 9546ScrollSmootherExports.ScrollSmoother.create({ 9547 smooth: 1, 9548 // how long (in seconds) it takes to "catch up" to the native scroll position 9549 effects: true, 9550 // looks for data-speed and data-lag attributes on elements 9551 smoothTouch: 0.3, 9552 // much shorter smoothing time on touch devices (default is NO smoothing on touch devices) 9553 onUpdate: () => { 9554 fixedElements(); 9555 } 9556}); 9557if (document.querySelector('.sliding-masthead')) { 9558 triggerOpening(); 9559} 9560if (document.body.classList.contains('single-farlo_work')) { 9561 if (!document.body.classList.contains('postid-1090')) { 9562 projectPageAnimations(); 9563 } 9564} 9565const product_masks = document.querySelectorAll('.image-mask'); 9566const animationData = new Map(); 9567if (product_masks) { 9568 buildProductMasks(); 9569} 9570function buildProductMasks() { 9571 product_masks.forEach(async _productMask => { 9572 stopFlickering(_productMask); 9573 9574 // _productMask.height = calculateMaskHeight(); 9575 // _productMask.width = window.innerWidth; 9576 const maskCanvas = _productMask; 9577 const maskContext = maskCanvas.getContext('2d', { 9578 willReadFrequently: true 9579 }); 9580 const maskCanvasAspectRatio = maskCanvas.width / maskCanvas.height; 9581 maskContext.clearRect(0, 0, maskCanvas.width, maskCanvas.height); 9582 const matte = document.createElement('img'); 9583 matte.src = _productMask.dataset.img; 9584 const offscreenCanvas = new OffscreenCanvas(maskCanvas.width, maskCanvas.height); 9585 const offscreenContext = offscreenCanvas.getContext('2d'); 9586 const mask = document.createElement('img'); 9587 mask.src = URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(document.querySelector('#svg-mask-' + _productMask.dataset.id + ' > svg'))], { 9588 type: 'image/svg+xml' 9589 })); 9590 await Promise.all([new Promise(resolve => mask.addEventListener('load', resolve, { 9591 once: true 9592 })), matte.complete || new Promise(resolve => matte.addEventListener('load', resolve, { 9593 once: true 9594 }))]); 9595 const matteAspectRatio = matte.naturalWidth / matte.naturalHeight, 9596 maskAspectRatio = mask.naturalWidth / mask.naturalHeight; 9597 let width, height, top, left; 9598 [width, height] = maskCanvasAspectRatio <= matteAspectRatio ? [maskCanvas.height * matteAspectRatio, maskCanvas.height] : [maskCanvas.width, maskCanvas.width / matteAspectRatio]; 9599 [top, left] = [(maskCanvas.height - height) / 2, (maskCanvas.width - width) / 2]; 9600 maskContext.drawImage(matte, 0, 0, matte.naturalWidth, matte.naturalHeight, left, top, width, height); 9601 [width, height] = maskCanvasAspectRatio <= maskAspectRatio ? [maskCanvas.width, maskCanvas.width / maskAspectRatio] : [maskCanvas.height * maskAspectRatio, maskCanvas.height]; 9602 [top, left] = [(maskCanvas.height - height) / 2, (maskCanvas.width - width) / 2]; 9603 maskContext.globalCompositeOperation = 'destination-in'; 9604 offscreenContext.drawImage(mask, 0, 0, _productMask.width, _productMask.height); 9605 applyGaussianBlur(offscreenCanvas, offscreenContext, 5); 9606 maskContext.drawImage(offscreenCanvas, 0, 0, _productMask.width, _productMask.height); 9607 if (_productMask.dataset.colour) { 9608 const imageData = maskContext.getImageData(0, 0, _productMask.width, _productMask.height); 9609 const filteredImageData = rgbFilter(imageData, _productMask.dataset.colour); 9610 maskContext.putImageData(filteredImageData, 0, 0); 9611 } 9612 if (!animationData.get(maskContext.canvas)) { 9613 animationData.set(_productMask, -1); 9614 } 9615 if (_productMask.dataset.effect == 'glitch') { 9616 const animationId = startFlickering(maskContext, _productMask.width, _productMask.height); 9617 animationData.set(_productMask, animationId); 9618 } 9619 }); 9620} 9621function stopFlickering(_productMask) { 9622 const animationId = animationData.get(_productMask); 9623 if (animationId) { 9624 cancelAnimationFrame(animationId); 9625 animationData.delete(_productMask); 9626 } 9627} 9628function getRandomOffset() { 9629 return parseInt(Math.random() * 200) - 100; 9630} 9631function rgbSplitEffect(context, imageData, offsets) { 9632 const updatedImageData = rgbSplit(imageData, offsets); 9633 context.putImageData(updatedImageData, 0, 0); 9634} 9635function resetEffect(context, imageData) { 9636 const updatedImageData = rgbSplit(imageData, { 9637 rOffset: 0, 9638 gOffset: 0, 9639 bOffset: 0 9640 }); 9641 context.putImageData(updatedImageData, 0, 0); 9642} 9643function flickerEffect(context, width, height) { 9644 const imageData = context.getImageData(0, 0, width, height); 9645 const offsets = { 9646 rOffset: getRandomOffset(), 9647 gOffset: getRandomOffset(), 9648 bOffset: getRandomOffset() 9649 }; 9650 rgbSplitEffect(context, imageData, offsets); 9651 setTimeout(() => { 9652 resetEffect(context, imageData); 9653 }, 50); 9654} 9655function startFlickering(maskContext, width, height) { 9656 function flickerLoop(timestamp) { 9657 if (!lastTimestamp) { 9658 lastTimestamp = timestamp; 9659 }
9660 const elapsed = timestamp - lastTimestamp; 9661 if (elapsed > 3000 + Math.random() * 3000) { 9662 flickerEffect(maskContext, width, height); 9663 9664 // Occasionally flicker twice in rapid succession 9665 if (Math.random() < 0.2) { 9666 setTimeout(() => flickerEffect(maskContext, width, height), 100); 9667 } 9668 lastTimestamp = timestamp; 9669 } 9670 const animationId = animationData.get(maskContext.canvas); 9671 if (animationId) { 9672 if (animationId === -1) { 9673 const thisAnimation = requestAnimationFrame(flickerLoop); 9674 animationData.set(maskContext.canvas, thisAnimation); 9675 } else { 9676 requestAnimationFrame(flickerLoop); 9677 } 9678 } else { 9679 // If animationId is not present, the flickering for this mask has been stopped 9680 lastTimestamp = null; 9681 } 9682 } 9683 let lastTimestamp = null; 9684 flickerLoop(); 9685 return animationData.get(maskContext.canvas); 9686} 9687function hexToRgb(hex) { 9688 // Remove the hash (#) if present 9689 hex = hex.replace(/^#/, ''); 9690 9691 // Parse the hex value into separate RGB components 9692 const bigint = parseInt(hex, 16); 9693 const r = bigint >> 16 & 255; 9694 const g = bigint >> 8 & 255; 9695 const b = bigint & 255; 9696 9697 // Return an object with RGB values 9698 return { 9699 r, 9700 g, 9701 b 9702 }; 9703} 9704function rgbFilter(imageData, hex) { 9705 // Convert the hex color to RGB 9706 const rgbColor = hexToRgb(hex); 9707 const originalArray = imageData.data; 9708 const newArray = new Uint8ClampedArray(originalArray); 9709 9710 // Apply the hex color blending filter 9711 for (let i = 0; i < originalArray.length; i += 4) { 9712 // Skip transparent pixels 9713 if (newArray[i + 3] !== 0) { 9714 // Blend the colors 9715 newArray[i] = overlayBlend(originalArray[i], rgbColor.r); // ð´ 9716 newArray[i + 1] = overlayBlend(originalArray[i + 1], rgbColor.g); // ð¢ 9717 newArray[i + 2] = overlayBlend(originalArray[i + 2], rgbColor.b); // ðµ 9718 } 9719 } 9720 // return a new ImageData object 9721 return new ImageData(newArray, imageData.width, imageData.height); 9722} 9723function overlayBlend(base, blend) { 9724 // Overlay blend mode calculation 9725 return base < 128 ? 2 * base * blend / 255 : 255 - 2 * (255 - base) * (255 - blend) / 255; 9726} 9727function rgbSplit(imageData, options) { 9728 // destructure the offset values from options, default to 0 9729 const { 9730 rOffset = 0, 9731 gOffset = 0, 9732 bOffset = 0 9733 } = options; 9734 // clone the pixel array from original imageData 9735 const originalArray = imageData.data; 9736 const newArray = new Uint8ClampedArray(originalArray); 9737 // loop through every pixel and assign values to the offseted position 9738 for (let i = 0; i < originalArray.length; i += 4) { 9739 newArray[i + 0 + rOffset * 4] = originalArray[i + 0]; // ð´ 9740 newArray[i + 1 + gOffset * 4] = originalArray[i + 1]; // ð¢ 9741 newArray[i + 2 + bOffset * 4] = originalArray[i + 2]; // ðµ 9742 } 9743 // return a new ImageData object 9744 return new ImageData(newArray, imageData.width, imageData.height); 9745} 9746function applyGaussianBlur(canvas, context, radius) { 9747 context.filter = 'blur(' + radius + 'px)'; 9748 context.drawImage(canvas, 0, 0); 9749 context.filter = 'none'; 9750} 9751function projectGalleries(_elem, columns = 2) { 9752 // Target the gallery images 9753 const galleryImages = document.querySelectorAll(_elem + ' figure'); 9754 const images = []; 9755 galleryImages.forEach((image, index) => { 9756 const halfWidth = window.innerWidth / columns / 2; 9757 let moveDirection; 9758 9759 // Determine the row based on the index and the number of columns 9760 const row = Math.floor(index / columns); 9761 // Alternate the direction for the entire row 9762 // Rows with an even number (including the first row) move in one direction 9763 // Rows with an odd number move in the opposite direction 9764 if (row % 2 === 0) { 9765 moveDirection = halfWidth; // Move right for even rows 9766 } else { 9767 moveDirection = -halfWidth; // Move left for odd rows 9768 } 9769 let nextImage = galleryImages[0]; 9770 if (galleryImages[index + 1]) { 9771 nextImage = galleryImages[index + 1]; 9772 } 9773 images.push(nextImage.querySelector('img').src); 9774 const tl = gsapExports.gsap.timeline(); 9775 tl.from(image, { 9776 x: moveDirection, 9777 duration: 5, 9778 ease: 'none' 9779 }).to(image, { 9780 x: -moveDirection, 9781 duration: 5, 9782 ease: 'none' 9783 }); 9784 ScrollTriggerExports.ScrollTrigger.create({ 9785 trigger: image, 9786 animation: tl, 9787 start: 'top bottom', 9788 end: 'bottom top', 9789 scrub: 1 9790 }); 9791 }); 9792 let cssStr = ''; 9793 for (let i = 0; i < images.length; i++) { 9794 cssStr += `${_elem} figure:nth-child(${i + 1}):before { background-image:url(${images[i]}); }`; 9795 } 9796 cssStr += `${_elem} figure:last-child:after { background-image:url(${images.pop()}); }`;
9797 const css = document.createElement('style'); 9798 css.innerHTML = cssStr; 9799 document.body.appendChild(css); 9800 9801 // Adjust gallery grid based on columns 9802 document.querySelectorAll(_elem).forEach(gallery => { 9803 gallery.style.setProperty('--columns', columns); 9804 }); 9805} 9806if (document.querySelector('.site-project__gallery')) { 9807 projectGalleries('.site-project__gallery'); 9808} 9809if (document.querySelector('.alternating-gallery')) { 9810 projectGalleries('.alternating-gallery > .wp-block-gallery'); 9811} 9812if (document.querySelector('.site-partner-logos--full-width-gallery')) { 9813 projectGalleries('.site-partner-logos--full-width-gallery-inner', 3); 9814} 9815function projectsNavigation() { 9816 const nav = document.querySelector('.site-projects__navigation'); 9817 const navHeight = nav.offsetHeight; // Capture the nav height for potential adjustments 9818 9819 // Select all navigation buttons 9820 const navButtons = nav.querySelectorAll('.site-projects__navigation-list-item-link'); 9821 9822 // Iterate over each button to add a click event listener 9823 navButtons.forEach(button => { 9824 button.addEventListener('click', function () { 9825 // Retrieve the section ID from the button's data attribute 9826 const sectionId = this.getAttribute('data-section-id'); 9827 // Select the target section using the section ID 9828 const targetSection = document.getElementById(sectionId); 9829 if (targetSection) { 9830 gsapExports.gsap.to(window, { 9831 scrollTo: { 9832 y: targetSection, 9833 offsetY: navHeight 9834 }, 9835 duration: 1 9836 }); 9837 } 9838 }); 9839 }); 9840} 9841function scrollToSection(hash) { 9842 if (hash) { 9843 const section = document.getElementById(hash.split('#')[1]); 9844 if (section) { 9845 gsapExports.gsap.to(window, { 9846 duration: 2, 9847 scrollTo: { 9848 y: section, 9849 offsetY: document.querySelector('.site-header').offsetHeight 9850 } 9851 }); 9852 } 9853 } 9854} 9855if (window.location && typeof window.location.hash !== 'undefined') { 9856 scrollToSection(window.location.hash); 9857} 9858document.querySelectorAll('a').forEach(_a => { 9859 if (_a.href) { 9860 const url = new URL(_a.href); 9861 if (url.pathname === location.pathname && url.hash) { 9862 const target = document.querySelector(url.hash); 9863 if (target) { 9864 _a.addEventListener('click', () => { 9865 gsapExports.gsap.to(window, { 9866 scrollTo: { 9867 y: target 9868 }, 9869 duration: 1 9870 }); 9871 }); 9872 } 9873 } 9874 } 9875}); 9876if (document.querySelector('.site-projects__navigation')) { 9877 projectsNavigation(); 9878} 9879function triggerOpening() { 9880 const panels = gsapExports.gsap.utils.toArray('.sliding-masthead__section-content'); 9881 let horizontalScrollWidth = 0; 9882 panels.forEach(panel => { 9883 horizontalScrollWidth += panel.offsetWidth; 9884 }); 9885 const imagePanels = gsapExports.gsap.utils.toArray('.sliding-masthead__section'); 9886 gsapExports.gsap.timeline({ 9887 scrollTrigger: { 9888 trigger: '.sliding-masthead', 9889 start: 'top top', 9890 end: () => `+=${horizontalScrollWidth} top`, 9891 scrub: true, 9892 pin: true 9893 } 9894 }).add('sliders').to('.sliding-masthead__cover', { 9895 duration: 8, 9896 x: () => -(horizontalScrollWidth - panels[0].offsetWidth * 2), 9897 ease: 'none' 9898 }, 'sliders').to(panels, { 9899 duration: 8, 9900 x: () => -(horizontalScrollWidth - panels[0].offsetWidth), 9901 ease: 'none' 9902 }, 'sliders').to(imagePanels, { 9903 duration: 2, 9904 opacity: () => 0, 9905 ease: 'none', 9906 stagger: { 9907 each: 4, 9908 from: 'start' 9909 } 9910 }, 'sliders'); 9911} 9912if (document.querySelector('.current-show')) { 9913 const panels = gsapExports.gsap.utils.toArray('.current-show'); 9914 panels.map(panel => ScrollTriggerExports.ScrollTrigger.create({ 9915 trigger: panel, 9916 start: 'top top' 9917 })); 9918 panels.forEach((panel, i) => { 9919 const tween = gsapExports.gsap.timeline(); 9920 tween.add('start'); 9921 if (i > 0) { 9922 tween.from(panel.querySelector('.image-mask'), { 9923 opacity: 0, 9924 duration: 1, 9925 force3D: true 9926 }, 'start'); 9927 tween.from(panel.querySelector('.current-show__info'), { 9928 opacity: 0, 9929 y: 200, 9930 duration: 1, 9931 force3D: true 9932 }, 'start'); 9933 } 9934 tween.to(panel.querySelector('.image-mask'), { 9935 opacity: 0.5, 9936 duration: 1, 9937 force3D: true 9938 }, 'start'); 9939 tween.add('end'); 9940 if (i < panels.length - 1) { 9941 tween.to(panel.querySelector('.image-mask'), { 9942 opacity: 0, 9943 duration: 1, 9944 force3D: true 9945 }, 'end');
9946 tween.to(panel.querySelector('.current-show__info'), { 9947 opacity: 0, 9948 y: -200, 9949 duration: 1, 9950 force3D: true 9951 }, 'end'); 9952 } 9953 ScrollTriggerExports.ScrollTrigger.create({ 9954 trigger: panel, 9955 start: () => panel.offsetHeight < window.innerHeight ? 'top top' : 'bottom bottom', 9956 animation: tween, 9957 scrub: true, 9958 pin: true, 9959 pinSpacing: false 9960 }); 9961 }); 9962} 9963function fixedElements() { 9964 if (document.querySelector('.site-projects__navigation')) { 9965 document.querySelector('.site-farlo-site-projects'); 9966 } 9967 if (document.querySelector('#projects-timeline')) ; 9968 9969 // Homepage Inline Current Shows 9970 if (document.querySelector('.current-show')) { 9971 const container = document.querySelector('.site-farlo-site-projects'); 9972 semiMaskOffset = container.getBoundingClientRect().top * -1; 9973 if (container.getBoundingClientRect().top < 0 && semiMaskOffset <= container.offsetHeight) { 9974 document.documentElement.style.setProperty('--current-shows-fixed-mask-offset', semiMaskOffset + window.innerHeight * 0.5 + 'px'); 9975 } 9976 } 9977} 9978function projectPageAnimations() { 9979 const panels = gsapExports.gsap.utils.toArray('.primary-section'); 9980 // const scrollTimeline = gsap 9981 // .timeline({ 9982 // scrollTrigger: { 9983 // trigger: '.primary-section-container', 9984 // start: 'top top', 9985 // end: 'bottom bottom', 9986 // // scrub: true, 9987 // // pin: true, 9988 // } 9989 // }) 9990 panels.forEach((panel, i) => { 9991 if (panel.id !== 'book' && panel.id !== 'faqs' && panel.id !== 'booking-terms') { 9992 gsapExports.gsap.timeline(); 9993 const ps = gsapExports.gsap.utils.toArray('*', panel); 9994 ps.forEach(_p => { 9995 _p.classList.add('fade-in-up'); 9996 }); 9997 ScrollTriggerExports.ScrollTrigger.batch(ps, { 9998 batchMax: 1, 9999 // maximum batch size (targets) 10000 onEnter: batch => gsapExports.gsap.to(batch, { 10001 opacity: 1, 10002 y: 0, 10003 stagger: 1, 10004 overwrite: true 10005 }) 10006 }); 10007 } 10008 }); 10009 const h1 = document.querySelector('h1'); 10010 if (h1) { 10011 const arr = h1.textContent.split(''); 10012 const spans = []; 10013 arr.forEach(_c => { 10014 if (_c == ' ') { 10015 spans.push("</span><span class='page-title-letter page-title-space'> </span><span class='page-title-word'>"); 10016 } else { 10017 spans.push("<span class='page-title-letter'>" + _c + '</span>'); 10018 } 10019 }); 10020 h1.innerHTML = "<span class='page-title-letters'><span class='page-title-word'>" + spans.join('') + '</span></span>'; 10021 } 10022 const letters = gsapExports.gsap.utils.toArray('.page-title-letter'); 10023 gsapExports.gsap.timeline({ 10024 scrollTrigger: { 10025 trigger: '#project-header', 10026 start: 'top bottom' 10027 } 10028 }).to(letters, { 10029 duration: 0.3, 10030 transform: 'scale(1, 1)', 10031 ease: 'none', 10032 stagger: { 10033 each: 0.05, 10034 from: 'start' 10035 } 10036 }); 10037} 10038function projectCardIntro() { 10039 const cards = gsapExports.gsap.utils.toArray('.project-item.archive-project'); 10040 cards.forEach(_card => { 10041 _card.classList.add('fade-in-up'); 10042 }); 10043 ScrollTriggerExports.ScrollTrigger.batch(cards, { 10044 batchMax: 2, 10045 onEnter: batch => gsapExports.gsap.to(batch, { 10046 opacity: 1, 10047 y: 0, 10048 ease: 'none', 10049 duration: 0.3, 10050 stagger: { 10051 each: 0.3, 10052 from: 'start' 10053 } 10054 }) 10055 }); 10056} 10057if (document.querySelector('#projects-container, .layout-card')) { 10058 projectCardIntro(); 10059} 10060function fading_partner_gallery() { 10061 const cards = gsapExports.gsap.utils.toArray('.site-partner-logo__gallery-image'); 10062 ScrollTriggerExports.ScrollTrigger.batch(cards, { 10063 batchMax: 2, 10064 onEnter: batch => gsapExports.gsap.to(batch, { 10065 opacity: 1, 10066 y: 0, 10067 ease: 'none', 10068 duration: 0.3, 10069 stagger: { 10070 each: 0.3, 10071 from: 'start' 10072 } 10073 }) 10074 }); 10075} 10076function fadingGallery() { 10077 document.querySelectorAll('.fading-gallery').forEach(_gallery => { 10078 const images = gsapExports.gsap.utils.toArray('.wp-block-image', _gallery); 10079 images.forEach(_image => { 10080 _image.classList.add('fade-in-up'); 10081 }); 10082 ScrollTriggerExports.ScrollTrigger.batch(images, { 10083 batchMax: 2, 10084 onEnter: batch => gsapExports.gsap.to(batch, { 10085 opacity: 1, 10086 y: 0, 10087 ease: 'none', 10088 duration: 0.3, 10089 stagger: { 10090 each: 0.3, 10091 from: 'start' 10092 } 10093 }) 10094 }); 10095 }); 10096} 10097if (document.querySelector('.fading-gallery')) { 10098 fadingGallery(); 10099} 10100if (document.querySelector('.site-partner-logos--fading-gallery')) { 10101 fading_partner_gallery(); 10102} 10103function vr_feature() { 10104 var tl = gsapExports.gsap.timeline(), 10105 moon1 = document.getElementById('moon-start'); 10106 tl.add('start').to(moon1, { 10107 morphSVG: '#moon-end', 10108 duration: 10 10109 // fill: "#3e3e3e", 10110 }, 'start').to('.vr-feature__moon-image img', { 10111 filter: 'drop-shadow(0px 0px 40vw white) drop-shadow(0px 0px 80px white)', 10112 duration: 10 10113 }, 'start').to('.vr-feature__castle-element', { 10114 opacity: 1, 10115 duration: 5 10116 }, 'start+=5').to(moon1, { 10117 fill: '#2e2e2e', 10118 duration: 8 10119 }, 'start+=2').add('end').to('.vr-feature__lighting', { 10120 transform: 'scaleX(1)', 10121 duration: 6, 10122 opacity: 1, 10123 ease: 'none' 10124 }, 'end-=7').to(moon1, { 10125 opacity: 0, 10126 duration: 3 10127 }, 'end-=3').to('.vr-feature__ftl', { 10128 opacity: 1, 10129 filter: 'blur(0px)', 10130 duration: 3 10131 }, 'end-=7'); 10132} 10133if (document.querySelector('.lander-feature-static')) { 10134 gsapExports.gsap.registerPlugin(ScrollTriggerExports.ScrollTrigger); 10135 ScrollTriggerExports.ScrollTrigger.create({ 10136 trigger: '.lander-feature-static', 10137 start: 'top top', 10138 end: () => document.body.scrollHeight + 'px', 10139 pin: '.lander-feature-media', 10140 pinSpacing: true 10141 }); 10142} 10143if (document.querySelector('.vr-feature')) { 10144 gsapExports.gsap.registerPlugin(MorphSVGPluginExports.MorphSVGPlugin); 10145 MorphSVGPluginExports.MorphSVGPlugin.convertToPath('circle'); 10146 vr_feature(); 10147} 10148if (document.querySelector('#book.primary-section')) { 10149 gsapExports.gsap.to('.site-project__book-tickets', { 10150 opacity: 0, 10151 duration: 0.3, 10152 scrollTrigger: { 10153 trigger: '#book', 10154 toggleActions: 'play none none reset' 10155 } 10156 }); 10157} 10158(function () { 10159 var BREAKPOINT = 979; 10160 function isMobile() { 10161 return window.innerWidth <= BREAKPOINT; 10162 } 10163 function initMobileSubmenus() { 10164 var parents = document.querySelectorAll('.site-navigation .menu-item-has-children');
10165 parents.forEach(function (item) { 10166 if (item.querySelector('.nav-arrow')) return; 10167 var topLink = item.querySelector(':scope > a'); 10168 var subMenu = item.querySelector(':scope > .sub-menu'); 10169 if (!topLink || !subMenu) return; 10170 var arrow = document.createElement('button'); 10171 arrow.className = 'nav-arrow'; 10172 arrow.setAttribute('aria-label', 'Toggle submenu'); 10173 arrow.setAttribute('aria-expanded', 'false'); 10174 arrow.innerHTML = '+'; 10175 topLink.insertAdjacentElement('afterend', arrow); 10176 arrow.addEventListener('click', function (e) { 10177 e.stopPropagation(); 10178 if (!isMobile()) return; 10179 var isOpen = item.classList.contains('is-open'); 10180 item.parentElement.querySelectorAll(':scope > .menu-item-has-children.is-open').forEach(function (sib) { 10181 if (sib !== item) { 10182 sib.classList.remove('is-open'); 10183 var sibArrow = sib.querySelector('.nav-arrow'); 10184 if (sibArrow) { 10185 sibArrow.setAttribute('aria-expanded', 'false'); 10186 sibArrow.innerHTML = '+'; 10187 } 10188 } 10189 }); 10190 item.classList.toggle('is-open', !isOpen); 10191 arrow.setAttribute('aria-expanded', String(!isOpen)); 10192 arrow.innerHTML = !isOpen ? 'â' : '+'; 10193 }); 10194 }); 10195 } 10196 window.addEventListener('resize', function () { 10197 if (!isMobile()) { 10198 document.querySelectorAll('.menu-item-has-children.is-open').forEach(function (item) { 10199 item.classList.remove('is-open'); 10200 var arrow = item.querySelector('.nav-arrow'); 10201 if (arrow) { 10202 arrow.setAttribute('aria-expanded', 'false'); 10203 arrow.innerHTML = '+'; 10204 } 10205 }); 10206 } 10207 }); 10208 if (document.readyState === 'loading') { 10209 document.addEventListener('DOMContentLoaded', initMobileSubmenus); 10210 } else { 10211 initMobileSubmenus(); 10212 } 10213})(); 10214//# sourceMappingURL=app.js.map
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.