1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3 | typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4 | (global = global || self, factory(global.window = global.window || {}));
|
5 | }(this, (function (exports) { 'use strict';
|
6 |
|
7 | function _inheritsLoose(subClass, superClass) {
|
8 | subClass.prototype = Object.create(superClass.prototype);
|
9 | subClass.prototype.constructor = subClass;
|
10 | subClass.__proto__ = superClass;
|
11 | }
|
12 |
|
13 | function _assertThisInitialized(self) {
|
14 | if (self === void 0) {
|
15 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
16 | }
|
17 |
|
18 | return self;
|
19 | }
|
20 |
|
21 | |
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | var _config = {
|
31 | autoSleep: 120,
|
32 | force3D: "auto",
|
33 | nullTargetWarn: 1,
|
34 | units: {
|
35 | lineHeight: ""
|
36 | }
|
37 | },
|
38 | _defaults = {
|
39 | duration: .5,
|
40 | overwrite: false,
|
41 | delay: 0
|
42 | },
|
43 | _suppressOverwrites,
|
44 | _bigNum = 1e8,
|
45 | _tinyNum = 1 / _bigNum,
|
46 | _2PI = Math.PI * 2,
|
47 | _HALF_PI = _2PI / 4,
|
48 | _gsID = 0,
|
49 | _sqrt = Math.sqrt,
|
50 | _cos = Math.cos,
|
51 | _sin = Math.sin,
|
52 | _isString = function _isString(value) {
|
53 | return typeof value === "string";
|
54 | },
|
55 | _isFunction = function _isFunction(value) {
|
56 | return typeof value === "function";
|
57 | },
|
58 | _isNumber = function _isNumber(value) {
|
59 | return typeof value === "number";
|
60 | },
|
61 | _isUndefined = function _isUndefined(value) {
|
62 | return typeof value === "undefined";
|
63 | },
|
64 | _isObject = function _isObject(value) {
|
65 | return typeof value === "object";
|
66 | },
|
67 | _isNotFalse = function _isNotFalse(value) {
|
68 | return value !== false;
|
69 | },
|
70 | _windowExists = function _windowExists() {
|
71 | return typeof window !== "undefined";
|
72 | },
|
73 | _isFuncOrString = function _isFuncOrString(value) {
|
74 | return _isFunction(value) || _isString(value);
|
75 | },
|
76 | _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function () {},
|
77 | _isArray = Array.isArray,
|
78 | _strictNumExp = /(?:-?\.?\d|\.)+/gi,
|
79 | _numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,
|
80 | _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g,
|
81 | _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,
|
82 | _relExp = /[+-]=-?[.\d]+/,
|
83 | _delimitedValueExp = /[^,'"\[\]\s]+/gi,
|
84 | _unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,
|
85 | _globalTimeline,
|
86 | _win,
|
87 | _coreInitted,
|
88 | _doc,
|
89 | _globals = {},
|
90 | _installScope = {},
|
91 | _coreReady,
|
92 | _install = function _install(scope) {
|
93 | return (_installScope = _merge(scope, _globals)) && gsap;
|
94 | },
|
95 | _missingPlugin = function _missingPlugin(property, value) {
|
96 | return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()");
|
97 | },
|
98 | _warn = function _warn(message, suppress) {
|
99 | return !suppress && console.warn(message);
|
100 | },
|
101 | _addGlobal = function _addGlobal(name, obj) {
|
102 | return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals;
|
103 | },
|
104 | _emptyFunc = function _emptyFunc() {
|
105 | return 0;
|
106 | },
|
107 | _reservedProps = {},
|
108 | _lazyTweens = [],
|
109 | _lazyLookup = {},
|
110 | _lastRenderedFrame,
|
111 | _plugins = {},
|
112 | _effects = {},
|
113 | _nextGCFrame = 30,
|
114 | _harnessPlugins = [],
|
115 | _callbackNames = "",
|
116 | _harness = function _harness(targets) {
|
117 | var target = targets[0],
|
118 | harnessPlugin,
|
119 | i;
|
120 | _isObject(target) || _isFunction(target) || (targets = [targets]);
|
121 |
|
122 | if (!(harnessPlugin = (target._gsap || {}).harness)) {
|
123 | i = _harnessPlugins.length;
|
124 |
|
125 | while (i-- && !_harnessPlugins[i].targetTest(target)) {}
|
126 |
|
127 | harnessPlugin = _harnessPlugins[i];
|
128 | }
|
129 |
|
130 | i = targets.length;
|
131 |
|
132 | while (i--) {
|
133 | targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1);
|
134 | }
|
135 |
|
136 | return targets;
|
137 | },
|
138 | _getCache = function _getCache(target) {
|
139 | return target._gsap || _harness(toArray(target))[0]._gsap;
|
140 | },
|
141 | _getProperty = function _getProperty(target, property, v) {
|
142 | return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v;
|
143 | },
|
144 | _forEachName = function _forEachName(names, func) {
|
145 | return (names = names.split(",")).forEach(func) || names;
|
146 | },
|
147 | _round = function _round(value) {
|
148 | return Math.round(value * 100000) / 100000 || 0;
|
149 | },
|
150 | _roundPrecise = function _roundPrecise(value) {
|
151 | return Math.round(value * 10000000) / 10000000 || 0;
|
152 | },
|
153 | _parseRelative = function _parseRelative(start, value) {
|
154 | var operator = value.charAt(0),
|
155 | end = parseFloat(value.substr(2));
|
156 | start = parseFloat(start);
|
157 | return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end;
|
158 | },
|
159 | _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) {
|
160 | var l = toFind.length,
|
161 | i = 0;
|
162 |
|
163 | for (; toSearch.indexOf(toFind[i]) < 0 && ++i < l;) {}
|
164 |
|
165 | return i < l;
|
166 | },
|
167 | _lazyRender = function _lazyRender() {
|
168 | var l = _lazyTweens.length,
|
169 | a = _lazyTweens.slice(0),
|
170 | i,
|
171 | tween;
|
172 |
|
173 | _lazyLookup = {};
|
174 | _lazyTweens.length = 0;
|
175 |
|
176 | for (i = 0; i < l; i++) {
|
177 | tween = a[i];
|
178 | tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0);
|
179 | }
|
180 | },
|
181 | _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) {
|
182 | _lazyTweens.length && _lazyRender();
|
183 | animation.render(time, suppressEvents, force);
|
184 | _lazyTweens.length && _lazyRender();
|
185 | },
|
186 | _numericIfPossible = function _numericIfPossible(value) {
|
187 | var n = parseFloat(value);
|
188 | return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value;
|
189 | },
|
190 | _passThrough = function _passThrough(p) {
|
191 | return p;
|
192 | },
|
193 | _setDefaults = function _setDefaults(obj, defaults) {
|
194 | for (var p in defaults) {
|
195 | p in obj || (obj[p] = defaults[p]);
|
196 | }
|
197 |
|
198 | return obj;
|
199 | },
|
200 | _setKeyframeDefaults = function _setKeyframeDefaults(excludeDuration) {
|
201 | return function (obj, defaults) {
|
202 | for (var p in defaults) {
|
203 | p in obj || p === "duration" && excludeDuration || p === "ease" || (obj[p] = defaults[p]);
|
204 | }
|
205 | };
|
206 | },
|
207 | _merge = function _merge(base, toMerge) {
|
208 | for (var p in toMerge) {
|
209 | base[p] = toMerge[p];
|
210 | }
|
211 |
|
212 | return base;
|
213 | },
|
214 | _mergeDeep = function _mergeDeep(base, toMerge) {
|
215 | for (var p in toMerge) {
|
216 | p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]);
|
217 | }
|
218 |
|
219 | return base;
|
220 | },
|
221 | _copyExcluding = function _copyExcluding(obj, excluding) {
|
222 | var copy = {},
|
223 | p;
|
224 |
|
225 | for (p in obj) {
|
226 | p in excluding || (copy[p] = obj[p]);
|
227 | }
|
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 |
|
235 | if (_isNotFalse(vars.inherit)) {
|
236 | while (parent) {
|
237 | func(vars, parent.vars.defaults);
|
238 | parent = parent.parent || parent._dp;
|
239 | }
|
240 | }
|
241 |
|
242 | return vars;
|
243 | },
|
244 | _arraysMatch = function _arraysMatch(a1, a2) {
|
245 | var i = a1.length,
|
246 | match = i === a2.length;
|
247 |
|
248 | while (match && i-- && a1[i] === a2[i]) {}
|
249 |
|
250 | return i < 0;
|
251 | },
|
252 | _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) {
|
253 | if (firstProp === void 0) {
|
254 | firstProp = "_first";
|
255 | }
|
256 |
|
257 | if (lastProp === void 0) {
|
258 | lastProp = "_last";
|
259 | }
|
260 |
|
261 | var prev = parent[lastProp],
|
262 | t;
|
263 |
|
264 | if (sortBy) {
|
265 | t = child[sortBy];
|
266 |
|
267 | while (prev && prev[sortBy] > t) {
|
268 | prev = prev._prev;
|
269 | }
|
270 | }
|
271 |
|
272 | if (prev) {
|
273 | child._next = prev._next;
|
274 | prev._next = child;
|
275 | } else {
|
276 | child._next = parent[firstProp];
|
277 | parent[firstProp] = child;
|
278 | }
|
279 |
|
280 | if (child._next) {
|
281 | child._next._prev = child;
|
282 | } else {
|
283 | parent[lastProp] = child;
|
284 | }
|
285 |
|
286 | child._prev = prev;
|
287 | child.parent = child._dp = parent;
|
288 | return child;
|
289 | },
|
290 | _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) {
|
291 | if (firstProp === void 0) {
|
292 | firstProp = "_first";
|
293 | }
|
294 |
|
295 | if (lastProp === void 0) {
|
296 | lastProp = "_last";
|
297 | }
|
298 |
|
299 | var prev = child._prev,
|
300 | next = child._next;
|
301 |
|
302 | if (prev) {
|
303 | prev._next = next;
|
304 | } else if (parent[firstProp] === child) {
|
305 | parent[firstProp] = next;
|
306 | }
|
307 |
|
308 | if (next) {
|
309 | next._prev = prev;
|
310 | } else if (parent[lastProp] === child) {
|
311 | parent[lastProp] = prev;
|
312 | }
|
313 |
|
314 | child._next = child._prev = child.parent = null;
|
315 | },
|
316 | _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) {
|
317 | child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove(child);
|
318 | child._act = 0;
|
319 | },
|
320 | _uncache = function _uncache(animation, child) {
|
321 | if (animation && (!child || child._end > animation._dur || child._start < 0)) {
|
322 | var a = animation;
|
323 |
|
324 | while (a) {
|
325 | a._dirty = 1;
|
326 | a = a.parent;
|
327 | }
|
328 | }
|
329 |
|
330 | return animation;
|
331 | },
|
332 | _recacheAncestors = function _recacheAncestors(animation) {
|
333 | var parent = animation.parent;
|
334 |
|
335 | while (parent && parent.parent) {
|
336 | parent._dirty = 1;
|
337 | parent.totalDuration();
|
338 | parent = parent.parent;
|
339 | }
|
340 |
|
341 | return animation;
|
342 | },
|
343 | _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) {
|
344 | return !animation || animation._ts && _hasNoPausedAncestors(animation.parent);
|
345 | },
|
346 | _elapsedCycleDuration = function _elapsedCycleDuration(animation) {
|
347 | return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0;
|
348 | },
|
349 | _animationCycle = function _animationCycle(tTime, cycleDuration) {
|
350 | var whole = Math.floor(tTime /= cycleDuration);
|
351 | return tTime && whole === tTime ? whole - 1 : whole;
|
352 | },
|
353 | _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) {
|
354 | return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur);
|
355 | },
|
356 | _setEnd = function _setEnd(animation) {
|
357 | return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0));
|
358 | },
|
359 | _alignPlayhead = function _alignPlayhead(animation, totalTime) {
|
360 | var parent = animation._dp;
|
361 |
|
362 | if (parent && parent.smoothChildTiming && animation._ts) {
|
363 | animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts));
|
364 |
|
365 | _setEnd(animation);
|
366 |
|
367 | parent._dirty || _uncache(parent, animation);
|
368 | }
|
369 |
|
370 | return animation;
|
371 | },
|
372 | _postAddChecks = function _postAddChecks(timeline, child) {
|
373 | var t;
|
374 |
|
375 | if (child._time || child._initted && !child._dur) {
|
376 | t = _parentToChildTotalTime(timeline.rawTime(), child);
|
377 |
|
378 | if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) {
|
379 | child.render(t, true);
|
380 | }
|
381 | }
|
382 |
|
383 | if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) {
|
384 | if (timeline._dur < timeline.duration()) {
|
385 | t = timeline;
|
386 |
|
387 | while (t._dp) {
|
388 | t.rawTime() >= 0 && t.totalTime(t._tTime);
|
389 | t = t._dp;
|
390 | }
|
391 | }
|
392 |
|
393 | timeline._zTime = -_tinyNum;
|
394 | }
|
395 | },
|
396 | _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) {
|
397 | child.parent && _removeFromParent(child);
|
398 | child._start = _roundPrecise((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay);
|
399 | child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0));
|
400 |
|
401 | _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0);
|
402 |
|
403 | _isFromOrFromStart(child) || (timeline._recent = child);
|
404 | skipChecks || _postAddChecks(timeline, child);
|
405 | return timeline;
|
406 | },
|
407 | _scrollTrigger = function _scrollTrigger(animation, trigger) {
|
408 | return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation);
|
409 | },
|
410 | _attemptInitTween = function _attemptInitTween(tween, totalTime, force, suppressEvents) {
|
411 | _initTween(tween, totalTime);
|
412 |
|
413 | if (!tween._initted) {
|
414 | return 1;
|
415 | }
|
416 |
|
417 | if (!force && tween._pt && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) {
|
418 | _lazyTweens.push(tween);
|
419 |
|
420 | tween._lazy = [totalTime, suppressEvents];
|
421 | return 1;
|
422 | }
|
423 | },
|
424 | _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) {
|
425 | var parent = _ref.parent;
|
426 | return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent));
|
427 | },
|
428 | _isFromOrFromStart = function _isFromOrFromStart(_ref2) {
|
429 | var data = _ref2.data;
|
430 | return data === "isFromStart" || data === "isStart";
|
431 | },
|
432 | _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) {
|
433 | var prevRatio = tween.ratio,
|
434 | ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1,
|
435 | repeatDelay = tween._rDelay,
|
436 | tTime = 0,
|
437 | pt,
|
438 | iteration,
|
439 | prevIteration;
|
440 |
|
441 | if (repeatDelay && tween._repeat) {
|
442 | tTime = _clamp(0, tween._tDur, totalTime);
|
443 | iteration = _animationCycle(tTime, repeatDelay);
|
444 | tween._yoyo && iteration & 1 && (ratio = 1 - ratio);
|
445 |
|
446 | if (iteration !== _animationCycle(tween._tTime, repeatDelay)) {
|
447 | prevRatio = 1 - ratio;
|
448 | tween.vars.repeatRefresh && tween._initted && tween.invalidate();
|
449 | }
|
450 | }
|
451 |
|
452 | if (ratio !== prevRatio || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) {
|
453 | if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents)) {
|
454 | return;
|
455 | }
|
456 |
|
457 | prevIteration = tween._zTime;
|
458 | tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0);
|
459 | suppressEvents || (suppressEvents = totalTime && !prevIteration);
|
460 | tween.ratio = ratio;
|
461 | tween._from && (ratio = 1 - ratio);
|
462 | tween._time = 0;
|
463 | tween._tTime = tTime;
|
464 | pt = tween._pt;
|
465 |
|
466 | while (pt) {
|
467 | pt.r(ratio, pt.d);
|
468 | pt = pt._next;
|
469 | }
|
470 |
|
471 | tween._startAt && totalTime < 0 && tween._startAt.render(totalTime, true, true);
|
472 | tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate");
|
473 | tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat");
|
474 |
|
475 | if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) {
|
476 | ratio && _removeFromParent(tween, 1);
|
477 |
|
478 | if (!suppressEvents) {
|
479 | _callback(tween, ratio ? "onComplete" : "onReverseComplete", true);
|
480 |
|
481 | tween._prom && tween._prom();
|
482 | }
|
483 | }
|
484 | } else if (!tween._zTime) {
|
485 | tween._zTime = totalTime;
|
486 | }
|
487 | },
|
488 | _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) {
|
489 | var child;
|
490 |
|
491 | if (time > prevTime) {
|
492 | child = animation._first;
|
493 |
|
494 | while (child && child._start <= time) {
|
495 | if (child.data === "isPause" && child._start > prevTime) {
|
496 | return child;
|
497 | }
|
498 |
|
499 | child = child._next;
|
500 | }
|
501 | } else {
|
502 | child = animation._last;
|
503 |
|
504 | while (child && child._start >= time) {
|
505 | if (child.data === "isPause" && child._start < prevTime) {
|
506 | return child;
|
507 | }
|
508 |
|
509 | child = child._prev;
|
510 | }
|
511 | }
|
512 | },
|
513 | _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) {
|
514 | var repeat = animation._repeat,
|
515 | dur = _roundPrecise(duration) || 0,
|
516 | totalProgress = animation._tTime / animation._tDur;
|
517 | totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur);
|
518 | animation._dur = dur;
|
519 | animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat);
|
520 | totalProgress > 0 && !leavePlayhead ? _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress) : animation.parent && _setEnd(animation);
|
521 | skipUncache || _uncache(animation.parent, animation);
|
522 | return animation;
|
523 | },
|
524 | _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) {
|
525 | return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur);
|
526 | },
|
527 | _zeroPosition = {
|
528 | _start: 0,
|
529 | endTime: _emptyFunc,
|
530 | totalDuration: _emptyFunc
|
531 | },
|
532 | _parsePosition = function _parsePosition(animation, position, percentAnimation) {
|
533 | var labels = animation.labels,
|
534 | recent = animation._recent || _zeroPosition,
|
535 | clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur,
|
536 | i,
|
537 | offset,
|
538 | isPercent;
|
539 |
|
540 | if (_isString(position) && (isNaN(position) || position in labels)) {
|
541 | offset = position.charAt(0);
|
542 | isPercent = position.substr(-1) === "%";
|
543 | i = position.indexOf("=");
|
544 |
|
545 | if (offset === "<" || offset === ">") {
|
546 | i >= 0 && (position = position.replace(/=/, ""));
|
547 | return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1);
|
548 | }
|
549 |
|
550 | if (i < 0) {
|
551 | position in labels || (labels[position] = clippedDuration);
|
552 | return labels[position];
|
553 | }
|
554 |
|
555 | offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1));
|
556 |
|
557 | if (isPercent && percentAnimation) {
|
558 | offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration();
|
559 | }
|
560 |
|
561 | return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset;
|
562 | }
|
563 |
|
564 | return position == null ? clippedDuration : +position;
|
565 | },
|
566 | _createTweenType = function _createTweenType(type, params, timeline) {
|
567 | var isLegacy = _isNumber(params[1]),
|
568 | varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1),
|
569 | vars = params[varsIndex],
|
570 | irVars,
|
571 | parent;
|
572 |
|
573 | isLegacy && (vars.duration = params[1]);
|
574 | vars.parent = timeline;
|
575 |
|
576 | if (type) {
|
577 | irVars = vars;
|
578 | parent = timeline;
|
579 |
|
580 | while (parent && !("immediateRender" in irVars)) {
|
581 | irVars = parent.vars.defaults || {};
|
582 | parent = _isNotFalse(parent.vars.inherit) && parent.parent;
|
583 | }
|
584 |
|
585 | vars.immediateRender = _isNotFalse(irVars.immediateRender);
|
586 | type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1];
|
587 | }
|
588 |
|
589 | return new Tween(params[0], vars, params[varsIndex + 1]);
|
590 | },
|
591 | _conditionalReturn = function _conditionalReturn(value, func) {
|
592 | return value || value === 0 ? func(value) : func;
|
593 | },
|
594 | _clamp = function _clamp(min, max, value) {
|
595 | return value < min ? min : value > max ? max : value;
|
596 | },
|
597 | getUnit = function getUnit(value, v) {
|
598 | return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1];
|
599 | },
|
600 | clamp = function clamp(min, max, value) {
|
601 | return _conditionalReturn(value, function (v) {
|
602 | return _clamp(min, max, v);
|
603 | });
|
604 | },
|
605 | _slice = [].slice,
|
606 | _isArrayLike = function _isArrayLike(value, nonEmpty) {
|
607 | return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win;
|
608 | },
|
609 | _flatten = function _flatten(ar, leaveStrings, accumulator) {
|
610 | if (accumulator === void 0) {
|
611 | accumulator = [];
|
612 | }
|
613 |
|
614 | return ar.forEach(function (value) {
|
615 | var _accumulator;
|
616 |
|
617 | return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value);
|
618 | }) || accumulator;
|
619 | },
|
620 | toArray = function toArray(value, scope, leaveStrings) {
|
621 | return _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] : [];
|
622 | },
|
623 | selector = function selector(value) {
|
624 | value = toArray(value)[0] || _warn("Invalid scope") || {};
|
625 | return function (v) {
|
626 | var el = value.current || value.nativeElement || value;
|
627 | return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value);
|
628 | };
|
629 | },
|
630 | shuffle = function shuffle(a) {
|
631 | return a.sort(function () {
|
632 | return .5 - Math.random();
|
633 | });
|
634 | },
|
635 | distribute = function distribute(v) {
|
636 | if (_isFunction(v)) {
|
637 | return v;
|
638 | }
|
639 |
|
640 | var vars = _isObject(v) ? v : {
|
641 | each: v
|
642 | },
|
643 | ease = _parseEase(vars.ease),
|
644 | from = vars.from || 0,
|
645 | base = parseFloat(vars.base) || 0,
|
646 | cache = {},
|
647 | isDecimal = from > 0 && from < 1,
|
648 | ratios = isNaN(from) || isDecimal,
|
649 | axis = vars.axis,
|
650 | ratioX = from,
|
651 | ratioY = from;
|
652 |
|
653 | if (_isString(from)) {
|
654 | ratioX = ratioY = {
|
655 | center: .5,
|
656 | edges: .5,
|
657 | end: 1
|
658 | }[from] || 0;
|
659 | } else if (!isDecimal && ratios) {
|
660 | ratioX = from[0];
|
661 | ratioY = from[1];
|
662 | }
|
663 |
|
664 | return function (i, target, a) {
|
665 | var l = (a || vars).length,
|
666 | distances = cache[l],
|
667 | originX,
|
668 | originY,
|
669 | x,
|
670 | y,
|
671 | d,
|
672 | j,
|
673 | max,
|
674 | min,
|
675 | wrapAt;
|
676 |
|
677 | if (!distances) {
|
678 | wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1];
|
679 |
|
680 | if (!wrapAt) {
|
681 | max = -_bigNum;
|
682 |
|
683 | while (max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l) {}
|
684 |
|
685 | wrapAt--;
|
686 | }
|
687 |
|
688 | distances = cache[l] = [];
|
689 | originX = ratios ? Math.min(wrapAt, l) * ratioX - .5 : from % wrapAt;
|
690 | originY = wrapAt === _bigNum ? 0 : ratios ? l * ratioY / wrapAt - .5 : from / wrapAt | 0;
|
691 | max = 0;
|
692 | min = _bigNum;
|
693 |
|
694 | for (j = 0; j < l; j++) {
|
695 | x = j % wrapAt - originX;
|
696 | y = originY - (j / wrapAt | 0);
|
697 | distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x);
|
698 | d > max && (max = d);
|
699 | d < min && (min = d);
|
700 | }
|
701 |
|
702 | from === "random" && shuffle(distances);
|
703 | distances.max = max - min;
|
704 | distances.min = min;
|
705 | 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);
|
706 | distances.b = l < 0 ? base - l : base;
|
707 | distances.u = getUnit(vars.amount || vars.each) || 0;
|
708 | ease = ease && l < 0 ? _invertEase(ease) : ease;
|
709 | }
|
710 |
|
711 | l = (distances[i] - distances.min) / distances.max || 0;
|
712 | return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u;
|
713 | };
|
714 | },
|
715 | _roundModifier = function _roundModifier(v) {
|
716 | var p = Math.pow(10, ((v + "").split(".")[1] || "").length);
|
717 | return function (raw) {
|
718 | var n = Math.round(parseFloat(raw) / v) * v * p;
|
719 | return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw));
|
720 | };
|
721 | },
|
722 | snap = function snap(snapTo, value) {
|
723 | var isArray = _isArray(snapTo),
|
724 | radius,
|
725 | is2D;
|
726 |
|
727 | if (!isArray && _isObject(snapTo)) {
|
728 | radius = isArray = snapTo.radius || _bigNum;
|
729 |
|
730 | if (snapTo.values) {
|
731 | snapTo = toArray(snapTo.values);
|
732 |
|
733 | if (is2D = !_isNumber(snapTo[0])) {
|
734 | radius *= radius;
|
735 | }
|
736 | } else {
|
737 | snapTo = _roundModifier(snapTo.increment);
|
738 | }
|
739 | }
|
740 |
|
741 | return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function (raw) {
|
742 | is2D = snapTo(raw);
|
743 | return Math.abs(is2D - raw) <= radius ? is2D : raw;
|
744 | } : function (raw) {
|
745 | var x = parseFloat(is2D ? raw.x : raw),
|
746 | y = parseFloat(is2D ? raw.y : 0),
|
747 | min = _bigNum,
|
748 | closest = 0,
|
749 | i = snapTo.length,
|
750 | dx,
|
751 | dy;
|
752 |
|
753 | while (i--) {
|
754 | if (is2D) {
|
755 | dx = snapTo[i].x - x;
|
756 | dy = snapTo[i].y - y;
|
757 | dx = dx * dx + dy * dy;
|
758 | } else {
|
759 | dx = Math.abs(snapTo[i] - x);
|
760 | }
|
761 |
|
762 | if (dx < min) {
|
763 | min = dx;
|
764 | closest = i;
|
765 | }
|
766 | }
|
767 |
|
768 | closest = !radius || min <= radius ? snapTo[closest] : raw;
|
769 | return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw);
|
770 | });
|
771 | },
|
772 | random = function random(min, max, roundingIncrement, returnFunction) {
|
773 | return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function () {
|
774 | return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e-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;
|
775 | });
|
776 | },
|
777 | pipe = function pipe() {
|
778 | for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) {
|
779 | functions[_key] = arguments[_key];
|
780 | }
|
781 |
|
782 | return function (value) {
|
783 | return functions.reduce(function (v, f) {
|
784 | return f(v);
|
785 | }, value);
|
786 | };
|
787 | },
|
788 | unitize = function unitize(func, unit) {
|
789 | return function (value) {
|
790 | return func(parseFloat(value)) + (unit || getUnit(value));
|
791 | };
|
792 | },
|
793 | normalize = function normalize(min, max, value) {
|
794 | return mapRange(min, max, 0, 1, value);
|
795 | },
|
796 | _wrapArray = function _wrapArray(a, wrapper, value) {
|
797 | return _conditionalReturn(value, function (index) {
|
798 | return a[~~wrapper(index)];
|
799 | });
|
800 | },
|
801 | wrap = function wrap(min, max, value) {
|
802 | var range = max - min;
|
803 | return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function (value) {
|
804 | return (range + (value - min) % range) % range + min;
|
805 | });
|
806 | },
|
807 | wrapYoyo = function wrapYoyo(min, max, value) {
|
808 | var range = max - min,
|
809 | total = range * 2;
|
810 | return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function (value) {
|
811 | value = (total + (value - min) % total) % total || 0;
|
812 | return min + (value > range ? total - value : value);
|
813 | });
|
814 | },
|
815 | _replaceRandom = function _replaceRandom(value) {
|
816 | var prev = 0,
|
817 | s = "",
|
818 | i,
|
819 | nums,
|
820 | end,
|
821 | isArray;
|
822 |
|
823 | while (~(i = value.indexOf("random(", prev))) {
|
824 | end = value.indexOf(")", i);
|
825 | isArray = value.charAt(i + 7) === "[";
|
826 | nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp);
|
827 | s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5);
|
828 | prev = end + 1;
|
829 | }
|
830 |
|
831 | return s + value.substr(prev, value.length - prev);
|
832 | },
|
833 | mapRange = function mapRange(inMin, inMax, outMin, outMax, value) {
|
834 | var inRange = inMax - inMin,
|
835 | outRange = outMax - outMin;
|
836 | return _conditionalReturn(value, function (value) {
|
837 | return outMin + ((value - inMin) / inRange * outRange || 0);
|
838 | });
|
839 | },
|
840 | interpolate = function interpolate(start, end, progress, mutate) {
|
841 | var func = isNaN(start + end) ? 0 : function (p) {
|
842 | return (1 - p) * start + p * end;
|
843 | };
|
844 |
|
845 | if (!func) {
|
846 | var isString = _isString(start),
|
847 | master = {},
|
848 | p,
|
849 | i,
|
850 | interpolators,
|
851 | l,
|
852 | il;
|
853 |
|
854 | progress === true && (mutate = 1) && (progress = null);
|
855 |
|
856 | if (isString) {
|
857 | start = {
|
858 | p: start
|
859 | };
|
860 | end = {
|
861 | p: end
|
862 | };
|
863 | } else if (_isArray(start) && !_isArray(end)) {
|
864 | interpolators = [];
|
865 | l = start.length;
|
866 | il = l - 2;
|
867 |
|
868 | for (i = 1; i < l; i++) {
|
869 | interpolators.push(interpolate(start[i - 1], start[i]));
|
870 | }
|
871 |
|
872 | l--;
|
873 |
|
874 | func = function func(p) {
|
875 | p *= l;
|
876 | var i = Math.min(il, ~~p);
|
877 | return interpolators[i](p - i);
|
878 | };
|
879 |
|
880 | progress = end;
|
881 | } else if (!mutate) {
|
882 | start = _merge(_isArray(start) ? [] : {}, start);
|
883 | }
|
884 |
|
885 | if (!interpolators) {
|
886 | for (p in end) {
|
887 | _addPropTween.call(master, start, p, "get", end[p]);
|
888 | }
|
889 |
|
890 | func = function func(p) {
|
891 | return _renderPropTweens(p, master) || (isString ? start.p : start);
|
892 | };
|
893 | }
|
894 | }
|
895 |
|
896 | return _conditionalReturn(progress, func);
|
897 | },
|
898 | _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) {
|
899 | var labels = timeline.labels,
|
900 | min = _bigNum,
|
901 | p,
|
902 | distance,
|
903 | label;
|
904 |
|
905 | for (p in labels) {
|
906 | distance = labels[p] - fromTime;
|
907 |
|
908 | if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) {
|
909 | label = p;
|
910 | min = distance;
|
911 | }
|
912 | }
|
913 |
|
914 | return label;
|
915 | },
|
916 | _callback = function _callback(animation, type, executeLazyFirst) {
|
917 | var v = animation.vars,
|
918 | callback = v[type],
|
919 | params,
|
920 | scope;
|
921 |
|
922 | if (!callback) {
|
923 | return;
|
924 | }
|
925 |
|
926 | params = v[type + "Params"];
|
927 | scope = v.callbackScope || animation;
|
928 | executeLazyFirst && _lazyTweens.length && _lazyRender();
|
929 | return params ? callback.apply(scope, params) : callback.call(scope);
|
930 | },
|
931 | _interrupt = function _interrupt(animation) {
|
932 | _removeFromParent(animation);
|
933 |
|
934 | animation.scrollTrigger && animation.scrollTrigger.kill(false);
|
935 | animation.progress() < 1 && _callback(animation, "onInterrupt");
|
936 | return animation;
|
937 | },
|
938 | _quickTween,
|
939 | _createPlugin = function _createPlugin(config) {
|
940 | config = !config.name && config["default"] || config;
|
941 |
|
942 | var name = config.name,
|
943 | isFunc = _isFunction(config),
|
944 | Plugin = name && !isFunc && config.init ? function () {
|
945 | this._props = [];
|
946 | } : config,
|
947 | instanceDefaults = {
|
948 | init: _emptyFunc,
|
949 | render: _renderPropTweens,
|
950 | add: _addPropTween,
|
951 | kill: _killPropTweensOf,
|
952 | modifier: _addPluginModifier,
|
953 | rawVars: 0
|
954 | },
|
955 | statics = {
|
956 | targetTest: 0,
|
957 | get: 0,
|
958 | getSetter: _getSetter,
|
959 | aliases: {},
|
960 | register: 0
|
961 | };
|
962 |
|
963 | _wake();
|
964 |
|
965 | if (config !== Plugin) {
|
966 | if (_plugins[name]) {
|
967 | return;
|
968 | }
|
969 |
|
970 | _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics));
|
971 |
|
972 | _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics)));
|
973 |
|
974 | _plugins[Plugin.prop = name] = Plugin;
|
975 |
|
976 | if (config.targetTest) {
|
977 | _harnessPlugins.push(Plugin);
|
978 |
|
979 | _reservedProps[name] = 1;
|
980 | }
|
981 |
|
982 | name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin";
|
983 | }
|
984 |
|
985 | _addGlobal(name, Plugin);
|
986 |
|
987 | config.register && config.register(gsap, Plugin, PropTween);
|
988 | },
|
989 | _255 = 255,
|
990 | _colorLookup = {
|
991 | aqua: [0, _255, _255],
|
992 | lime: [0, _255, 0],
|
993 | silver: [192, 192, 192],
|
994 | black: [0, 0, 0],
|
995 | maroon: [128, 0, 0],
|
996 | teal: [0, 128, 128],
|
997 | blue: [0, 0, _255],
|
998 | navy: [0, 0, 128],
|
999 | white: [_255, _255, _255],
|
1000 | olive: [128, 128, 0],
|
1001 | yellow: [_255, _255, 0],
|
1002 | orange: [_255, 165, 0],
|
1003 | gray: [128, 128, 128],
|
1004 | purple: [128, 0, 128],
|
1005 | green: [0, 128, 0],
|
1006 | red: [_255, 0, 0],
|
1007 | pink: [_255, 192, 203],
|
1008 | cyan: [0, _255, _255],
|
1009 | transparent: [_255, _255, _255, 0]
|
1010 | },
|
1011 | _hue = function _hue(h, m1, m2) {
|
1012 | h += h < 0 ? 1 : h > 1 ? -1 : 0;
|
1013 | 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;
|
1014 | },
|
1015 | splitColor = function splitColor(v, toHSL, forceAlpha) {
|
1016 | var a = !v ? _colorLookup.black : _isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255] : 0,
|
1017 | r,
|
1018 | g,
|
1019 | b,
|
1020 | h,
|
1021 | s,
|
1022 | l,
|
1023 | max,
|
1024 | min,
|
1025 | d,
|
1026 | wasHSL;
|
1027 |
|
1028 | if (!a) {
|
1029 | if (v.substr(-1) === ",") {
|
1030 | v = v.substr(0, v.length - 1);
|
1031 | }
|
1032 |
|
1033 | if (_colorLookup[v]) {
|
1034 | a = _colorLookup[v];
|
1035 | } else if (v.charAt(0) === "#") {
|
1036 | if (v.length < 6) {
|
1037 | r = v.charAt(1);
|
1038 | g = v.charAt(2);
|
1039 | b = v.charAt(3);
|
1040 | v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : "");
|
1041 | }
|
1042 |
|
1043 | if (v.length === 9) {
|
1044 | a = parseInt(v.substr(1, 6), 16);
|
1045 | return [a >> 16, a >> 8 & _255, a & _255, parseInt(v.substr(7), 16) / 255];
|
1046 | }
|
1047 |
|
1048 | v = parseInt(v.substr(1), 16);
|
1049 | a = [v >> 16, v >> 8 & _255, v & _255];
|
1050 | } else if (v.substr(0, 3) === "hsl") {
|
1051 | a = wasHSL = v.match(_strictNumExp);
|
1052 |
|
1053 | if (!toHSL) {
|
1054 | h = +a[0] % 360 / 360;
|
1055 | s = +a[1] / 100;
|
1056 | l = +a[2] / 100;
|
1057 | g = l <= .5 ? l * (s + 1) : l + s - l * s;
|
1058 | r = l * 2 - g;
|
1059 | a.length > 3 && (a[3] *= 1);
|
1060 | a[0] = _hue(h + 1 / 3, r, g);
|
1061 | a[1] = _hue(h, r, g);
|
1062 | a[2] = _hue(h - 1 / 3, r, g);
|
1063 | } else if (~v.indexOf("=")) {
|
1064 | a = v.match(_numExp);
|
1065 | forceAlpha && a.length < 4 && (a[3] = 1);
|
1066 | return a;
|
1067 | }
|
1068 | } else {
|
1069 | a = v.match(_strictNumExp) || _colorLookup.transparent;
|
1070 | }
|
1071 |
|
1072 | a = a.map(Number);
|
1073 | }
|
1074 |
|
1075 | if (toHSL && !wasHSL) {
|
1076 | r = a[0] / _255;
|
1077 | g = a[1] / _255;
|
1078 | b = a[2] / _255;
|
1079 | max = Math.max(r, g, b);
|
1080 | min = Math.min(r, g, b);
|
1081 | l = (max + min) / 2;
|
1082 |
|
1083 | if (max === min) {
|
1084 | h = s = 0;
|
1085 | } else {
|
1086 | d = max - min;
|
1087 | s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
1088 | h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
|
1089 | h *= 60;
|
1090 | }
|
1091 |
|
1092 | a[0] = ~~(h + .5);
|
1093 | a[1] = ~~(s * 100 + .5);
|
1094 | a[2] = ~~(l * 100 + .5);
|
1095 | }
|
1096 |
|
1097 | forceAlpha && a.length < 4 && (a[3] = 1);
|
1098 | return a;
|
1099 | },
|
1100 | _colorOrderData = function _colorOrderData(v) {
|
1101 | var values = [],
|
1102 | c = [],
|
1103 | i = -1;
|
1104 | v.split(_colorExp).forEach(function (v) {
|
1105 | var a = v.match(_numWithUnitExp) || [];
|
1106 | values.push.apply(values, a);
|
1107 | c.push(i += a.length + 1);
|
1108 | });
|
1109 | values.c = c;
|
1110 | return values;
|
1111 | },
|
1112 | _formatColors = function _formatColors(s, toHSL, orderMatchData) {
|
1113 | var result = "",
|
1114 | colors = (s + result).match(_colorExp),
|
1115 | type = toHSL ? "hsla(" : "rgba(",
|
1116 | i = 0,
|
1117 | c,
|
1118 | shell,
|
1119 | d,
|
1120 | l;
|
1121 |
|
1122 | if (!colors) {
|
1123 | return s;
|
1124 | }
|
1125 |
|
1126 | colors = colors.map(function (color) {
|
1127 | return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")";
|
1128 | });
|
1129 |
|
1130 | if (orderMatchData) {
|
1131 | d = _colorOrderData(s);
|
1132 | c = orderMatchData.c;
|
1133 |
|
1134 | if (c.join(result) !== d.c.join(result)) {
|
1135 | shell = s.replace(_colorExp, "1").split(_numWithUnitExp);
|
1136 | l = shell.length - 1;
|
1137 |
|
1138 | for (; i < l; i++) {
|
1139 | result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift());
|
1140 | }
|
1141 | }
|
1142 | }
|
1143 |
|
1144 | if (!shell) {
|
1145 | shell = s.split(_colorExp);
|
1146 | l = shell.length - 1;
|
1147 |
|
1148 | for (; i < l; i++) {
|
1149 | result += shell[i] + colors[i];
|
1150 | }
|
1151 | }
|
1152 |
|
1153 | return result + shell[l];
|
1154 | },
|
1155 | _colorExp = function () {
|
1156 | var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",
|
1157 | p;
|
1158 |
|
1159 | for (p in _colorLookup) {
|
1160 | s += "|" + p + "\\b";
|
1161 | }
|
1162 |
|
1163 | return new RegExp(s + ")", "gi");
|
1164 | }(),
|
1165 | _hslExp = /hsl[a]?\(/,
|
1166 | _colorStringFilter = function _colorStringFilter(a) {
|
1167 | var combined = a.join(" "),
|
1168 | toHSL;
|
1169 | _colorExp.lastIndex = 0;
|
1170 |
|
1171 | if (_colorExp.test(combined)) {
|
1172 | toHSL = _hslExp.test(combined);
|
1173 | a[1] = _formatColors(a[1], toHSL);
|
1174 | a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1]));
|
1175 | return true;
|
1176 | }
|
1177 | },
|
1178 | _tickerActive,
|
1179 | _ticker = function () {
|
1180 | var _getTime = Date.now,
|
1181 | _lagThreshold = 500,
|
1182 | _adjustedLag = 33,
|
1183 | _startTime = _getTime(),
|
1184 | _lastUpdate = _startTime,
|
1185 | _gap = 1000 / 240,
|
1186 | _nextTime = _gap,
|
1187 | _listeners = [],
|
1188 | _id,
|
1189 | _req,
|
1190 | _raf,
|
1191 | _self,
|
1192 | _delta,
|
1193 | _i,
|
1194 | _tick = function _tick(v) {
|
1195 | var elapsed = _getTime() - _lastUpdate,
|
1196 | manual = v === true,
|
1197 | overlap,
|
1198 | dispatch,
|
1199 | time,
|
1200 | frame;
|
1201 |
|
1202 | elapsed > _lagThreshold && (_startTime += elapsed - _adjustedLag);
|
1203 | _lastUpdate += elapsed;
|
1204 | time = _lastUpdate - _startTime;
|
1205 | overlap = time - _nextTime;
|
1206 |
|
1207 | if (overlap > 0 || manual) {
|
1208 | frame = ++_self.frame;
|
1209 | _delta = time - _self.time * 1000;
|
1210 | _self.time = time = time / 1000;
|
1211 | _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap);
|
1212 | dispatch = 1;
|
1213 | }
|
1214 |
|
1215 | manual || (_id = _req(_tick));
|
1216 |
|
1217 | if (dispatch) {
|
1218 | for (_i = 0; _i < _listeners.length; _i++) {
|
1219 | _listeners[_i](time, _delta, frame, v);
|
1220 | }
|
1221 | }
|
1222 | };
|
1223 |
|
1224 | _self = {
|
1225 | time: 0,
|
1226 | frame: 0,
|
1227 | tick: function tick() {
|
1228 | _tick(true);
|
1229 | },
|
1230 | deltaRatio: function deltaRatio(fps) {
|
1231 | return _delta / (1000 / (fps || 60));
|
1232 | },
|
1233 | wake: function wake() {
|
1234 | if (_coreReady) {
|
1235 | if (!_coreInitted && _windowExists()) {
|
1236 | _win = _coreInitted = window;
|
1237 | _doc = _win.document || {};
|
1238 | _globals.gsap = gsap;
|
1239 | (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version);
|
1240 |
|
1241 | _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {});
|
1242 |
|
1243 | _raf = _win.requestAnimationFrame;
|
1244 | }
|
1245 |
|
1246 | _id && _self.sleep();
|
1247 |
|
1248 | _req = _raf || function (f) {
|
1249 | return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0);
|
1250 | };
|
1251 |
|
1252 | _tickerActive = 1;
|
1253 |
|
1254 | _tick(2);
|
1255 | }
|
1256 | },
|
1257 | sleep: function sleep() {
|
1258 | (_raf ? _win.cancelAnimationFrame : clearTimeout)(_id);
|
1259 | _tickerActive = 0;
|
1260 | _req = _emptyFunc;
|
1261 | },
|
1262 | lagSmoothing: function lagSmoothing(threshold, adjustedLag) {
|
1263 | _lagThreshold = threshold || 1 / _tinyNum;
|
1264 | _adjustedLag = Math.min(adjustedLag, _lagThreshold, 0);
|
1265 | },
|
1266 | fps: function fps(_fps) {
|
1267 | _gap = 1000 / (_fps || 240);
|
1268 | _nextTime = _self.time * 1000 + _gap;
|
1269 | },
|
1270 | add: function add(callback, once, prioritize) {
|
1271 | var func = once ? function (t, d, f, v) {
|
1272 | callback(t, d, f, v);
|
1273 |
|
1274 | _self.remove(func);
|
1275 | } : callback;
|
1276 |
|
1277 | _self.remove(callback);
|
1278 |
|
1279 | _listeners[prioritize ? "unshift" : "push"](func);
|
1280 |
|
1281 | _wake();
|
1282 |
|
1283 | return func;
|
1284 | },
|
1285 | remove: function remove(callback, i) {
|
1286 | ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--;
|
1287 | },
|
1288 | _listeners: _listeners
|
1289 | };
|
1290 | return _self;
|
1291 | }(),
|
1292 | _wake = function _wake() {
|
1293 | return !_tickerActive && _ticker.wake();
|
1294 | },
|
1295 | _easeMap = {},
|
1296 | _customEaseExp = /^[\d.\-M][\d.\-,\s]/,
|
1297 | _quotesExp = /["']/g,
|
1298 | _parseObjectInString = function _parseObjectInString(value) {
|
1299 | var obj = {},
|
1300 | split = value.substr(1, value.length - 3).split(":"),
|
1301 | key = split[0],
|
1302 | i = 1,
|
1303 | l = split.length,
|
1304 | index,
|
1305 | val,
|
1306 | parsedVal;
|
1307 |
|
1308 | for (; i < l; i++) {
|
1309 | val = split[i];
|
1310 | index = i !== l - 1 ? val.lastIndexOf(",") : val.length;
|
1311 | parsedVal = val.substr(0, index);
|
1312 | obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal;
|
1313 | key = val.substr(index + 1).trim();
|
1314 | }
|
1315 |
|
1316 | return obj;
|
1317 | },
|
1318 | _valueInParentheses = function _valueInParentheses(value) {
|
1319 | var open = value.indexOf("(") + 1,
|
1320 | close = value.indexOf(")"),
|
1321 | nested = value.indexOf("(", open);
|
1322 | return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close);
|
1323 | },
|
1324 | _configEaseFromString = function _configEaseFromString(name) {
|
1325 | var split = (name + "").split("("),
|
1326 | ease = _easeMap[split[0]];
|
1327 | 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;
|
1328 | },
|
1329 | _invertEase = function _invertEase(ease) {
|
1330 | return function (p) {
|
1331 | return 1 - ease(1 - p);
|
1332 | };
|
1333 | },
|
1334 | _propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) {
|
1335 | var child = timeline._first,
|
1336 | ease;
|
1337 |
|
1338 | while (child) {
|
1339 | if (child instanceof Timeline) {
|
1340 | _propagateYoyoEase(child, isYoyo);
|
1341 | } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) {
|
1342 | if (child.timeline) {
|
1343 | _propagateYoyoEase(child.timeline, isYoyo);
|
1344 | } else {
|
1345 | ease = child._ease;
|
1346 | child._ease = child._yEase;
|
1347 | child._yEase = ease;
|
1348 | child._yoyo = isYoyo;
|
1349 | }
|
1350 | }
|
1351 |
|
1352 | child = child._next;
|
1353 | }
|
1354 | },
|
1355 | _parseEase = function _parseEase(ease, defaultEase) {
|
1356 | return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase;
|
1357 | },
|
1358 | _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) {
|
1359 | if (easeOut === void 0) {
|
1360 | easeOut = function easeOut(p) {
|
1361 | return 1 - easeIn(1 - p);
|
1362 | };
|
1363 | }
|
1364 |
|
1365 | if (easeInOut === void 0) {
|
1366 | easeInOut = function easeInOut(p) {
|
1367 | return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2;
|
1368 | };
|
1369 | }
|
1370 |
|
1371 | var ease = {
|
1372 | easeIn: easeIn,
|
1373 | easeOut: easeOut,
|
1374 | easeInOut: easeInOut
|
1375 | },
|
1376 | lowercaseName;
|
1377 |
|
1378 | _forEachName(names, function (name) {
|
1379 | _easeMap[name] = _globals[name] = ease;
|
1380 | _easeMap[lowercaseName = name.toLowerCase()] = easeOut;
|
1381 |
|
1382 | for (var p in ease) {
|
1383 | _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p];
|
1384 | }
|
1385 | });
|
1386 |
|
1387 | return ease;
|
1388 | },
|
1389 | _easeInOutFromOut = function _easeInOutFromOut(easeOut) {
|
1390 | return function (p) {
|
1391 | return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2;
|
1392 | };
|
1393 | },
|
1394 | _configElastic = function _configElastic(type, amplitude, period) {
|
1395 | var p1 = amplitude >= 1 ? amplitude : 1,
|
1396 | p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1),
|
1397 | p3 = p2 / _2PI * (Math.asin(1 / p1) || 0),
|
1398 | easeOut = function easeOut(p) {
|
1399 | return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1;
|
1400 | },
|
1401 | ease = type === "out" ? easeOut : type === "in" ? function (p) {
|
1402 | return 1 - easeOut(1 - p);
|
1403 | } : _easeInOutFromOut(easeOut);
|
1404 |
|
1405 | p2 = _2PI / p2;
|
1406 |
|
1407 | ease.config = function (amplitude, period) {
|
1408 | return _configElastic(type, amplitude, period);
|
1409 | };
|
1410 |
|
1411 | return ease;
|
1412 | },
|
1413 | _configBack = function _configBack(type, overshoot) {
|
1414 | if (overshoot === void 0) {
|
1415 | overshoot = 1.70158;
|
1416 | }
|
1417 |
|
1418 | var easeOut = function easeOut(p) {
|
1419 | return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0;
|
1420 | },
|
1421 | ease = type === "out" ? easeOut : type === "in" ? function (p) {
|
1422 | return 1 - easeOut(1 - p);
|
1423 | } : _easeInOutFromOut(easeOut);
|
1424 |
|
1425 | ease.config = function (overshoot) {
|
1426 | return _configBack(type, overshoot);
|
1427 | };
|
1428 |
|
1429 | return ease;
|
1430 | };
|
1431 |
|
1432 | _forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function (name, i) {
|
1433 | var power = i < 5 ? i + 1 : i;
|
1434 |
|
1435 | _insertEase(name + ",Power" + (power - 1), i ? function (p) {
|
1436 | return Math.pow(p, power);
|
1437 | } : function (p) {
|
1438 | return p;
|
1439 | }, function (p) {
|
1440 | return 1 - Math.pow(1 - p, power);
|
1441 | }, function (p) {
|
1442 | return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2;
|
1443 | });
|
1444 | });
|
1445 |
|
1446 | _easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn;
|
1447 |
|
1448 | _insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic());
|
1449 |
|
1450 | (function (n, c) {
|
1451 | var n1 = 1 / c,
|
1452 | n2 = 2 * n1,
|
1453 | n3 = 2.5 * n1,
|
1454 | easeOut = function easeOut(p) {
|
1455 | 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;
|
1456 | };
|
1457 |
|
1458 | _insertEase("Bounce", function (p) {
|
1459 | return 1 - easeOut(1 - p);
|
1460 | }, easeOut);
|
1461 | })(7.5625, 2.75);
|
1462 |
|
1463 | _insertEase("Expo", function (p) {
|
1464 | return p ? Math.pow(2, 10 * (p - 1)) : 0;
|
1465 | });
|
1466 |
|
1467 | _insertEase("Circ", function (p) {
|
1468 | return -(_sqrt(1 - p * p) - 1);
|
1469 | });
|
1470 |
|
1471 | _insertEase("Sine", function (p) {
|
1472 | return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1;
|
1473 | });
|
1474 |
|
1475 | _insertEase("Back", _configBack("in"), _configBack("out"), _configBack());
|
1476 |
|
1477 | _easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = {
|
1478 | config: function config(steps, immediateStart) {
|
1479 | if (steps === void 0) {
|
1480 | steps = 1;
|
1481 | }
|
1482 |
|
1483 | var p1 = 1 / steps,
|
1484 | p2 = steps + (immediateStart ? 0 : 1),
|
1485 | p3 = immediateStart ? 1 : 0,
|
1486 | max = 1 - _tinyNum;
|
1487 | return function (p) {
|
1488 | return ((p2 * _clamp(0, max, p) | 0) + p3) * p1;
|
1489 | };
|
1490 | }
|
1491 | };
|
1492 | _defaults.ease = _easeMap["quad.out"];
|
1493 |
|
1494 | _forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function (name) {
|
1495 | return _callbackNames += name + "," + name + "Params,";
|
1496 | });
|
1497 |
|
1498 | var GSCache = function GSCache(target, harness) {
|
1499 | this.id = _gsID++;
|
1500 | target._gsap = this;
|
1501 | this.target = target;
|
1502 | this.harness = harness;
|
1503 | this.get = harness ? harness.get : _getProperty;
|
1504 | this.set = harness ? harness.getSetter : _getSetter;
|
1505 | };
|
1506 | var Animation = function () {
|
1507 | function Animation(vars) {
|
1508 | this.vars = vars;
|
1509 | this._delay = +vars.delay || 0;
|
1510 |
|
1511 | if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) {
|
1512 | this._rDelay = vars.repeatDelay || 0;
|
1513 | this._yoyo = !!vars.yoyo || !!vars.yoyoEase;
|
1514 | }
|
1515 |
|
1516 | this._ts = 1;
|
1517 |
|
1518 | _setDuration(this, +vars.duration, 1, 1);
|
1519 |
|
1520 | this.data = vars.data;
|
1521 | _tickerActive || _ticker.wake();
|
1522 | }
|
1523 |
|
1524 | var _proto = Animation.prototype;
|
1525 |
|
1526 | _proto.delay = function delay(value) {
|
1527 | if (value || value === 0) {
|
1528 | this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay);
|
1529 | this._delay = value;
|
1530 | return this;
|
1531 | }
|
1532 |
|
1533 | return this._delay;
|
1534 | };
|
1535 |
|
1536 | _proto.duration = function duration(value) {
|
1537 | return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur;
|
1538 | };
|
1539 |
|
1540 | _proto.totalDuration = function totalDuration(value) {
|
1541 | if (!arguments.length) {
|
1542 | return this._tDur;
|
1543 | }
|
1544 |
|
1545 | this._dirty = 0;
|
1546 | return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1));
|
1547 | };
|
1548 |
|
1549 | _proto.totalTime = function totalTime(_totalTime, suppressEvents) {
|
1550 | _wake();
|
1551 |
|
1552 | if (!arguments.length) {
|
1553 | return this._tTime;
|
1554 | }
|
1555 |
|
1556 | var parent = this._dp;
|
1557 |
|
1558 | if (parent && parent.smoothChildTiming && this._ts) {
|
1559 | _alignPlayhead(this, _totalTime);
|
1560 |
|
1561 | !parent._dp || parent.parent || _postAddChecks(parent, this);
|
1562 |
|
1563 | while (parent && parent.parent) {
|
1564 | if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) {
|
1565 | parent.totalTime(parent._tTime, true);
|
1566 | }
|
1567 |
|
1568 | parent = parent.parent;
|
1569 | }
|
1570 |
|
1571 | if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) {
|
1572 | _addToTimeline(this._dp, this, this._start - this._delay);
|
1573 | }
|
1574 | }
|
1575 |
|
1576 | if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) {
|
1577 | this._ts || (this._pTime = _totalTime);
|
1578 |
|
1579 | _lazySafeRender(this, _totalTime, suppressEvents);
|
1580 | }
|
1581 |
|
1582 | return this;
|
1583 | };
|
1584 |
|
1585 | _proto.time = function time(value, suppressEvents) {
|
1586 | return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time;
|
1587 | };
|
1588 |
|
1589 | _proto.totalProgress = function totalProgress(value, suppressEvents) {
|
1590 | return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.ratio;
|
1591 | };
|
1592 |
|
1593 | _proto.progress = function progress(value, suppressEvents) {
|
1594 | 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;
|
1595 | };
|
1596 |
|
1597 | _proto.iteration = function iteration(value, suppressEvents) {
|
1598 | var cycleDuration = this.duration() + this._rDelay;
|
1599 |
|
1600 | return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1;
|
1601 | };
|
1602 |
|
1603 | _proto.timeScale = function timeScale(value) {
|
1604 | if (!arguments.length) {
|
1605 | return this._rts === -_tinyNum ? 0 : this._rts;
|
1606 | }
|
1607 |
|
1608 | if (this._rts === value) {
|
1609 | return this;
|
1610 | }
|
1611 |
|
1612 | var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime;
|
1613 | this._rts = +value || 0;
|
1614 | this._ts = this._ps || value === -_tinyNum ? 0 : this._rts;
|
1615 | this.totalTime(_clamp(-this._delay, this._tDur, tTime), true);
|
1616 |
|
1617 | _setEnd(this);
|
1618 |
|
1619 | return _recacheAncestors(this);
|
1620 | };
|
1621 |
|
1622 | _proto.paused = function paused(value) {
|
1623 | if (!arguments.length) {
|
1624 | return this._ps;
|
1625 | }
|
1626 |
|
1627 | if (this._ps !== value) {
|
1628 | this._ps = value;
|
1629 |
|
1630 | if (value) {
|
1631 | this._pTime = this._tTime || Math.max(-this._delay, this.rawTime());
|
1632 | this._ts = this._act = 0;
|
1633 | } else {
|
1634 | _wake();
|
1635 |
|
1636 | this._ts = this._rts;
|
1637 | this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum));
|
1638 | }
|
1639 | }
|
1640 |
|
1641 | return this;
|
1642 | };
|
1643 |
|
1644 | _proto.startTime = function startTime(value) {
|
1645 | if (arguments.length) {
|
1646 | this._start = value;
|
1647 | var parent = this.parent || this._dp;
|
1648 | parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay);
|
1649 | return this;
|
1650 | }
|
1651 |
|
1652 | return this._start;
|
1653 | };
|
1654 |
|
1655 | _proto.endTime = function endTime(includeRepeats) {
|
1656 | return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1);
|
1657 | };
|
1658 |
|
1659 | _proto.rawTime = function rawTime(wrapRepeats) {
|
1660 | var parent = this.parent || this._dp;
|
1661 | 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);
|
1662 | };
|
1663 |
|
1664 | _proto.globalTime = function globalTime(rawTime) {
|
1665 | var animation = this,
|
1666 | time = arguments.length ? rawTime : animation.rawTime();
|
1667 |
|
1668 | while (animation) {
|
1669 | time = animation._start + time / (animation._ts || 1);
|
1670 | animation = animation._dp;
|
1671 | }
|
1672 |
|
1673 | return time;
|
1674 | };
|
1675 |
|
1676 | _proto.repeat = function repeat(value) {
|
1677 | if (arguments.length) {
|
1678 | this._repeat = value === Infinity ? -2 : value;
|
1679 | return _onUpdateTotalDuration(this);
|
1680 | }
|
1681 |
|
1682 | return this._repeat === -2 ? Infinity : this._repeat;
|
1683 | };
|
1684 |
|
1685 | _proto.repeatDelay = function repeatDelay(value) {
|
1686 | if (arguments.length) {
|
1687 | var time = this._time;
|
1688 | this._rDelay = value;
|
1689 |
|
1690 | _onUpdateTotalDuration(this);
|
1691 |
|
1692 | return time ? this.time(time) : this;
|
1693 | }
|
1694 |
|
1695 | return this._rDelay;
|
1696 | };
|
1697 |
|
1698 | _proto.yoyo = function yoyo(value) {
|
1699 | if (arguments.length) {
|
1700 | this._yoyo = value;
|
1701 | return this;
|
1702 | }
|
1703 |
|
1704 | return this._yoyo;
|
1705 | };
|
1706 |
|
1707 | _proto.seek = function seek(position, suppressEvents) {
|
1708 | return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents));
|
1709 | };
|
1710 |
|
1711 | _proto.restart = function restart(includeDelay, suppressEvents) {
|
1712 | return this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents));
|
1713 | };
|
1714 |
|
1715 | _proto.play = function play(from, suppressEvents) {
|
1716 | from != null && this.seek(from, suppressEvents);
|
1717 | return this.reversed(false).paused(false);
|
1718 | };
|
1719 |
|
1720 | _proto.reverse = function reverse(from, suppressEvents) {
|
1721 | from != null && this.seek(from || this.totalDuration(), suppressEvents);
|
1722 | return this.reversed(true).paused(false);
|
1723 | };
|
1724 |
|
1725 | _proto.pause = function pause(atTime, suppressEvents) {
|
1726 | atTime != null && this.seek(atTime, suppressEvents);
|
1727 | return this.paused(true);
|
1728 | };
|
1729 |
|
1730 | _proto.resume = function resume() {
|
1731 | return this.paused(false);
|
1732 | };
|
1733 |
|
1734 | _proto.reversed = function reversed(value) {
|
1735 | if (arguments.length) {
|
1736 | !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0));
|
1737 | return this;
|
1738 | }
|
1739 |
|
1740 | return this._rts < 0;
|
1741 | };
|
1742 |
|
1743 | _proto.invalidate = function invalidate() {
|
1744 | this._initted = this._act = 0;
|
1745 | this._zTime = -_tinyNum;
|
1746 | return this;
|
1747 | };
|
1748 |
|
1749 | _proto.isActive = function isActive() {
|
1750 | var parent = this.parent || this._dp,
|
1751 | start = this._start,
|
1752 | rawTime;
|
1753 | return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum);
|
1754 | };
|
1755 |
|
1756 | _proto.eventCallback = function eventCallback(type, callback, params) {
|
1757 | var vars = this.vars;
|
1758 |
|
1759 | if (arguments.length > 1) {
|
1760 | if (!callback) {
|
1761 | delete vars[type];
|
1762 | } else {
|
1763 | vars[type] = callback;
|
1764 | params && (vars[type + "Params"] = params);
|
1765 | type === "onUpdate" && (this._onUpdate = callback);
|
1766 | }
|
1767 |
|
1768 | return this;
|
1769 | }
|
1770 |
|
1771 | return vars[type];
|
1772 | };
|
1773 |
|
1774 | _proto.then = function then(onFulfilled) {
|
1775 | var self = this;
|
1776 | return new Promise(function (resolve) {
|
1777 | var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough,
|
1778 | _resolve = function _resolve() {
|
1779 | var _then = self.then;
|
1780 | self.then = null;
|
1781 | _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then);
|
1782 | resolve(f);
|
1783 | self.then = _then;
|
1784 | };
|
1785 |
|
1786 | if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) {
|
1787 | _resolve();
|
1788 | } else {
|
1789 | self._prom = _resolve;
|
1790 | }
|
1791 | });
|
1792 | };
|
1793 |
|
1794 | _proto.kill = function kill() {
|
1795 | _interrupt(this);
|
1796 | };
|
1797 |
|
1798 | return Animation;
|
1799 | }();
|
1800 |
|
1801 | _setDefaults(Animation.prototype, {
|
1802 | _time: 0,
|
1803 | _start: 0,
|
1804 | _end: 0,
|
1805 | _tTime: 0,
|
1806 | _tDur: 0,
|
1807 | _dirty: 0,
|
1808 | _repeat: 0,
|
1809 | _yoyo: false,
|
1810 | parent: null,
|
1811 | _initted: false,
|
1812 | _rDelay: 0,
|
1813 | _ts: 1,
|
1814 | _dp: 0,
|
1815 | ratio: 0,
|
1816 | _zTime: -_tinyNum,
|
1817 | _prom: 0,
|
1818 | _ps: false,
|
1819 | _rts: 1
|
1820 | });
|
1821 |
|
1822 | var Timeline = function (_Animation) {
|
1823 | _inheritsLoose(Timeline, _Animation);
|
1824 |
|
1825 | function Timeline(vars, position) {
|
1826 | var _this;
|
1827 |
|
1828 | if (vars === void 0) {
|
1829 | vars = {};
|
1830 | }
|
1831 |
|
1832 | _this = _Animation.call(this, vars) || this;
|
1833 | _this.labels = {};
|
1834 | _this.smoothChildTiming = !!vars.smoothChildTiming;
|
1835 | _this.autoRemoveChildren = !!vars.autoRemoveChildren;
|
1836 | _this._sort = _isNotFalse(vars.sortChildren);
|
1837 | _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position);
|
1838 | vars.reversed && _this.reverse();
|
1839 | vars.paused && _this.paused(true);
|
1840 | vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger);
|
1841 | return _this;
|
1842 | }
|
1843 |
|
1844 | var _proto2 = Timeline.prototype;
|
1845 |
|
1846 | _proto2.to = function to(targets, vars, position) {
|
1847 | _createTweenType(0, arguments, this);
|
1848 |
|
1849 | return this;
|
1850 | };
|
1851 |
|
1852 | _proto2.from = function from(targets, vars, position) {
|
1853 | _createTweenType(1, arguments, this);
|
1854 |
|
1855 | return this;
|
1856 | };
|
1857 |
|
1858 | _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) {
|
1859 | _createTweenType(2, arguments, this);
|
1860 |
|
1861 | return this;
|
1862 | };
|
1863 |
|
1864 | _proto2.set = function set(targets, vars, position) {
|
1865 | vars.duration = 0;
|
1866 | vars.parent = this;
|
1867 | _inheritDefaults(vars).repeatDelay || (vars.repeat = 0);
|
1868 | vars.immediateRender = !!vars.immediateRender;
|
1869 | new Tween(targets, vars, _parsePosition(this, position), 1);
|
1870 | return this;
|
1871 | };
|
1872 |
|
1873 | _proto2.call = function call(callback, params, position) {
|
1874 | return _addToTimeline(this, Tween.delayedCall(0, callback, params), position);
|
1875 | };
|
1876 |
|
1877 | _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
|
1878 | vars.duration = duration;
|
1879 | vars.stagger = vars.stagger || stagger;
|
1880 | vars.onComplete = onCompleteAll;
|
1881 | vars.onCompleteParams = onCompleteAllParams;
|
1882 | vars.parent = this;
|
1883 | new Tween(targets, vars, _parsePosition(this, position));
|
1884 | return this;
|
1885 | };
|
1886 |
|
1887 | _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
|
1888 | vars.runBackwards = 1;
|
1889 | _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender);
|
1890 | return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams);
|
1891 | };
|
1892 |
|
1893 | _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) {
|
1894 | toVars.startAt = fromVars;
|
1895 | _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender);
|
1896 | return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams);
|
1897 | };
|
1898 |
|
1899 | _proto2.render = function render(totalTime, suppressEvents, force) {
|
1900 | var prevTime = this._time,
|
1901 | tDur = this._dirty ? this.totalDuration() : this._tDur,
|
1902 | dur = this._dur,
|
1903 | tTime = totalTime <= 0 ? 0 : _roundPrecise(totalTime),
|
1904 | crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur),
|
1905 | time,
|
1906 | child,
|
1907 | next,
|
1908 | iteration,
|
1909 | cycleDuration,
|
1910 | prevPaused,
|
1911 | pauseTween,
|
1912 | timeScale,
|
1913 | prevStart,
|
1914 | prevIteration,
|
1915 | yoyo,
|
1916 | isYoyo;
|
1917 | this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur);
|
1918 |
|
1919 | if (tTime !== this._tTime || force || crossingStart) {
|
1920 | if (prevTime !== this._time && dur) {
|
1921 | tTime += this._time - prevTime;
|
1922 | totalTime += this._time - prevTime;
|
1923 | }
|
1924 |
|
1925 | time = tTime;
|
1926 | prevStart = this._start;
|
1927 | timeScale = this._ts;
|
1928 | prevPaused = !timeScale;
|
1929 |
|
1930 | if (crossingStart) {
|
1931 | dur || (prevTime = this._zTime);
|
1932 | (totalTime || !suppressEvents) && (this._zTime = totalTime);
|
1933 | }
|
1934 |
|
1935 | if (this._repeat) {
|
1936 | yoyo = this._yoyo;
|
1937 | cycleDuration = dur + this._rDelay;
|
1938 |
|
1939 | if (this._repeat < -1 && totalTime < 0) {
|
1940 | return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
|
1941 | }
|
1942 |
|
1943 | time = _roundPrecise(tTime % cycleDuration);
|
1944 |
|
1945 | if (tTime === tDur) {
|
1946 | iteration = this._repeat;
|
1947 | time = dur;
|
1948 | } else {
|
1949 | iteration = ~~(tTime / cycleDuration);
|
1950 |
|
1951 | if (iteration && iteration === tTime / cycleDuration) {
|
1952 | time = dur;
|
1953 | iteration--;
|
1954 | }
|
1955 |
|
1956 | time > dur && (time = dur);
|
1957 | }
|
1958 |
|
1959 | prevIteration = _animationCycle(this._tTime, cycleDuration);
|
1960 | !prevTime && this._tTime && prevIteration !== iteration && (prevIteration = iteration);
|
1961 |
|
1962 | if (yoyo && iteration & 1) {
|
1963 | time = dur - time;
|
1964 | isYoyo = 1;
|
1965 | }
|
1966 |
|
1967 | if (iteration !== prevIteration && !this._lock) {
|
1968 | var rewinding = yoyo && prevIteration & 1,
|
1969 | doesWrap = rewinding === (yoyo && iteration & 1);
|
1970 | iteration < prevIteration && (rewinding = !rewinding);
|
1971 | prevTime = rewinding ? 0 : dur;
|
1972 | this._lock = 1;
|
1973 | this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0;
|
1974 | this._tTime = tTime;
|
1975 | !suppressEvents && this.parent && _callback(this, "onRepeat");
|
1976 | this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1);
|
1977 |
|
1978 | if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) {
|
1979 | return this;
|
1980 | }
|
1981 |
|
1982 | dur = this._dur;
|
1983 | tDur = this._tDur;
|
1984 |
|
1985 | if (doesWrap) {
|
1986 | this._lock = 2;
|
1987 | prevTime = rewinding ? dur : -0.0001;
|
1988 | this.render(prevTime, true);
|
1989 | this.vars.repeatRefresh && !isYoyo && this.invalidate();
|
1990 | }
|
1991 |
|
1992 | this._lock = 0;
|
1993 |
|
1994 | if (!this._ts && !prevPaused) {
|
1995 | return this;
|
1996 | }
|
1997 |
|
1998 | _propagateYoyoEase(this, isYoyo);
|
1999 | }
|
2000 | }
|
2001 |
|
2002 | if (this._hasPause && !this._forcing && this._lock < 2) {
|
2003 | pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time));
|
2004 |
|
2005 | if (pauseTween) {
|
2006 | tTime -= time - (time = pauseTween._start);
|
2007 | }
|
2008 | }
|
2009 |
|
2010 | this._tTime = tTime;
|
2011 | this._time = time;
|
2012 | this._act = !timeScale;
|
2013 |
|
2014 | if (!this._initted) {
|
2015 | this._onUpdate = this.vars.onUpdate;
|
2016 | this._initted = 1;
|
2017 | this._zTime = totalTime;
|
2018 | prevTime = 0;
|
2019 | }
|
2020 |
|
2021 | if (!prevTime && time && !suppressEvents) {
|
2022 | _callback(this, "onStart");
|
2023 |
|
2024 | if (this._tTime !== tTime) {
|
2025 | return this;
|
2026 | }
|
2027 | }
|
2028 |
|
2029 | if (time >= prevTime && totalTime >= 0) {
|
2030 | child = this._first;
|
2031 |
|
2032 | while (child) {
|
2033 | next = child._next;
|
2034 |
|
2035 | if ((child._act || time >= child._start) && child._ts && pauseTween !== child) {
|
2036 | if (child.parent !== this) {
|
2037 | return this.render(totalTime, suppressEvents, force);
|
2038 | }
|
2039 |
|
2040 | child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force);
|
2041 |
|
2042 | if (time !== this._time || !this._ts && !prevPaused) {
|
2043 | pauseTween = 0;
|
2044 | next && (tTime += this._zTime = -_tinyNum);
|
2045 | break;
|
2046 | }
|
2047 | }
|
2048 |
|
2049 | child = next;
|
2050 | }
|
2051 | } else {
|
2052 | child = this._last;
|
2053 | var adjustedTime = totalTime < 0 ? totalTime : time;
|
2054 |
|
2055 | while (child) {
|
2056 | next = child._prev;
|
2057 |
|
2058 | if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) {
|
2059 | if (child.parent !== this) {
|
2060 | return this.render(totalTime, suppressEvents, force);
|
2061 | }
|
2062 |
|
2063 | child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force);
|
2064 |
|
2065 | if (time !== this._time || !this._ts && !prevPaused) {
|
2066 | pauseTween = 0;
|
2067 | next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum);
|
2068 | break;
|
2069 | }
|
2070 | }
|
2071 |
|
2072 | child = next;
|
2073 | }
|
2074 | }
|
2075 |
|
2076 | if (pauseTween && !suppressEvents) {
|
2077 | this.pause();
|
2078 | pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1;
|
2079 |
|
2080 | if (this._ts) {
|
2081 | this._start = prevStart;
|
2082 |
|
2083 | _setEnd(this);
|
2084 |
|
2085 | return this.render(totalTime, suppressEvents, force);
|
2086 | }
|
2087 | }
|
2088 |
|
2089 | this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true);
|
2090 | if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) if (!this._lock) {
|
2091 | (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
|
2092 |
|
2093 | if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) {
|
2094 | _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true);
|
2095 |
|
2096 | this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
|
2097 | }
|
2098 | }
|
2099 | }
|
2100 |
|
2101 | return this;
|
2102 | };
|
2103 |
|
2104 | _proto2.add = function add(child, position) {
|
2105 | var _this2 = this;
|
2106 |
|
2107 | _isNumber(position) || (position = _parsePosition(this, position, child));
|
2108 |
|
2109 | if (!(child instanceof Animation)) {
|
2110 | if (_isArray(child)) {
|
2111 | child.forEach(function (obj) {
|
2112 | return _this2.add(obj, position);
|
2113 | });
|
2114 | return this;
|
2115 | }
|
2116 |
|
2117 | if (_isString(child)) {
|
2118 | return this.addLabel(child, position);
|
2119 | }
|
2120 |
|
2121 | if (_isFunction(child)) {
|
2122 | child = Tween.delayedCall(0, child);
|
2123 | } else {
|
2124 | return this;
|
2125 | }
|
2126 | }
|
2127 |
|
2128 | return this !== child ? _addToTimeline(this, child, position) : this;
|
2129 | };
|
2130 |
|
2131 | _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) {
|
2132 | if (nested === void 0) {
|
2133 | nested = true;
|
2134 | }
|
2135 |
|
2136 | if (tweens === void 0) {
|
2137 | tweens = true;
|
2138 | }
|
2139 |
|
2140 | if (timelines === void 0) {
|
2141 | timelines = true;
|
2142 | }
|
2143 |
|
2144 | if (ignoreBeforeTime === void 0) {
|
2145 | ignoreBeforeTime = -_bigNum;
|
2146 | }
|
2147 |
|
2148 | var a = [],
|
2149 | child = this._first;
|
2150 |
|
2151 | while (child) {
|
2152 | if (child._start >= ignoreBeforeTime) {
|
2153 | if (child instanceof Tween) {
|
2154 | tweens && a.push(child);
|
2155 | } else {
|
2156 | timelines && a.push(child);
|
2157 | nested && a.push.apply(a, child.getChildren(true, tweens, timelines));
|
2158 | }
|
2159 | }
|
2160 |
|
2161 | child = child._next;
|
2162 | }
|
2163 |
|
2164 | return a;
|
2165 | };
|
2166 |
|
2167 | _proto2.getById = function getById(id) {
|
2168 | var animations = this.getChildren(1, 1, 1),
|
2169 | i = animations.length;
|
2170 |
|
2171 | while (i--) {
|
2172 | if (animations[i].vars.id === id) {
|
2173 | return animations[i];
|
2174 | }
|
2175 | }
|
2176 | };
|
2177 |
|
2178 | _proto2.remove = function remove(child) {
|
2179 | if (_isString(child)) {
|
2180 | return this.removeLabel(child);
|
2181 | }
|
2182 |
|
2183 | if (_isFunction(child)) {
|
2184 | return this.killTweensOf(child);
|
2185 | }
|
2186 |
|
2187 | _removeLinkedListItem(this, child);
|
2188 |
|
2189 | if (child === this._recent) {
|
2190 | this._recent = this._last;
|
2191 | }
|
2192 |
|
2193 | return _uncache(this);
|
2194 | };
|
2195 |
|
2196 | _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) {
|
2197 | if (!arguments.length) {
|
2198 | return this._tTime;
|
2199 | }
|
2200 |
|
2201 | this._forcing = 1;
|
2202 |
|
2203 | if (!this._dp && this._ts) {
|
2204 | this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts));
|
2205 | }
|
2206 |
|
2207 | _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents);
|
2208 |
|
2209 | this._forcing = 0;
|
2210 | return this;
|
2211 | };
|
2212 |
|
2213 | _proto2.addLabel = function addLabel(label, position) {
|
2214 | this.labels[label] = _parsePosition(this, position);
|
2215 | return this;
|
2216 | };
|
2217 |
|
2218 | _proto2.removeLabel = function removeLabel(label) {
|
2219 | delete this.labels[label];
|
2220 | return this;
|
2221 | };
|
2222 |
|
2223 | _proto2.addPause = function addPause(position, callback, params) {
|
2224 | var t = Tween.delayedCall(0, callback || _emptyFunc, params);
|
2225 | t.data = "isPause";
|
2226 | this._hasPause = 1;
|
2227 | return _addToTimeline(this, t, _parsePosition(this, position));
|
2228 | };
|
2229 |
|
2230 | _proto2.removePause = function removePause(position) {
|
2231 | var child = this._first;
|
2232 | position = _parsePosition(this, position);
|
2233 |
|
2234 | while (child) {
|
2235 | if (child._start === position && child.data === "isPause") {
|
2236 | _removeFromParent(child);
|
2237 | }
|
2238 |
|
2239 | child = child._next;
|
2240 | }
|
2241 | };
|
2242 |
|
2243 | _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) {
|
2244 | var tweens = this.getTweensOf(targets, onlyActive),
|
2245 | i = tweens.length;
|
2246 |
|
2247 | while (i--) {
|
2248 | _overwritingTween !== tweens[i] && tweens[i].kill(targets, props);
|
2249 | }
|
2250 |
|
2251 | return this;
|
2252 | };
|
2253 |
|
2254 | _proto2.getTweensOf = function getTweensOf(targets, onlyActive) {
|
2255 | var a = [],
|
2256 | parsedTargets = toArray(targets),
|
2257 | child = this._first,
|
2258 | isGlobalTime = _isNumber(onlyActive),
|
2259 | children;
|
2260 |
|
2261 | while (child) {
|
2262 | if (child instanceof Tween) {
|
2263 | if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) {
|
2264 | a.push(child);
|
2265 | }
|
2266 | } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) {
|
2267 | a.push.apply(a, children);
|
2268 | }
|
2269 |
|
2270 | child = child._next;
|
2271 | }
|
2272 |
|
2273 | return a;
|
2274 | };
|
2275 |
|
2276 | _proto2.tweenTo = function tweenTo(position, vars) {
|
2277 | vars = vars || {};
|
2278 |
|
2279 | var tl = this,
|
2280 | endTime = _parsePosition(tl, position),
|
2281 | _vars = vars,
|
2282 | startAt = _vars.startAt,
|
2283 | _onStart = _vars.onStart,
|
2284 | onStartParams = _vars.onStartParams,
|
2285 | immediateRender = _vars.immediateRender,
|
2286 | initted,
|
2287 | tween = Tween.to(tl, _setDefaults({
|
2288 | ease: vars.ease || "none",
|
2289 | lazy: false,
|
2290 | immediateRender: false,
|
2291 | time: endTime,
|
2292 | overwrite: "auto",
|
2293 | duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum,
|
2294 | onStart: function onStart() {
|
2295 | tl.pause();
|
2296 |
|
2297 | if (!initted) {
|
2298 | var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale());
|
2299 | tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true);
|
2300 | initted = 1;
|
2301 | }
|
2302 |
|
2303 | _onStart && _onStart.apply(tween, onStartParams || []);
|
2304 | }
|
2305 | }, vars));
|
2306 |
|
2307 | return immediateRender ? tween.render(0) : tween;
|
2308 | };
|
2309 |
|
2310 | _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) {
|
2311 | return this.tweenTo(toPosition, _setDefaults({
|
2312 | startAt: {
|
2313 | time: _parsePosition(this, fromPosition)
|
2314 | }
|
2315 | }, vars));
|
2316 | };
|
2317 |
|
2318 | _proto2.recent = function recent() {
|
2319 | return this._recent;
|
2320 | };
|
2321 |
|
2322 | _proto2.nextLabel = function nextLabel(afterTime) {
|
2323 | if (afterTime === void 0) {
|
2324 | afterTime = this._time;
|
2325 | }
|
2326 |
|
2327 | return _getLabelInDirection(this, _parsePosition(this, afterTime));
|
2328 | };
|
2329 |
|
2330 | _proto2.previousLabel = function previousLabel(beforeTime) {
|
2331 | if (beforeTime === void 0) {
|
2332 | beforeTime = this._time;
|
2333 | }
|
2334 |
|
2335 | return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1);
|
2336 | };
|
2337 |
|
2338 | _proto2.currentLabel = function currentLabel(value) {
|
2339 | return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum);
|
2340 | };
|
2341 |
|
2342 | _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) {
|
2343 | if (ignoreBeforeTime === void 0) {
|
2344 | ignoreBeforeTime = 0;
|
2345 | }
|
2346 |
|
2347 | var child = this._first,
|
2348 | labels = this.labels,
|
2349 | p;
|
2350 |
|
2351 | while (child) {
|
2352 | if (child._start >= ignoreBeforeTime) {
|
2353 | child._start += amount;
|
2354 | child._end += amount;
|
2355 | }
|
2356 |
|
2357 | child = child._next;
|
2358 | }
|
2359 |
|
2360 | if (adjustLabels) {
|
2361 | for (p in labels) {
|
2362 | if (labels[p] >= ignoreBeforeTime) {
|
2363 | labels[p] += amount;
|
2364 | }
|
2365 | }
|
2366 | }
|
2367 |
|
2368 | return _uncache(this);
|
2369 | };
|
2370 |
|
2371 | _proto2.invalidate = function invalidate() {
|
2372 | var child = this._first;
|
2373 | this._lock = 0;
|
2374 |
|
2375 | while (child) {
|
2376 | child.invalidate();
|
2377 | child = child._next;
|
2378 | }
|
2379 |
|
2380 | return _Animation.prototype.invalidate.call(this);
|
2381 | };
|
2382 |
|
2383 | _proto2.clear = function clear(includeLabels) {
|
2384 | if (includeLabels === void 0) {
|
2385 | includeLabels = true;
|
2386 | }
|
2387 |
|
2388 | var child = this._first,
|
2389 | next;
|
2390 |
|
2391 | while (child) {
|
2392 | next = child._next;
|
2393 | this.remove(child);
|
2394 | child = next;
|
2395 | }
|
2396 |
|
2397 | this._dp && (this._time = this._tTime = this._pTime = 0);
|
2398 | includeLabels && (this.labels = {});
|
2399 | return _uncache(this);
|
2400 | };
|
2401 |
|
2402 | _proto2.totalDuration = function totalDuration(value) {
|
2403 | var max = 0,
|
2404 | self = this,
|
2405 | child = self._last,
|
2406 | prevStart = _bigNum,
|
2407 | prev,
|
2408 | start,
|
2409 | parent;
|
2410 |
|
2411 | if (arguments.length) {
|
2412 | return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value));
|
2413 | }
|
2414 |
|
2415 | if (self._dirty) {
|
2416 | parent = self.parent;
|
2417 |
|
2418 | while (child) {
|
2419 | prev = child._prev;
|
2420 | child._dirty && child.totalDuration();
|
2421 | start = child._start;
|
2422 |
|
2423 | if (start > prevStart && self._sort && child._ts && !self._lock) {
|
2424 | self._lock = 1;
|
2425 | _addToTimeline(self, child, start - child._delay, 1)._lock = 0;
|
2426 | } else {
|
2427 | prevStart = start;
|
2428 | }
|
2429 |
|
2430 | if (start < 0 && child._ts) {
|
2431 | max -= start;
|
2432 |
|
2433 | if (!parent && !self._dp || parent && parent.smoothChildTiming) {
|
2434 | self._start += start / self._ts;
|
2435 | self._time -= start;
|
2436 | self._tTime -= start;
|
2437 | }
|
2438 |
|
2439 | self.shiftChildren(-start, false, -1e999);
|
2440 | prevStart = 0;
|
2441 | }
|
2442 |
|
2443 | child._end > max && child._ts && (max = child._end);
|
2444 | child = prev;
|
2445 | }
|
2446 |
|
2447 | _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1);
|
2448 |
|
2449 | self._dirty = 0;
|
2450 | }
|
2451 |
|
2452 | return self._tDur;
|
2453 | };
|
2454 |
|
2455 | Timeline.updateRoot = function updateRoot(time) {
|
2456 | if (_globalTimeline._ts) {
|
2457 | _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline));
|
2458 |
|
2459 | _lastRenderedFrame = _ticker.frame;
|
2460 | }
|
2461 |
|
2462 | if (_ticker.frame >= _nextGCFrame) {
|
2463 | _nextGCFrame += _config.autoSleep || 120;
|
2464 | var child = _globalTimeline._first;
|
2465 | if (!child || !child._ts) if (_config.autoSleep && _ticker._listeners.length < 2) {
|
2466 | while (child && !child._ts) {
|
2467 | child = child._next;
|
2468 | }
|
2469 |
|
2470 | child || _ticker.sleep();
|
2471 | }
|
2472 | }
|
2473 | };
|
2474 |
|
2475 | return Timeline;
|
2476 | }(Animation);
|
2477 |
|
2478 | _setDefaults(Timeline.prototype, {
|
2479 | _lock: 0,
|
2480 | _hasPause: 0,
|
2481 | _forcing: 0
|
2482 | });
|
2483 |
|
2484 | var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) {
|
2485 | var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter),
|
2486 | index = 0,
|
2487 | matchIndex = 0,
|
2488 | result,
|
2489 | startNums,
|
2490 | color,
|
2491 | endNum,
|
2492 | chunk,
|
2493 | startNum,
|
2494 | hasRandom,
|
2495 | a;
|
2496 | pt.b = start;
|
2497 | pt.e = end;
|
2498 | start += "";
|
2499 | end += "";
|
2500 |
|
2501 | if (hasRandom = ~end.indexOf("random(")) {
|
2502 | end = _replaceRandom(end);
|
2503 | }
|
2504 |
|
2505 | if (stringFilter) {
|
2506 | a = [start, end];
|
2507 | stringFilter(a, target, prop);
|
2508 | start = a[0];
|
2509 | end = a[1];
|
2510 | }
|
2511 |
|
2512 | startNums = start.match(_complexStringNumExp) || [];
|
2513 |
|
2514 | while (result = _complexStringNumExp.exec(end)) {
|
2515 | endNum = result[0];
|
2516 | chunk = end.substring(index, result.index);
|
2517 |
|
2518 | if (color) {
|
2519 | color = (color + 1) % 5;
|
2520 | } else if (chunk.substr(-5) === "rgba(") {
|
2521 | color = 1;
|
2522 | }
|
2523 |
|
2524 | if (endNum !== startNums[matchIndex++]) {
|
2525 | startNum = parseFloat(startNums[matchIndex - 1]) || 0;
|
2526 | pt._pt = {
|
2527 | _next: pt._pt,
|
2528 | p: chunk || matchIndex === 1 ? chunk : ",",
|
2529 | s: startNum,
|
2530 | c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum,
|
2531 | m: color && color < 4 ? Math.round : 0
|
2532 | };
|
2533 | index = _complexStringNumExp.lastIndex;
|
2534 | }
|
2535 | }
|
2536 |
|
2537 | pt.c = index < end.length ? end.substring(index, end.length) : "";
|
2538 | pt.fp = funcParam;
|
2539 |
|
2540 | if (_relExp.test(end) || hasRandom) {
|
2541 | pt.e = 0;
|
2542 | }
|
2543 |
|
2544 | this._pt = pt;
|
2545 | return pt;
|
2546 | },
|
2547 | _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam) {
|
2548 | _isFunction(end) && (end = end(index || 0, target, targets));
|
2549 | var currentValue = target[prop],
|
2550 | 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](),
|
2551 | setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc,
|
2552 | pt;
|
2553 |
|
2554 | if (_isString(end)) {
|
2555 | if (~end.indexOf("random(")) {
|
2556 | end = _replaceRandom(end);
|
2557 | }
|
2558 |
|
2559 | if (end.charAt(1) === "=") {
|
2560 | pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0);
|
2561 |
|
2562 | if (pt || pt === 0) {
|
2563 | end = pt;
|
2564 | }
|
2565 | }
|
2566 | }
|
2567 |
|
2568 | if (parsedStart !== end || _forceAllPropTweens) {
|
2569 | if (!isNaN(parsedStart * end) && end !== "") {
|
2570 | pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter);
|
2571 | funcParam && (pt.fp = funcParam);
|
2572 | modifier && pt.modifier(modifier, this, target);
|
2573 | return this._pt = pt;
|
2574 | }
|
2575 |
|
2576 | !currentValue && !(prop in target) && _missingPlugin(prop, end);
|
2577 | return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam);
|
2578 | }
|
2579 | },
|
2580 | _processVars = function _processVars(vars, index, target, targets, tween) {
|
2581 | _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets));
|
2582 |
|
2583 | if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) {
|
2584 | return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars;
|
2585 | }
|
2586 |
|
2587 | var copy = {},
|
2588 | p;
|
2589 |
|
2590 | for (p in vars) {
|
2591 | copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets);
|
2592 | }
|
2593 |
|
2594 | return copy;
|
2595 | },
|
2596 | _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) {
|
2597 | var plugin, pt, ptLookup, i;
|
2598 |
|
2599 | if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) {
|
2600 | tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority);
|
2601 |
|
2602 | if (tween !== _quickTween) {
|
2603 | ptLookup = tween._ptLookup[tween._targets.indexOf(target)];
|
2604 | i = plugin._props.length;
|
2605 |
|
2606 | while (i--) {
|
2607 | ptLookup[plugin._props[i]] = pt;
|
2608 | }
|
2609 | }
|
2610 | }
|
2611 |
|
2612 | return plugin;
|
2613 | },
|
2614 | _overwritingTween,
|
2615 | _forceAllPropTweens,
|
2616 | _initTween = function _initTween(tween, time) {
|
2617 | var vars = tween.vars,
|
2618 | ease = vars.ease,
|
2619 | startAt = vars.startAt,
|
2620 | immediateRender = vars.immediateRender,
|
2621 | lazy = vars.lazy,
|
2622 | onUpdate = vars.onUpdate,
|
2623 | onUpdateParams = vars.onUpdateParams,
|
2624 | callbackScope = vars.callbackScope,
|
2625 | runBackwards = vars.runBackwards,
|
2626 | yoyoEase = vars.yoyoEase,
|
2627 | keyframes = vars.keyframes,
|
2628 | autoRevert = vars.autoRevert,
|
2629 | dur = tween._dur,
|
2630 | prevStartAt = tween._startAt,
|
2631 | targets = tween._targets,
|
2632 | parent = tween.parent,
|
2633 | fullTargets = parent && parent.data === "nested" ? parent.parent._targets : targets,
|
2634 | autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites,
|
2635 | tl = tween.timeline,
|
2636 | cleanVars,
|
2637 | i,
|
2638 | p,
|
2639 | pt,
|
2640 | target,
|
2641 | hasPriority,
|
2642 | gsData,
|
2643 | harness,
|
2644 | plugin,
|
2645 | ptLookup,
|
2646 | index,
|
2647 | harnessVars,
|
2648 | overwritten;
|
2649 | tl && (!keyframes || !ease) && (ease = "none");
|
2650 | tween._ease = _parseEase(ease, _defaults.ease);
|
2651 | tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0;
|
2652 |
|
2653 | if (yoyoEase && tween._yoyo && !tween._repeat) {
|
2654 | yoyoEase = tween._yEase;
|
2655 | tween._yEase = tween._ease;
|
2656 | tween._ease = yoyoEase;
|
2657 | }
|
2658 |
|
2659 | tween._from = !tl && !!vars.runBackwards;
|
2660 |
|
2661 | if (!tl || keyframes && !vars.stagger) {
|
2662 | harness = targets[0] ? _getCache(targets[0]).harness : 0;
|
2663 | harnessVars = harness && vars[harness.prop];
|
2664 | cleanVars = _copyExcluding(vars, _reservedProps);
|
2665 |
|
2666 | if (prevStartAt) {
|
2667 | _removeFromParent(prevStartAt.render(-1, true));
|
2668 |
|
2669 | prevStartAt._lazy = 0;
|
2670 | }
|
2671 |
|
2672 | if (startAt) {
|
2673 | _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({
|
2674 | data: "isStart",
|
2675 | overwrite: false,
|
2676 | parent: parent,
|
2677 | immediateRender: true,
|
2678 | lazy: _isNotFalse(lazy),
|
2679 | startAt: null,
|
2680 | delay: 0,
|
2681 | onUpdate: onUpdate,
|
2682 | onUpdateParams: onUpdateParams,
|
2683 | callbackScope: callbackScope,
|
2684 | stagger: 0
|
2685 | }, startAt)));
|
2686 |
|
2687 | time < 0 && !immediateRender && !autoRevert && tween._startAt.render(-1, true);
|
2688 |
|
2689 | if (immediateRender) {
|
2690 | time > 0 && !autoRevert && (tween._startAt = 0);
|
2691 |
|
2692 | if (dur && time <= 0) {
|
2693 | time && (tween._zTime = time);
|
2694 | return;
|
2695 | }
|
2696 | } else if (autoRevert === false) {
|
2697 | tween._startAt = 0;
|
2698 | }
|
2699 | } else if (runBackwards && dur) {
|
2700 | if (prevStartAt) {
|
2701 | !autoRevert && (tween._startAt = 0);
|
2702 | } else {
|
2703 | time && (immediateRender = false);
|
2704 | p = _setDefaults({
|
2705 | overwrite: false,
|
2706 | data: "isFromStart",
|
2707 | lazy: immediateRender && _isNotFalse(lazy),
|
2708 | immediateRender: immediateRender,
|
2709 | stagger: 0,
|
2710 | parent: parent
|
2711 | }, cleanVars);
|
2712 | harnessVars && (p[harness.prop] = harnessVars);
|
2713 |
|
2714 | _removeFromParent(tween._startAt = Tween.set(targets, p));
|
2715 |
|
2716 | time < 0 && tween._startAt.render(-1, true);
|
2717 | tween._zTime = time;
|
2718 |
|
2719 | if (!immediateRender) {
|
2720 | _initTween(tween._startAt, _tinyNum);
|
2721 | } else if (!time) {
|
2722 | return;
|
2723 | }
|
2724 | }
|
2725 | }
|
2726 |
|
2727 | tween._pt = tween._ptCache = 0;
|
2728 | lazy = dur && _isNotFalse(lazy) || lazy && !dur;
|
2729 |
|
2730 | for (i = 0; i < targets.length; i++) {
|
2731 | target = targets[i];
|
2732 | gsData = target._gsap || _harness(targets)[i]._gsap;
|
2733 | tween._ptLookup[i] = ptLookup = {};
|
2734 | _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender();
|
2735 | index = fullTargets === targets ? i : fullTargets.indexOf(target);
|
2736 |
|
2737 | if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) {
|
2738 | tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority);
|
2739 |
|
2740 | plugin._props.forEach(function (name) {
|
2741 | ptLookup[name] = pt;
|
2742 | });
|
2743 |
|
2744 | plugin.priority && (hasPriority = 1);
|
2745 | }
|
2746 |
|
2747 | if (!harness || harnessVars) {
|
2748 | for (p in cleanVars) {
|
2749 | if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) {
|
2750 | plugin.priority && (hasPriority = 1);
|
2751 | } else {
|
2752 | ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter);
|
2753 | }
|
2754 | }
|
2755 | }
|
2756 |
|
2757 | tween._op && tween._op[i] && tween.kill(target, tween._op[i]);
|
2758 |
|
2759 | if (autoOverwrite && tween._pt) {
|
2760 | _overwritingTween = tween;
|
2761 |
|
2762 | _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time));
|
2763 |
|
2764 | overwritten = !tween.parent;
|
2765 | _overwritingTween = 0;
|
2766 | }
|
2767 |
|
2768 | tween._pt && lazy && (_lazyLookup[gsData.id] = 1);
|
2769 | }
|
2770 |
|
2771 | hasPriority && _sortPropTweensByPriority(tween);
|
2772 | tween._onInit && tween._onInit(tween);
|
2773 | }
|
2774 |
|
2775 | tween._onUpdate = onUpdate;
|
2776 | tween._initted = (!tween._op || tween._pt) && !overwritten;
|
2777 | keyframes && time <= 0 && tl.render(_bigNum, true, true);
|
2778 | },
|
2779 | _updatePropTweens = function _updatePropTweens(tween, property, value, start, startIsRelative, ratio, time) {
|
2780 | var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property],
|
2781 | pt,
|
2782 | lookup,
|
2783 | i;
|
2784 |
|
2785 | if (!ptCache) {
|
2786 | ptCache = tween._ptCache[property] = [];
|
2787 | lookup = tween._ptLookup;
|
2788 | i = tween._targets.length;
|
2789 |
|
2790 | while (i--) {
|
2791 | pt = lookup[i][property];
|
2792 |
|
2793 | if (pt && pt.d && pt.d._pt) {
|
2794 | pt = pt.d._pt;
|
2795 |
|
2796 | while (pt && pt.p !== property) {
|
2797 | pt = pt._next;
|
2798 | }
|
2799 | }
|
2800 |
|
2801 | if (!pt) {
|
2802 | _forceAllPropTweens = 1;
|
2803 | tween.vars[property] = "+=0";
|
2804 |
|
2805 | _initTween(tween, time);
|
2806 |
|
2807 | _forceAllPropTweens = 0;
|
2808 | return 1;
|
2809 | }
|
2810 |
|
2811 | ptCache.push(pt);
|
2812 | }
|
2813 | }
|
2814 |
|
2815 | i = ptCache.length;
|
2816 |
|
2817 | while (i--) {
|
2818 | pt = ptCache[i];
|
2819 | pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c;
|
2820 | pt.c = value - pt.s;
|
2821 | pt.e && (pt.e = _round(value) + getUnit(pt.e));
|
2822 | pt.b && (pt.b = pt.s + getUnit(pt.b));
|
2823 | }
|
2824 | },
|
2825 | _addAliasesToVars = function _addAliasesToVars(targets, vars) {
|
2826 | var harness = targets[0] ? _getCache(targets[0]).harness : 0,
|
2827 | propertyAliases = harness && harness.aliases,
|
2828 | copy,
|
2829 | p,
|
2830 | i,
|
2831 | aliases;
|
2832 |
|
2833 | if (!propertyAliases) {
|
2834 | return vars;
|
2835 | }
|
2836 |
|
2837 | copy = _merge({}, vars);
|
2838 |
|
2839 | for (p in propertyAliases) {
|
2840 | if (p in copy) {
|
2841 | aliases = propertyAliases[p].split(",");
|
2842 | i = aliases.length;
|
2843 |
|
2844 | while (i--) {
|
2845 | copy[aliases[i]] = copy[p];
|
2846 | }
|
2847 | }
|
2848 | }
|
2849 |
|
2850 | return copy;
|
2851 | },
|
2852 | _parseKeyframe = function _parseKeyframe(prop, obj, allProps, easeEach) {
|
2853 | var ease = obj.ease || easeEach || "power1.inOut",
|
2854 | p,
|
2855 | a;
|
2856 |
|
2857 | if (_isArray(obj)) {
|
2858 | a = allProps[prop] || (allProps[prop] = []);
|
2859 | obj.forEach(function (value, i) {
|
2860 | return a.push({
|
2861 | t: i / (obj.length - 1) * 100,
|
2862 | v: value,
|
2863 | e: ease
|
2864 | });
|
2865 | });
|
2866 | } else {
|
2867 | for (p in obj) {
|
2868 | a = allProps[p] || (allProps[p] = []);
|
2869 | p === "ease" || a.push({
|
2870 | t: parseFloat(prop),
|
2871 | v: obj[p],
|
2872 | e: ease
|
2873 | });
|
2874 | }
|
2875 | }
|
2876 | },
|
2877 | _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) {
|
2878 | return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value;
|
2879 | },
|
2880 | _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",
|
2881 | _staggerPropsToSkip = {};
|
2882 |
|
2883 | _forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function (name) {
|
2884 | return _staggerPropsToSkip[name] = 1;
|
2885 | });
|
2886 |
|
2887 | var Tween = function (_Animation2) {
|
2888 | _inheritsLoose(Tween, _Animation2);
|
2889 |
|
2890 | function Tween(targets, vars, position, skipInherit) {
|
2891 | var _this3;
|
2892 |
|
2893 | if (typeof vars === "number") {
|
2894 | position.duration = vars;
|
2895 | vars = position;
|
2896 | position = null;
|
2897 | }
|
2898 |
|
2899 | _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this;
|
2900 | var _this3$vars = _this3.vars,
|
2901 | duration = _this3$vars.duration,
|
2902 | delay = _this3$vars.delay,
|
2903 | immediateRender = _this3$vars.immediateRender,
|
2904 | stagger = _this3$vars.stagger,
|
2905 | overwrite = _this3$vars.overwrite,
|
2906 | keyframes = _this3$vars.keyframes,
|
2907 | defaults = _this3$vars.defaults,
|
2908 | scrollTrigger = _this3$vars.scrollTrigger,
|
2909 | yoyoEase = _this3$vars.yoyoEase,
|
2910 | parent = vars.parent || _globalTimeline,
|
2911 | parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [targets] : toArray(targets),
|
2912 | tl,
|
2913 | i,
|
2914 | copy,
|
2915 | l,
|
2916 | p,
|
2917 | curTarget,
|
2918 | staggerFunc,
|
2919 | staggerVarsToMerge;
|
2920 | _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://greensock.com", !_config.nullTargetWarn) || [];
|
2921 | _this3._ptLookup = [];
|
2922 | _this3._overwrite = overwrite;
|
2923 |
|
2924 | if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
|
2925 | vars = _this3.vars;
|
2926 | tl = _this3.timeline = new Timeline({
|
2927 | data: "nested",
|
2928 | defaults: defaults || {}
|
2929 | });
|
2930 | tl.kill();
|
2931 | tl.parent = tl._dp = _assertThisInitialized(_this3);
|
2932 | tl._start = 0;
|
2933 |
|
2934 | if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
|
2935 | l = parsedTargets.length;
|
2936 | staggerFunc = stagger && distribute(stagger);
|
2937 |
|
2938 | if (_isObject(stagger)) {
|
2939 | for (p in stagger) {
|
2940 | if (~_staggerTweenProps.indexOf(p)) {
|
2941 | staggerVarsToMerge || (staggerVarsToMerge = {});
|
2942 | staggerVarsToMerge[p] = stagger[p];
|
2943 | }
|
2944 | }
|
2945 | }
|
2946 |
|
2947 | for (i = 0; i < l; i++) {
|
2948 | copy = _copyExcluding(vars, _staggerPropsToSkip);
|
2949 | copy.stagger = 0;
|
2950 | yoyoEase && (copy.yoyoEase = yoyoEase);
|
2951 | staggerVarsToMerge && _merge(copy, staggerVarsToMerge);
|
2952 | curTarget = parsedTargets[i];
|
2953 | copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets);
|
2954 | copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay;
|
2955 |
|
2956 | if (!stagger && l === 1 && copy.delay) {
|
2957 | _this3._delay = delay = copy.delay;
|
2958 | _this3._start += delay;
|
2959 | copy.delay = 0;
|
2960 | }
|
2961 |
|
2962 | tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0);
|
2963 | tl._ease = _easeMap.none;
|
2964 | }
|
2965 |
|
2966 | tl.duration() ? duration = delay = 0 : _this3.timeline = 0;
|
2967 | } else if (keyframes) {
|
2968 | _inheritDefaults(_setDefaults(tl.vars.defaults, {
|
2969 | ease: "none"
|
2970 | }));
|
2971 |
|
2972 | tl._ease = _parseEase(keyframes.ease || vars.ease || "none");
|
2973 | var time = 0,
|
2974 | a,
|
2975 | kf,
|
2976 | v;
|
2977 |
|
2978 | if (_isArray(keyframes)) {
|
2979 | keyframes.forEach(function (frame) {
|
2980 | return tl.to(parsedTargets, frame, ">");
|
2981 | });
|
2982 | } else {
|
2983 | copy = {};
|
2984 |
|
2985 | for (p in keyframes) {
|
2986 | p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach);
|
2987 | }
|
2988 |
|
2989 | for (p in copy) {
|
2990 | a = copy[p].sort(function (a, b) {
|
2991 | return a.t - b.t;
|
2992 | });
|
2993 | time = 0;
|
2994 |
|
2995 | for (i = 0; i < a.length; i++) {
|
2996 | kf = a[i];
|
2997 | v = {
|
2998 | ease: kf.e,
|
2999 | duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration
|
3000 | };
|
3001 | v[p] = kf.v;
|
3002 | tl.to(parsedTargets, v, time);
|
3003 | time += v.duration;
|
3004 | }
|
3005 | }
|
3006 |
|
3007 | tl.duration() < duration && tl.to({}, {
|
3008 | duration: duration - tl.duration()
|
3009 | });
|
3010 | }
|
3011 | }
|
3012 |
|
3013 | duration || _this3.duration(duration = tl.duration());
|
3014 | } else {
|
3015 | _this3.timeline = 0;
|
3016 | }
|
3017 |
|
3018 | if (overwrite === true && !_suppressOverwrites) {
|
3019 | _overwritingTween = _assertThisInitialized(_this3);
|
3020 |
|
3021 | _globalTimeline.killTweensOf(parsedTargets);
|
3022 |
|
3023 | _overwritingTween = 0;
|
3024 | }
|
3025 |
|
3026 | _addToTimeline(parent, _assertThisInitialized(_this3), position);
|
3027 |
|
3028 | vars.reversed && _this3.reverse();
|
3029 | vars.paused && _this3.paused(true);
|
3030 |
|
3031 | if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") {
|
3032 | _this3._tTime = -_tinyNum;
|
3033 |
|
3034 | _this3.render(Math.max(0, -delay));
|
3035 | }
|
3036 |
|
3037 | scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger);
|
3038 | return _this3;
|
3039 | }
|
3040 |
|
3041 | var _proto3 = Tween.prototype;
|
3042 |
|
3043 | _proto3.render = function render(totalTime, suppressEvents, force) {
|
3044 | var prevTime = this._time,
|
3045 | tDur = this._tDur,
|
3046 | dur = this._dur,
|
3047 | tTime = totalTime > tDur - _tinyNum && totalTime >= 0 ? tDur : totalTime < _tinyNum ? 0 : totalTime,
|
3048 | time,
|
3049 | pt,
|
3050 | iteration,
|
3051 | cycleDuration,
|
3052 | prevIteration,
|
3053 | isYoyo,
|
3054 | ratio,
|
3055 | timeline,
|
3056 | yoyoEase;
|
3057 |
|
3058 | if (!dur) {
|
3059 | _renderZeroDurationTween(this, totalTime, suppressEvents, force);
|
3060 | } else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== totalTime < 0) {
|
3061 | time = tTime;
|
3062 | timeline = this.timeline;
|
3063 |
|
3064 | if (this._repeat) {
|
3065 | cycleDuration = dur + this._rDelay;
|
3066 |
|
3067 | if (this._repeat < -1 && totalTime < 0) {
|
3068 | return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
|
3069 | }
|
3070 |
|
3071 | time = _roundPrecise(tTime % cycleDuration);
|
3072 |
|
3073 | if (tTime === tDur) {
|
3074 | iteration = this._repeat;
|
3075 | time = dur;
|
3076 | } else {
|
3077 | iteration = ~~(tTime / cycleDuration);
|
3078 |
|
3079 | if (iteration && iteration === tTime / cycleDuration) {
|
3080 | time = dur;
|
3081 | iteration--;
|
3082 | }
|
3083 |
|
3084 | time > dur && (time = dur);
|
3085 | }
|
3086 |
|
3087 | isYoyo = this._yoyo && iteration & 1;
|
3088 |
|
3089 | if (isYoyo) {
|
3090 | yoyoEase = this._yEase;
|
3091 | time = dur - time;
|
3092 | }
|
3093 |
|
3094 | prevIteration = _animationCycle(this._tTime, cycleDuration);
|
3095 |
|
3096 | if (time === prevTime && !force && this._initted) {
|
3097 | this._tTime = tTime;
|
3098 | return this;
|
3099 | }
|
3100 |
|
3101 | if (iteration !== prevIteration) {
|
3102 | timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo);
|
3103 |
|
3104 | if (this.vars.repeatRefresh && !isYoyo && !this._lock) {
|
3105 | this._lock = force = 1;
|
3106 | this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0;
|
3107 | }
|
3108 | }
|
3109 | }
|
3110 |
|
3111 | if (!this._initted) {
|
3112 | if (_attemptInitTween(this, totalTime < 0 ? totalTime : time, force, suppressEvents)) {
|
3113 | this._tTime = 0;
|
3114 | return this;
|
3115 | }
|
3116 |
|
3117 | if (prevTime !== this._time) {
|
3118 | return this;
|
3119 | }
|
3120 |
|
3121 | if (dur !== this._dur) {
|
3122 | return this.render(totalTime, suppressEvents, force);
|
3123 | }
|
3124 | }
|
3125 |
|
3126 | this._tTime = tTime;
|
3127 | this._time = time;
|
3128 |
|
3129 | if (!this._act && this._ts) {
|
3130 | this._act = 1;
|
3131 | this._lazy = 0;
|
3132 | }
|
3133 |
|
3134 | this.ratio = ratio = (yoyoEase || this._ease)(time / dur);
|
3135 |
|
3136 | if (this._from) {
|
3137 | this.ratio = ratio = 1 - ratio;
|
3138 | }
|
3139 |
|
3140 | if (time && !prevTime && !suppressEvents) {
|
3141 | _callback(this, "onStart");
|
3142 |
|
3143 | if (this._tTime !== tTime) {
|
3144 | return this;
|
3145 | }
|
3146 | }
|
3147 |
|
3148 | pt = this._pt;
|
3149 |
|
3150 | while (pt) {
|
3151 | pt.r(ratio, pt.d);
|
3152 | pt = pt._next;
|
3153 | }
|
3154 |
|
3155 | timeline && timeline.render(totalTime < 0 ? totalTime : !time && isYoyo ? -_tinyNum : timeline._dur * timeline._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime);
|
3156 |
|
3157 | if (this._onUpdate && !suppressEvents) {
|
3158 | totalTime < 0 && this._startAt && this._startAt.render(totalTime, true, force);
|
3159 |
|
3160 | _callback(this, "onUpdate");
|
3161 | }
|
3162 |
|
3163 | this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat");
|
3164 |
|
3165 | if ((tTime === this._tDur || !tTime) && this._tTime === tTime) {
|
3166 | totalTime < 0 && this._startAt && !this._onUpdate && this._startAt.render(totalTime, true, true);
|
3167 | (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
|
3168 |
|
3169 | if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime)) {
|
3170 | _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true);
|
3171 |
|
3172 | this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
|
3173 | }
|
3174 | }
|
3175 | }
|
3176 |
|
3177 | return this;
|
3178 | };
|
3179 |
|
3180 | _proto3.targets = function targets() {
|
3181 | return this._targets;
|
3182 | };
|
3183 |
|
3184 | _proto3.invalidate = function invalidate() {
|
3185 | this._pt = this._op = this._startAt = this._onUpdate = this._lazy = this.ratio = 0;
|
3186 | this._ptLookup = [];
|
3187 | this.timeline && this.timeline.invalidate();
|
3188 | return _Animation2.prototype.invalidate.call(this);
|
3189 | };
|
3190 |
|
3191 | _proto3.resetTo = function resetTo(property, value, start, startIsRelative) {
|
3192 | _tickerActive || _ticker.wake();
|
3193 | this._ts || this.play();
|
3194 | var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts),
|
3195 | ratio;
|
3196 | this._initted || _initTween(this, time);
|
3197 | ratio = this._ease(time / this._dur);
|
3198 |
|
3199 | if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time)) {
|
3200 | return this.resetTo(property, value, start, startIsRelative);
|
3201 | }
|
3202 |
|
3203 | _alignPlayhead(this, 0);
|
3204 |
|
3205 | this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0);
|
3206 | return this.render(0);
|
3207 | };
|
3208 |
|
3209 | _proto3.kill = function kill(targets, vars) {
|
3210 | if (vars === void 0) {
|
3211 | vars = "all";
|
3212 | }
|
3213 |
|
3214 | if (!targets && (!vars || vars === "all")) {
|
3215 | this._lazy = this._pt = 0;
|
3216 | return this.parent ? _interrupt(this) : this;
|
3217 | }
|
3218 |
|
3219 | if (this.timeline) {
|
3220 | var tDur = this.timeline.totalDuration();
|
3221 | this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this);
|
3222 | this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1);
|
3223 | return this;
|
3224 | }
|
3225 |
|
3226 | var parsedTargets = this._targets,
|
3227 | killingTargets = targets ? toArray(targets) : parsedTargets,
|
3228 | propTweenLookup = this._ptLookup,
|
3229 | firstPT = this._pt,
|
3230 | overwrittenProps,
|
3231 | curLookup,
|
3232 | curOverwriteProps,
|
3233 | props,
|
3234 | p,
|
3235 | pt,
|
3236 | i;
|
3237 |
|
3238 | if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) {
|
3239 | vars === "all" && (this._pt = 0);
|
3240 | return _interrupt(this);
|
3241 | }
|
3242 |
|
3243 | overwrittenProps = this._op = this._op || [];
|
3244 |
|
3245 | if (vars !== "all") {
|
3246 | if (_isString(vars)) {
|
3247 | p = {};
|
3248 |
|
3249 | _forEachName(vars, function (name) {
|
3250 | return p[name] = 1;
|
3251 | });
|
3252 |
|
3253 | vars = p;
|
3254 | }
|
3255 |
|
3256 | vars = _addAliasesToVars(parsedTargets, vars);
|
3257 | }
|
3258 |
|
3259 | i = parsedTargets.length;
|
3260 |
|
3261 | while (i--) {
|
3262 | if (~killingTargets.indexOf(parsedTargets[i])) {
|
3263 | curLookup = propTweenLookup[i];
|
3264 |
|
3265 | if (vars === "all") {
|
3266 | overwrittenProps[i] = vars;
|
3267 | props = curLookup;
|
3268 | curOverwriteProps = {};
|
3269 | } else {
|
3270 | curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {};
|
3271 | props = vars;
|
3272 | }
|
3273 |
|
3274 | for (p in props) {
|
3275 | pt = curLookup && curLookup[p];
|
3276 |
|
3277 | if (pt) {
|
3278 | if (!("kill" in pt.d) || pt.d.kill(p) === true) {
|
3279 | _removeLinkedListItem(this, pt, "_pt");
|
3280 | }
|
3281 |
|
3282 | delete curLookup[p];
|
3283 | }
|
3284 |
|
3285 | if (curOverwriteProps !== "all") {
|
3286 | curOverwriteProps[p] = 1;
|
3287 | }
|
3288 | }
|
3289 | }
|
3290 | }
|
3291 |
|
3292 | this._initted && !this._pt && firstPT && _interrupt(this);
|
3293 | return this;
|
3294 | };
|
3295 |
|
3296 | Tween.to = function to(targets, vars) {
|
3297 | return new Tween(targets, vars, arguments[2]);
|
3298 | };
|
3299 |
|
3300 | Tween.from = function from(targets, vars) {
|
3301 | return _createTweenType(1, arguments);
|
3302 | };
|
3303 |
|
3304 | Tween.delayedCall = function delayedCall(delay, callback, params, scope) {
|
3305 | return new Tween(callback, 0, {
|
3306 | immediateRender: false,
|
3307 | lazy: false,
|
3308 | overwrite: false,
|
3309 | delay: delay,
|
3310 | onComplete: callback,
|
3311 | onReverseComplete: callback,
|
3312 | onCompleteParams: params,
|
3313 | onReverseCompleteParams: params,
|
3314 | callbackScope: scope
|
3315 | });
|
3316 | };
|
3317 |
|
3318 | Tween.fromTo = function fromTo(targets, fromVars, toVars) {
|
3319 | return _createTweenType(2, arguments);
|
3320 | };
|
3321 |
|
3322 | Tween.set = function set(targets, vars) {
|
3323 | vars.duration = 0;
|
3324 | vars.repeatDelay || (vars.repeat = 0);
|
3325 | return new Tween(targets, vars);
|
3326 | };
|
3327 |
|
3328 | Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) {
|
3329 | return _globalTimeline.killTweensOf(targets, props, onlyActive);
|
3330 | };
|
3331 |
|
3332 | return Tween;
|
3333 | }(Animation);
|
3334 |
|
3335 | _setDefaults(Tween.prototype, {
|
3336 | _targets: [],
|
3337 | _lazy: 0,
|
3338 | _startAt: 0,
|
3339 | _op: 0,
|
3340 | _onInit: 0
|
3341 | });
|
3342 |
|
3343 | _forEachName("staggerTo,staggerFrom,staggerFromTo", function (name) {
|
3344 | Tween[name] = function () {
|
3345 | var tl = new Timeline(),
|
3346 | params = _slice.call(arguments, 0);
|
3347 |
|
3348 | params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0);
|
3349 | return tl[name].apply(tl, params);
|
3350 | };
|
3351 | });
|
3352 |
|
3353 | var _setterPlain = function _setterPlain(target, property, value) {
|
3354 | return target[property] = value;
|
3355 | },
|
3356 | _setterFunc = function _setterFunc(target, property, value) {
|
3357 | return target[property](value);
|
3358 | },
|
3359 | _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) {
|
3360 | return target[property](data.fp, value);
|
3361 | },
|
3362 | _setterAttribute = function _setterAttribute(target, property, value) {
|
3363 | return target.setAttribute(property, value);
|
3364 | },
|
3365 | _getSetter = function _getSetter(target, property) {
|
3366 | return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain;
|
3367 | },
|
3368 | _renderPlain = function _renderPlain(ratio, data) {
|
3369 | return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1000000) / 1000000, data);
|
3370 | },
|
3371 | _renderBoolean = function _renderBoolean(ratio, data) {
|
3372 | return data.set(data.t, data.p, !!(data.s + data.c * ratio), data);
|
3373 | },
|
3374 | _renderComplexString = function _renderComplexString(ratio, data) {
|
3375 | var pt = data._pt,
|
3376 | s = "";
|
3377 |
|
3378 | if (!ratio && data.b) {
|
3379 | s = data.b;
|
3380 | } else if (ratio === 1 && data.e) {
|
3381 | s = data.e;
|
3382 | } else {
|
3383 | while (pt) {
|
3384 | s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s;
|
3385 | pt = pt._next;
|
3386 | }
|
3387 |
|
3388 | s += data.c;
|
3389 | }
|
3390 |
|
3391 | data.set(data.t, data.p, s, data);
|
3392 | },
|
3393 | _renderPropTweens = function _renderPropTweens(ratio, data) {
|
3394 | var pt = data._pt;
|
3395 |
|
3396 | while (pt) {
|
3397 | pt.r(ratio, pt.d);
|
3398 | pt = pt._next;
|
3399 | }
|
3400 | },
|
3401 | _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) {
|
3402 | var pt = this._pt,
|
3403 | next;
|
3404 |
|
3405 | while (pt) {
|
3406 | next = pt._next;
|
3407 | pt.p === property && pt.modifier(modifier, tween, target);
|
3408 | pt = next;
|
3409 | }
|
3410 | },
|
3411 | _killPropTweensOf = function _killPropTweensOf(property) {
|
3412 | var pt = this._pt,
|
3413 | hasNonDependentRemaining,
|
3414 | next;
|
3415 |
|
3416 | while (pt) {
|
3417 | next = pt._next;
|
3418 |
|
3419 | if (pt.p === property && !pt.op || pt.op === property) {
|
3420 | _removeLinkedListItem(this, pt, "_pt");
|
3421 | } else if (!pt.dep) {
|
3422 | hasNonDependentRemaining = 1;
|
3423 | }
|
3424 |
|
3425 | pt = next;
|
3426 | }
|
3427 |
|
3428 | return !hasNonDependentRemaining;
|
3429 | },
|
3430 | _setterWithModifier = function _setterWithModifier(target, property, value, data) {
|
3431 | data.mSet(target, property, data.m.call(data.tween, value, data.mt), data);
|
3432 | },
|
3433 | _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) {
|
3434 | var pt = parent._pt,
|
3435 | next,
|
3436 | pt2,
|
3437 | first,
|
3438 | last;
|
3439 |
|
3440 | while (pt) {
|
3441 | next = pt._next;
|
3442 | pt2 = first;
|
3443 |
|
3444 | while (pt2 && pt2.pr > pt.pr) {
|
3445 | pt2 = pt2._next;
|
3446 | }
|
3447 |
|
3448 | if (pt._prev = pt2 ? pt2._prev : last) {
|
3449 | pt._prev._next = pt;
|
3450 | } else {
|
3451 | first = pt;
|
3452 | }
|
3453 |
|
3454 | if (pt._next = pt2) {
|
3455 | pt2._prev = pt;
|
3456 | } else {
|
3457 | last = pt;
|
3458 | }
|
3459 |
|
3460 | pt = next;
|
3461 | }
|
3462 |
|
3463 | parent._pt = first;
|
3464 | };
|
3465 |
|
3466 | var PropTween = function () {
|
3467 | function PropTween(next, target, prop, start, change, renderer, data, setter, priority) {
|
3468 | this.t = target;
|
3469 | this.s = start;
|
3470 | this.c = change;
|
3471 | this.p = prop;
|
3472 | this.r = renderer || _renderPlain;
|
3473 | this.d = data || this;
|
3474 | this.set = setter || _setterPlain;
|
3475 | this.pr = priority || 0;
|
3476 | this._next = next;
|
3477 |
|
3478 | if (next) {
|
3479 | next._prev = this;
|
3480 | }
|
3481 | }
|
3482 |
|
3483 | var _proto4 = PropTween.prototype;
|
3484 |
|
3485 | _proto4.modifier = function modifier(func, tween, target) {
|
3486 | this.mSet = this.mSet || this.set;
|
3487 | this.set = _setterWithModifier;
|
3488 | this.m = func;
|
3489 | this.mt = target;
|
3490 | this.tween = tween;
|
3491 | };
|
3492 |
|
3493 | return PropTween;
|
3494 | }();
|
3495 |
|
3496 | _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) {
|
3497 | return _reservedProps[name] = 1;
|
3498 | });
|
3499 |
|
3500 | _globals.TweenMax = _globals.TweenLite = Tween;
|
3501 | _globals.TimelineLite = _globals.TimelineMax = Timeline;
|
3502 | _globalTimeline = new Timeline({
|
3503 | sortChildren: false,
|
3504 | defaults: _defaults,
|
3505 | autoRemoveChildren: true,
|
3506 | id: "root",
|
3507 | smoothChildTiming: true
|
3508 | });
|
3509 | _config.stringFilter = _colorStringFilter;
|
3510 | var _gsap = {
|
3511 | registerPlugin: function registerPlugin() {
|
3512 | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
3513 | args[_key2] = arguments[_key2];
|
3514 | }
|
3515 |
|
3516 | args.forEach(function (config) {
|
3517 | return _createPlugin(config);
|
3518 | });
|
3519 | },
|
3520 | timeline: function timeline(vars) {
|
3521 | return new Timeline(vars);
|
3522 | },
|
3523 | getTweensOf: function getTweensOf(targets, onlyActive) {
|
3524 | return _globalTimeline.getTweensOf(targets, onlyActive);
|
3525 | },
|
3526 | getProperty: function getProperty(target, property, unit, uncache) {
|
3527 | _isString(target) && (target = toArray(target)[0]);
|
3528 |
|
3529 | var getter = _getCache(target || {}).get,
|
3530 | format = unit ? _passThrough : _numericIfPossible;
|
3531 |
|
3532 | unit === "native" && (unit = "");
|
3533 | return !target ? target : !property ? function (property, unit, uncache) {
|
3534 | return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
|
3535 | } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
|
3536 | },
|
3537 | quickSetter: function quickSetter(target, property, unit) {
|
3538 | target = toArray(target);
|
3539 |
|
3540 | if (target.length > 1) {
|
3541 | var setters = target.map(function (t) {
|
3542 | return gsap.quickSetter(t, property, unit);
|
3543 | }),
|
3544 | l = setters.length;
|
3545 | return function (value) {
|
3546 | var i = l;
|
3547 |
|
3548 | while (i--) {
|
3549 | setters[i](value);
|
3550 | }
|
3551 | };
|
3552 | }
|
3553 |
|
3554 | target = target[0] || {};
|
3555 |
|
3556 | var Plugin = _plugins[property],
|
3557 | cache = _getCache(target),
|
3558 | p = cache.harness && (cache.harness.aliases || {})[property] || property,
|
3559 | setter = Plugin ? function (value) {
|
3560 | var p = new Plugin();
|
3561 | _quickTween._pt = 0;
|
3562 | p.init(target, unit ? value + unit : value, _quickTween, 0, [target]);
|
3563 | p.render(1, p);
|
3564 | _quickTween._pt && _renderPropTweens(1, _quickTween);
|
3565 | } : cache.set(target, p);
|
3566 |
|
3567 | return Plugin ? setter : function (value) {
|
3568 | return setter(target, p, unit ? value + unit : value, cache, 1);
|
3569 | };
|
3570 | },
|
3571 | quickTo: function quickTo(target, property, vars) {
|
3572 | var _merge2;
|
3573 |
|
3574 | var tween = gsap.to(target, _merge((_merge2 = {}, _merge2[property] = "+=0.1", _merge2.paused = true, _merge2), vars || {})),
|
3575 | func = function func(value, start, startIsRelative) {
|
3576 | return tween.resetTo(property, value, start, startIsRelative);
|
3577 | };
|
3578 |
|
3579 | func.tween = tween;
|
3580 | return func;
|
3581 | },
|
3582 | isTweening: function isTweening(targets) {
|
3583 | return _globalTimeline.getTweensOf(targets, true).length > 0;
|
3584 | },
|
3585 | defaults: function defaults(value) {
|
3586 | value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease));
|
3587 | return _mergeDeep(_defaults, value || {});
|
3588 | },
|
3589 | config: function config(value) {
|
3590 | return _mergeDeep(_config, value || {});
|
3591 | },
|
3592 | registerEffect: function registerEffect(_ref3) {
|
3593 | var name = _ref3.name,
|
3594 | effect = _ref3.effect,
|
3595 | plugins = _ref3.plugins,
|
3596 | defaults = _ref3.defaults,
|
3597 | extendTimeline = _ref3.extendTimeline;
|
3598 | (plugins || "").split(",").forEach(function (pluginName) {
|
3599 | return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin.");
|
3600 | });
|
3601 |
|
3602 | _effects[name] = function (targets, vars, tl) {
|
3603 | return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl);
|
3604 | };
|
3605 |
|
3606 | if (extendTimeline) {
|
3607 | Timeline.prototype[name] = function (targets, vars, position) {
|
3608 | return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position);
|
3609 | };
|
3610 | }
|
3611 | },
|
3612 | registerEase: function registerEase(name, ease) {
|
3613 | _easeMap[name] = _parseEase(ease);
|
3614 | },
|
3615 | parseEase: function parseEase(ease, defaultEase) {
|
3616 | return arguments.length ? _parseEase(ease, defaultEase) : _easeMap;
|
3617 | },
|
3618 | getById: function getById(id) {
|
3619 | return _globalTimeline.getById(id);
|
3620 | },
|
3621 | exportRoot: function exportRoot(vars, includeDelayedCalls) {
|
3622 | if (vars === void 0) {
|
3623 | vars = {};
|
3624 | }
|
3625 |
|
3626 | var tl = new Timeline(vars),
|
3627 | child,
|
3628 | next;
|
3629 | tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming);
|
3630 |
|
3631 | _globalTimeline.remove(tl);
|
3632 |
|
3633 | tl._dp = 0;
|
3634 | tl._time = tl._tTime = _globalTimeline._time;
|
3635 | child = _globalTimeline._first;
|
3636 |
|
3637 | while (child) {
|
3638 | next = child._next;
|
3639 |
|
3640 | if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) {
|
3641 | _addToTimeline(tl, child, child._start - child._delay);
|
3642 | }
|
3643 |
|
3644 | child = next;
|
3645 | }
|
3646 |
|
3647 | _addToTimeline(_globalTimeline, tl, 0);
|
3648 |
|
3649 | return tl;
|
3650 | },
|
3651 | utils: {
|
3652 | wrap: wrap,
|
3653 | wrapYoyo: wrapYoyo,
|
3654 | distribute: distribute,
|
3655 | random: random,
|
3656 | snap: snap,
|
3657 | normalize: normalize,
|
3658 | getUnit: getUnit,
|
3659 | clamp: clamp,
|
3660 | splitColor: splitColor,
|
3661 | toArray: toArray,
|
3662 | selector: selector,
|
3663 | mapRange: mapRange,
|
3664 | pipe: pipe,
|
3665 | unitize: unitize,
|
3666 | interpolate: interpolate,
|
3667 | shuffle: shuffle
|
3668 | },
|
3669 | install: _install,
|
3670 | effects: _effects,
|
3671 | ticker: _ticker,
|
3672 | updateRoot: Timeline.updateRoot,
|
3673 | plugins: _plugins,
|
3674 | globalTimeline: _globalTimeline,
|
3675 | core: {
|
3676 | PropTween: PropTween,
|
3677 | globals: _addGlobal,
|
3678 | Tween: Tween,
|
3679 | Timeline: Timeline,
|
3680 | Animation: Animation,
|
3681 | getCache: _getCache,
|
3682 | _removeLinkedListItem: _removeLinkedListItem,
|
3683 | suppressOverwrites: function suppressOverwrites(value) {
|
3684 | return _suppressOverwrites = value;
|
3685 | }
|
3686 | }
|
3687 | };
|
3688 |
|
3689 | _forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function (name) {
|
3690 | return _gsap[name] = Tween[name];
|
3691 | });
|
3692 |
|
3693 | _ticker.add(Timeline.updateRoot);
|
3694 |
|
3695 | _quickTween = _gsap.to({}, {
|
3696 | duration: 0
|
3697 | });
|
3698 |
|
3699 | var _getPluginPropTween = function _getPluginPropTween(plugin, prop) {
|
3700 | var pt = plugin._pt;
|
3701 |
|
3702 | while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) {
|
3703 | pt = pt._next;
|
3704 | }
|
3705 |
|
3706 | return pt;
|
3707 | },
|
3708 | _addModifiers = function _addModifiers(tween, modifiers) {
|
3709 | var targets = tween._targets,
|
3710 | p,
|
3711 | i,
|
3712 | pt;
|
3713 |
|
3714 | for (p in modifiers) {
|
3715 | i = targets.length;
|
3716 |
|
3717 | while (i--) {
|
3718 | pt = tween._ptLookup[i][p];
|
3719 |
|
3720 | if (pt && (pt = pt.d)) {
|
3721 | if (pt._pt) {
|
3722 | pt = _getPluginPropTween(pt, p);
|
3723 | }
|
3724 |
|
3725 | pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p);
|
3726 | }
|
3727 | }
|
3728 | }
|
3729 | },
|
3730 | _buildModifierPlugin = function _buildModifierPlugin(name, modifier) {
|
3731 | return {
|
3732 | name: name,
|
3733 | rawVars: 1,
|
3734 | init: function init(target, vars, tween) {
|
3735 | tween._onInit = function (tween) {
|
3736 | var temp, p;
|
3737 |
|
3738 | if (_isString(vars)) {
|
3739 | temp = {};
|
3740 |
|
3741 | _forEachName(vars, function (name) {
|
3742 | return temp[name] = 1;
|
3743 | });
|
3744 |
|
3745 | vars = temp;
|
3746 | }
|
3747 |
|
3748 | if (modifier) {
|
3749 | temp = {};
|
3750 |
|
3751 | for (p in vars) {
|
3752 | temp[p] = modifier(vars[p]);
|
3753 | }
|
3754 |
|
3755 | vars = temp;
|
3756 | }
|
3757 |
|
3758 | _addModifiers(tween, vars);
|
3759 | };
|
3760 | }
|
3761 | };
|
3762 | };
|
3763 |
|
3764 | var gsap = _gsap.registerPlugin({
|
3765 | name: "attr",
|
3766 | init: function init(target, vars, tween, index, targets) {
|
3767 | var p, pt;
|
3768 |
|
3769 | for (p in vars) {
|
3770 | pt = this.add(target, "setAttribute", (target.getAttribute(p) || 0) + "", vars[p], index, targets, 0, 0, p);
|
3771 | pt && (pt.op = p);
|
3772 |
|
3773 | this._props.push(p);
|
3774 | }
|
3775 | }
|
3776 | }, {
|
3777 | name: "endArray",
|
3778 | init: function init(target, value) {
|
3779 | var i = value.length;
|
3780 |
|
3781 | while (i--) {
|
3782 | this.add(target, i, target[i] || 0, value[i]);
|
3783 | }
|
3784 | }
|
3785 | }, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap;
|
3786 | Tween.version = Timeline.version = gsap.version = "3.10.3";
|
3787 | _coreReady = 1;
|
3788 | _windowExists() && _wake();
|
3789 | var Power0 = _easeMap.Power0,
|
3790 | Power1 = _easeMap.Power1,
|
3791 | Power2 = _easeMap.Power2,
|
3792 | Power3 = _easeMap.Power3,
|
3793 | Power4 = _easeMap.Power4,
|
3794 | Linear = _easeMap.Linear,
|
3795 | Quad = _easeMap.Quad,
|
3796 | Cubic = _easeMap.Cubic,
|
3797 | Quart = _easeMap.Quart,
|
3798 | Quint = _easeMap.Quint,
|
3799 | Strong = _easeMap.Strong,
|
3800 | Elastic = _easeMap.Elastic,
|
3801 | Back = _easeMap.Back,
|
3802 | SteppedEase = _easeMap.SteppedEase,
|
3803 | Bounce = _easeMap.Bounce,
|
3804 | Sine = _easeMap.Sine,
|
3805 | Expo = _easeMap.Expo,
|
3806 | Circ = _easeMap.Circ;
|
3807 |
|
3808 | var _win$1,
|
3809 | _doc$1,
|
3810 | _docElement,
|
3811 | _pluginInitted,
|
3812 | _tempDiv,
|
3813 | _tempDivStyler,
|
3814 | _recentSetterPlugin,
|
3815 | _windowExists$1 = function _windowExists() {
|
3816 | return typeof window !== "undefined";
|
3817 | },
|
3818 | _transformProps = {},
|
3819 | _RAD2DEG = 180 / Math.PI,
|
3820 | _DEG2RAD = Math.PI / 180,
|
3821 | _atan2 = Math.atan2,
|
3822 | _bigNum$1 = 1e8,
|
3823 | _capsExp = /([A-Z])/g,
|
3824 | _horizontalExp = /(left|right|width|margin|padding|x)/i,
|
3825 | _complexExp = /[\s,\(]\S/,
|
3826 | _propertyAliases = {
|
3827 | autoAlpha: "opacity,visibility",
|
3828 | scale: "scaleX,scaleY",
|
3829 | alpha: "opacity"
|
3830 | },
|
3831 | _renderCSSProp = function _renderCSSProp(ratio, data) {
|
3832 | return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data);
|
3833 | },
|
3834 | _renderPropWithEnd = function _renderPropWithEnd(ratio, data) {
|
3835 | return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data);
|
3836 | },
|
3837 | _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) {
|
3838 | return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u : data.b, data);
|
3839 | },
|
3840 | _renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) {
|
3841 | var value = data.s + data.c * ratio;
|
3842 | data.set(data.t, data.p, ~~(value + (value < 0 ? -.5 : .5)) + data.u, data);
|
3843 | },
|
3844 | _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) {
|
3845 | return data.set(data.t, data.p, ratio ? data.e : data.b, data);
|
3846 | },
|
3847 | _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) {
|
3848 | return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data);
|
3849 | },
|
3850 | _setterCSSStyle = function _setterCSSStyle(target, property, value) {
|
3851 | return target.style[property] = value;
|
3852 | },
|
3853 | _setterCSSProp = function _setterCSSProp(target, property, value) {
|
3854 | return target.style.setProperty(property, value);
|
3855 | },
|
3856 | _setterTransform = function _setterTransform(target, property, value) {
|
3857 | return target._gsap[property] = value;
|
3858 | },
|
3859 | _setterScale = function _setterScale(target, property, value) {
|
3860 | return target._gsap.scaleX = target._gsap.scaleY = value;
|
3861 | },
|
3862 | _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) {
|
3863 | var cache = target._gsap;
|
3864 | cache.scaleX = cache.scaleY = value;
|
3865 | cache.renderTransform(ratio, cache);
|
3866 | },
|
3867 | _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) {
|
3868 | var cache = target._gsap;
|
3869 | cache[property] = value;
|
3870 | cache.renderTransform(ratio, cache);
|
3871 | },
|
3872 | _transformProp = "transform",
|
3873 | _transformOriginProp = _transformProp + "Origin",
|
3874 | _supports3D,
|
3875 | _createElement = function _createElement(type, ns) {
|
3876 | var e = _doc$1.createElementNS ? _doc$1.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc$1.createElement(type);
|
3877 | return e.style ? e : _doc$1.createElement(type);
|
3878 | },
|
3879 | _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) {
|
3880 | var cs = getComputedStyle(target);
|
3881 | return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || "";
|
3882 | },
|
3883 | _prefixes = "O,Moz,ms,Ms,Webkit".split(","),
|
3884 | _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) {
|
3885 | var e = element || _tempDiv,
|
3886 | s = e.style,
|
3887 | i = 5;
|
3888 |
|
3889 | if (property in s && !preferPrefix) {
|
3890 | return property;
|
3891 | }
|
3892 |
|
3893 | property = property.charAt(0).toUpperCase() + property.substr(1);
|
3894 |
|
3895 | while (i-- && !(_prefixes[i] + property in s)) {}
|
3896 |
|
3897 | return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property;
|
3898 | },
|
3899 | _initCore = function _initCore() {
|
3900 | if (_windowExists$1() && window.document) {
|
3901 | _win$1 = window;
|
3902 | _doc$1 = _win$1.document;
|
3903 | _docElement = _doc$1.documentElement;
|
3904 | _tempDiv = _createElement("div") || {
|
3905 | style: {}
|
3906 | };
|
3907 | _tempDivStyler = _createElement("div");
|
3908 | _transformProp = _checkPropPrefix(_transformProp);
|
3909 | _transformOriginProp = _transformProp + "Origin";
|
3910 | _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0";
|
3911 | _supports3D = !!_checkPropPrefix("perspective");
|
3912 | _pluginInitted = 1;
|
3913 | }
|
3914 | },
|
3915 | _getBBoxHack = function _getBBoxHack(swapIfPossible) {
|
3916 | var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"),
|
3917 | oldParent = this.parentNode,
|
3918 | oldSibling = this.nextSibling,
|
3919 | oldCSS = this.style.cssText,
|
3920 | bbox;
|
3921 |
|
3922 | _docElement.appendChild(svg);
|
3923 |
|
3924 | svg.appendChild(this);
|
3925 | this.style.display = "block";
|
3926 |
|
3927 | if (swapIfPossible) {
|
3928 | try {
|
3929 | bbox = this.getBBox();
|
3930 | this._gsapBBox = this.getBBox;
|
3931 | this.getBBox = _getBBoxHack;
|
3932 | } catch (e) {}
|
3933 | } else if (this._gsapBBox) {
|
3934 | bbox = this._gsapBBox();
|
3935 | }
|
3936 |
|
3937 | if (oldParent) {
|
3938 | if (oldSibling) {
|
3939 | oldParent.insertBefore(this, oldSibling);
|
3940 | } else {
|
3941 | oldParent.appendChild(this);
|
3942 | }
|
3943 | }
|
3944 |
|
3945 | _docElement.removeChild(svg);
|
3946 |
|
3947 | this.style.cssText = oldCSS;
|
3948 | return bbox;
|
3949 | },
|
3950 | _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) {
|
3951 | var i = attributesArray.length;
|
3952 |
|
3953 | while (i--) {
|
3954 | if (target.hasAttribute(attributesArray[i])) {
|
3955 | return target.getAttribute(attributesArray[i]);
|
3956 | }
|
3957 | }
|
3958 | },
|
3959 | _getBBox = function _getBBox(target) {
|
3960 | var bounds;
|
3961 |
|
3962 | try {
|
3963 | bounds = target.getBBox();
|
3964 | } catch (error) {
|
3965 | bounds = _getBBoxHack.call(target, true);
|
3966 | }
|
3967 |
|
3968 | bounds && (bounds.width || bounds.height) || target.getBBox === _getBBoxHack || (bounds = _getBBoxHack.call(target, true));
|
3969 | return bounds && !bounds.width && !bounds.x && !bounds.y ? {
|
3970 | x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0,
|
3971 | y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0,
|
3972 | width: 0,
|
3973 | height: 0
|
3974 | } : bounds;
|
3975 | },
|
3976 | _isSVG = function _isSVG(e) {
|
3977 | return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e));
|
3978 | },
|
3979 | _removeProperty = function _removeProperty(target, property) {
|
3980 | if (property) {
|
3981 | var style = target.style;
|
3982 |
|
3983 | if (property in _transformProps && property !== _transformOriginProp) {
|
3984 | property = _transformProp;
|
3985 | }
|
3986 |
|
3987 | if (style.removeProperty) {
|
3988 | if (property.substr(0, 2) === "ms" || property.substr(0, 6) === "webkit") {
|
3989 | property = "-" + property;
|
3990 | }
|
3991 |
|
3992 | style.removeProperty(property.replace(_capsExp, "-$1").toLowerCase());
|
3993 | } else {
|
3994 | style.removeAttribute(property);
|
3995 | }
|
3996 | }
|
3997 | },
|
3998 | _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) {
|
3999 | var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue);
|
4000 | plugin._pt = pt;
|
4001 | pt.b = beginning;
|
4002 | pt.e = end;
|
4003 |
|
4004 | plugin._props.push(property);
|
4005 |
|
4006 | return pt;
|
4007 | },
|
4008 | _nonConvertibleUnits = {
|
4009 | deg: 1,
|
4010 | rad: 1,
|
4011 | turn: 1
|
4012 | },
|
4013 | _convertToUnit = function _convertToUnit(target, property, value, unit) {
|
4014 | var curValue = parseFloat(value) || 0,
|
4015 | curUnit = (value + "").trim().substr((curValue + "").length) || "px",
|
4016 | style = _tempDiv.style,
|
4017 | horizontal = _horizontalExp.test(property),
|
4018 | isRootSVG = target.tagName.toLowerCase() === "svg",
|
4019 | measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"),
|
4020 | amount = 100,
|
4021 | toPixels = unit === "px",
|
4022 | toPercent = unit === "%",
|
4023 | px,
|
4024 | parent,
|
4025 | cache,
|
4026 | isSVG;
|
4027 |
|
4028 | if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) {
|
4029 | return curValue;
|
4030 | }
|
4031 |
|
4032 | curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px"));
|
4033 | isSVG = target.getCTM && _isSVG(target);
|
4034 |
|
4035 | if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) {
|
4036 | px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty];
|
4037 | return _round(toPercent ? curValue / px * amount : curValue / 100 * px);
|
4038 | }
|
4039 |
|
4040 | style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit);
|
4041 | parent = ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode;
|
4042 |
|
4043 | if (isSVG) {
|
4044 | parent = (target.ownerSVGElement || {}).parentNode;
|
4045 | }
|
4046 |
|
4047 | if (!parent || parent === _doc$1 || !parent.appendChild) {
|
4048 | parent = _doc$1.body;
|
4049 | }
|
4050 |
|
4051 | cache = parent._gsap;
|
4052 |
|
4053 | if (cache && toPercent && cache.width && horizontal && cache.time === _ticker.time) {
|
4054 | return _round(curValue / cache.width * amount);
|
4055 | } else {
|
4056 | (toPercent || curUnit === "%") && (style.position = _getComputedProperty(target, "position"));
|
4057 | parent === target && (style.position = "static");
|
4058 | parent.appendChild(_tempDiv);
|
4059 | px = _tempDiv[measureProperty];
|
4060 | parent.removeChild(_tempDiv);
|
4061 | style.position = "absolute";
|
4062 |
|
4063 | if (horizontal && toPercent) {
|
4064 | cache = _getCache(parent);
|
4065 | cache.time = _ticker.time;
|
4066 | cache.width = parent[measureProperty];
|
4067 | }
|
4068 | }
|
4069 |
|
4070 | return _round(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0);
|
4071 | },
|
4072 | _get = function _get(target, property, unit, uncache) {
|
4073 | var value;
|
4074 | _pluginInitted || _initCore();
|
4075 |
|
4076 | if (property in _propertyAliases && property !== "transform") {
|
4077 | property = _propertyAliases[property];
|
4078 |
|
4079 | if (~property.indexOf(",")) {
|
4080 | property = property.split(",")[0];
|
4081 | }
|
4082 | }
|
4083 |
|
4084 | if (_transformProps[property] && property !== "transform") {
|
4085 | value = _parseTransform(target, uncache);
|
4086 | value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px";
|
4087 | } else {
|
4088 | value = target.style[property];
|
4089 |
|
4090 | if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) {
|
4091 | value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0);
|
4092 | }
|
4093 | }
|
4094 |
|
4095 | return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value;
|
4096 | },
|
4097 | _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) {
|
4098 | if (!start || start === "none") {
|
4099 | var p = _checkPropPrefix(prop, target, 1),
|
4100 | s = p && _getComputedProperty(target, p, 1);
|
4101 |
|
4102 | if (s && s !== start) {
|
4103 | prop = p;
|
4104 | start = s;
|
4105 | } else if (prop === "borderColor") {
|
4106 | start = _getComputedProperty(target, "borderTopColor");
|
4107 | }
|
4108 | }
|
4109 |
|
4110 | var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString),
|
4111 | index = 0,
|
4112 | matchIndex = 0,
|
4113 | a,
|
4114 | result,
|
4115 | startValues,
|
4116 | startNum,
|
4117 | color,
|
4118 | startValue,
|
4119 | endValue,
|
4120 | endNum,
|
4121 | chunk,
|
4122 | endUnit,
|
4123 | startUnit,
|
4124 | endValues;
|
4125 | pt.b = start;
|
4126 | pt.e = end;
|
4127 | start += "";
|
4128 | end += "";
|
4129 |
|
4130 | if (end === "auto") {
|
4131 | target.style[prop] = end;
|
4132 | end = _getComputedProperty(target, prop) || end;
|
4133 | target.style[prop] = start;
|
4134 | }
|
4135 |
|
4136 | a = [start, end];
|
4137 |
|
4138 | _colorStringFilter(a);
|
4139 |
|
4140 | start = a[0];
|
4141 | end = a[1];
|
4142 | startValues = start.match(_numWithUnitExp) || [];
|
4143 | endValues = end.match(_numWithUnitExp) || [];
|
4144 |
|
4145 | if (endValues.length) {
|
4146 | while (result = _numWithUnitExp.exec(end)) {
|
4147 | endValue = result[0];
|
4148 | chunk = end.substring(index, result.index);
|
4149 |
|
4150 | if (color) {
|
4151 | color = (color + 1) % 5;
|
4152 | } else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") {
|
4153 | color = 1;
|
4154 | }
|
4155 |
|
4156 | if (endValue !== (startValue = startValues[matchIndex++] || "")) {
|
4157 | startNum = parseFloat(startValue) || 0;
|
4158 | startUnit = startValue.substr((startNum + "").length);
|
4159 | endValue.charAt(1) === "=" && (endValue = _parseRelative(startNum, endValue) + startUnit);
|
4160 | endNum = parseFloat(endValue);
|
4161 | endUnit = endValue.substr((endNum + "").length);
|
4162 | index = _numWithUnitExp.lastIndex - endUnit.length;
|
4163 |
|
4164 | if (!endUnit) {
|
4165 | endUnit = endUnit || _config.units[prop] || startUnit;
|
4166 |
|
4167 | if (index === end.length) {
|
4168 | end += endUnit;
|
4169 | pt.e += endUnit;
|
4170 | }
|
4171 | }
|
4172 |
|
4173 | if (startUnit !== endUnit) {
|
4174 | startNum = _convertToUnit(target, prop, startValue, endUnit) || 0;
|
4175 | }
|
4176 |
|
4177 | pt._pt = {
|
4178 | _next: pt._pt,
|
4179 | p: chunk || matchIndex === 1 ? chunk : ",",
|
4180 | s: startNum,
|
4181 | c: endNum - startNum,
|
4182 | m: color && color < 4 || prop === "zIndex" ? Math.round : 0
|
4183 | };
|
4184 | }
|
4185 | }
|
4186 |
|
4187 | pt.c = index < end.length ? end.substring(index, end.length) : "";
|
4188 | } else {
|
4189 | pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue;
|
4190 | }
|
4191 |
|
4192 | _relExp.test(end) && (pt.e = 0);
|
4193 | this._pt = pt;
|
4194 | return pt;
|
4195 | },
|
4196 | _keywordToPercent = {
|
4197 | top: "0%",
|
4198 | bottom: "100%",
|
4199 | left: "0%",
|
4200 | right: "100%",
|
4201 | center: "50%"
|
4202 | },
|
4203 | _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) {
|
4204 | var split = value.split(" "),
|
4205 | x = split[0],
|
4206 | y = split[1] || "50%";
|
4207 |
|
4208 | if (x === "top" || x === "bottom" || y === "left" || y === "right") {
|
4209 | value = x;
|
4210 | x = y;
|
4211 | y = value;
|
4212 | }
|
4213 |
|
4214 | split[0] = _keywordToPercent[x] || x;
|
4215 | split[1] = _keywordToPercent[y] || y;
|
4216 | return split.join(" ");
|
4217 | },
|
4218 | _renderClearProps = function _renderClearProps(ratio, data) {
|
4219 | if (data.tween && data.tween._time === data.tween._dur) {
|
4220 | var target = data.t,
|
4221 | style = target.style,
|
4222 | props = data.u,
|
4223 | cache = target._gsap,
|
4224 | prop,
|
4225 | clearTransforms,
|
4226 | i;
|
4227 |
|
4228 | if (props === "all" || props === true) {
|
4229 | style.cssText = "";
|
4230 | clearTransforms = 1;
|
4231 | } else {
|
4232 | props = props.split(",");
|
4233 | i = props.length;
|
4234 |
|
4235 | while (--i > -1) {
|
4236 | prop = props[i];
|
4237 |
|
4238 | if (_transformProps[prop]) {
|
4239 | clearTransforms = 1;
|
4240 | prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp;
|
4241 | }
|
4242 |
|
4243 | _removeProperty(target, prop);
|
4244 | }
|
4245 | }
|
4246 |
|
4247 | if (clearTransforms) {
|
4248 | _removeProperty(target, _transformProp);
|
4249 |
|
4250 | if (cache) {
|
4251 | cache.svg && target.removeAttribute("transform");
|
4252 |
|
4253 | _parseTransform(target, 1);
|
4254 |
|
4255 | cache.uncache = 1;
|
4256 | }
|
4257 | }
|
4258 | }
|
4259 | },
|
4260 | _specialProps = {
|
4261 | clearProps: function clearProps(plugin, target, property, endValue, tween) {
|
4262 | if (tween.data !== "isFromStart") {
|
4263 | var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps);
|
4264 | pt.u = endValue;
|
4265 | pt.pr = -10;
|
4266 | pt.tween = tween;
|
4267 |
|
4268 | plugin._props.push(property);
|
4269 |
|
4270 | return 1;
|
4271 | }
|
4272 | }
|
4273 | },
|
4274 | _identity2DMatrix = [1, 0, 0, 1, 0, 0],
|
4275 | _rotationalProperties = {},
|
4276 | _isNullTransform = function _isNullTransform(value) {
|
4277 | return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value;
|
4278 | },
|
4279 | _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) {
|
4280 | var matrixString = _getComputedProperty(target, _transformProp);
|
4281 |
|
4282 | return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp).map(_round);
|
4283 | },
|
4284 | _getMatrix = function _getMatrix(target, force2D) {
|
4285 | var cache = target._gsap || _getCache(target),
|
4286 | style = target.style,
|
4287 | matrix = _getComputedTransformMatrixAsArray(target),
|
4288 | parent,
|
4289 | nextSibling,
|
4290 | temp,
|
4291 | addedToDOM;
|
4292 |
|
4293 | if (cache.svg && target.getAttribute("transform")) {
|
4294 | temp = target.transform.baseVal.consolidate().matrix;
|
4295 | matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f];
|
4296 | return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix;
|
4297 | } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) {
|
4298 | temp = style.display;
|
4299 | style.display = "block";
|
4300 | parent = target.parentNode;
|
4301 |
|
4302 | if (!parent || !target.offsetParent) {
|
4303 | addedToDOM = 1;
|
4304 | nextSibling = target.nextSibling;
|
4305 |
|
4306 | _docElement.appendChild(target);
|
4307 | }
|
4308 |
|
4309 | matrix = _getComputedTransformMatrixAsArray(target);
|
4310 | temp ? style.display = temp : _removeProperty(target, "display");
|
4311 |
|
4312 | if (addedToDOM) {
|
4313 | nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target);
|
4314 | }
|
4315 | }
|
4316 |
|
4317 | return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix;
|
4318 | },
|
4319 | _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) {
|
4320 | var cache = target._gsap,
|
4321 | matrix = matrixArray || _getMatrix(target, true),
|
4322 | xOriginOld = cache.xOrigin || 0,
|
4323 | yOriginOld = cache.yOrigin || 0,
|
4324 | xOffsetOld = cache.xOffset || 0,
|
4325 | yOffsetOld = cache.yOffset || 0,
|
4326 | a = matrix[0],
|
4327 | b = matrix[1],
|
4328 | c = matrix[2],
|
4329 | d = matrix[3],
|
4330 | tx = matrix[4],
|
4331 | ty = matrix[5],
|
4332 | originSplit = origin.split(" "),
|
4333 | xOrigin = parseFloat(originSplit[0]) || 0,
|
4334 | yOrigin = parseFloat(originSplit[1]) || 0,
|
4335 | bounds,
|
4336 | determinant,
|
4337 | x,
|
4338 | y;
|
4339 |
|
4340 | if (!originIsAbsolute) {
|
4341 | bounds = _getBBox(target);
|
4342 | xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width : xOrigin);
|
4343 | yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin);
|
4344 | } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) {
|
4345 | x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant;
|
4346 | y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant;
|
4347 | xOrigin = x;
|
4348 | yOrigin = y;
|
4349 | }
|
4350 |
|
4351 | if (smooth || smooth !== false && cache.smooth) {
|
4352 | tx = xOrigin - xOriginOld;
|
4353 | ty = yOrigin - yOriginOld;
|
4354 | cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx;
|
4355 | cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty;
|
4356 | } else {
|
4357 | cache.xOffset = cache.yOffset = 0;
|
4358 | }
|
4359 |
|
4360 | cache.xOrigin = xOrigin;
|
4361 | cache.yOrigin = yOrigin;
|
4362 | cache.smooth = !!smooth;
|
4363 | cache.origin = origin;
|
4364 | cache.originIsAbsolute = !!originIsAbsolute;
|
4365 | target.style[_transformOriginProp] = "0px 0px";
|
4366 |
|
4367 | if (pluginToAddPropTweensTo) {
|
4368 | _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin);
|
4369 |
|
4370 | _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin);
|
4371 |
|
4372 | _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset);
|
4373 |
|
4374 | _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset);
|
4375 | }
|
4376 |
|
4377 | target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin);
|
4378 | },
|
4379 | _parseTransform = function _parseTransform(target, uncache) {
|
4380 | var cache = target._gsap || new GSCache(target);
|
4381 |
|
4382 | if ("x" in cache && !uncache && !cache.uncache) {
|
4383 | return cache;
|
4384 | }
|
4385 |
|
4386 | var style = target.style,
|
4387 | invertedScaleX = cache.scaleX < 0,
|
4388 | px = "px",
|
4389 | deg = "deg",
|
4390 | origin = _getComputedProperty(target, _transformOriginProp) || "0",
|
4391 | x,
|
4392 | y,
|
4393 | z,
|
4394 | scaleX,
|
4395 | scaleY,
|
4396 | rotation,
|
4397 | rotationX,
|
4398 | rotationY,
|
4399 | skewX,
|
4400 | skewY,
|
4401 | perspective,
|
4402 | xOrigin,
|
4403 | yOrigin,
|
4404 | matrix,
|
4405 | angle,
|
4406 | cos,
|
4407 | sin,
|
4408 | a,
|
4409 | b,
|
4410 | c,
|
4411 | d,
|
4412 | a12,
|
4413 | a22,
|
4414 | t1,
|
4415 | t2,
|
4416 | t3,
|
4417 | a13,
|
4418 | a23,
|
4419 | a33,
|
4420 | a42,
|
4421 | a43,
|
4422 | a32;
|
4423 | x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0;
|
4424 | scaleX = scaleY = 1;
|
4425 | cache.svg = !!(target.getCTM && _isSVG(target));
|
4426 | matrix = _getMatrix(target, cache.svg);
|
4427 |
|
4428 | if (cache.svg) {
|
4429 | t1 = (!cache.uncache || origin === "0px 0px") && !uncache && target.getAttribute("data-svg-origin");
|
4430 |
|
4431 | _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix);
|
4432 | }
|
4433 |
|
4434 | xOrigin = cache.xOrigin || 0;
|
4435 | yOrigin = cache.yOrigin || 0;
|
4436 |
|
4437 | if (matrix !== _identity2DMatrix) {
|
4438 | a = matrix[0];
|
4439 | b = matrix[1];
|
4440 | c = matrix[2];
|
4441 | d = matrix[3];
|
4442 | x = a12 = matrix[4];
|
4443 | y = a22 = matrix[5];
|
4444 |
|
4445 | if (matrix.length === 6) {
|
4446 | scaleX = Math.sqrt(a * a + b * b);
|
4447 | scaleY = Math.sqrt(d * d + c * c);
|
4448 | rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0;
|
4449 | skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0;
|
4450 | skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD)));
|
4451 |
|
4452 | if (cache.svg) {
|
4453 | x -= xOrigin - (xOrigin * a + yOrigin * c);
|
4454 | y -= yOrigin - (xOrigin * b + yOrigin * d);
|
4455 | }
|
4456 | } else {
|
4457 | a32 = matrix[6];
|
4458 | a42 = matrix[7];
|
4459 | a13 = matrix[8];
|
4460 | a23 = matrix[9];
|
4461 | a33 = matrix[10];
|
4462 | a43 = matrix[11];
|
4463 | x = matrix[12];
|
4464 | y = matrix[13];
|
4465 | z = matrix[14];
|
4466 | angle = _atan2(a32, a33);
|
4467 | rotationX = angle * _RAD2DEG;
|
4468 |
|
4469 | if (angle) {
|
4470 | cos = Math.cos(-angle);
|
4471 | sin = Math.sin(-angle);
|
4472 | t1 = a12 * cos + a13 * sin;
|
4473 | t2 = a22 * cos + a23 * sin;
|
4474 | t3 = a32 * cos + a33 * sin;
|
4475 | a13 = a12 * -sin + a13 * cos;
|
4476 | a23 = a22 * -sin + a23 * cos;
|
4477 | a33 = a32 * -sin + a33 * cos;
|
4478 | a43 = a42 * -sin + a43 * cos;
|
4479 | a12 = t1;
|
4480 | a22 = t2;
|
4481 | a32 = t3;
|
4482 | }
|
4483 |
|
4484 | angle = _atan2(-c, a33);
|
4485 | rotationY = angle * _RAD2DEG;
|
4486 |
|
4487 | if (angle) {
|
4488 | cos = Math.cos(-angle);
|
4489 | sin = Math.sin(-angle);
|
4490 | t1 = a * cos - a13 * sin;
|
4491 | t2 = b * cos - a23 * sin;
|
4492 | t3 = c * cos - a33 * sin;
|
4493 | a43 = d * sin + a43 * cos;
|
4494 | a = t1;
|
4495 | b = t2;
|
4496 | c = t3;
|
4497 | }
|
4498 |
|
4499 | angle = _atan2(b, a);
|
4500 | rotation = angle * _RAD2DEG;
|
4501 |
|
4502 | if (angle) {
|
4503 | cos = Math.cos(angle);
|
4504 | sin = Math.sin(angle);
|
4505 | t1 = a * cos + b * sin;
|
4506 | t2 = a12 * cos + a22 * sin;
|
4507 | b = b * cos - a * sin;
|
4508 | a22 = a22 * cos - a12 * sin;
|
4509 | a = t1;
|
4510 | a12 = t2;
|
4511 | }
|
4512 |
|
4513 | if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) {
|
4514 | rotationX = rotation = 0;
|
4515 | rotationY = 180 - rotationY;
|
4516 | }
|
4517 |
|
4518 | scaleX = _round(Math.sqrt(a * a + b * b + c * c));
|
4519 | scaleY = _round(Math.sqrt(a22 * a22 + a32 * a32));
|
4520 | angle = _atan2(a12, a22);
|
4521 | skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0;
|
4522 | perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0;
|
4523 | }
|
4524 |
|
4525 | if (cache.svg) {
|
4526 | t1 = target.getAttribute("transform");
|
4527 | cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp));
|
4528 | t1 && target.setAttribute("transform", t1);
|
4529 | }
|
4530 | }
|
4531 |
|
4532 | if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) {
|
4533 | if (invertedScaleX) {
|
4534 | scaleX *= -1;
|
4535 | skewX += rotation <= 0 ? 180 : -180;
|
4536 | rotation += rotation <= 0 ? 180 : -180;
|
4537 | } else {
|
4538 | scaleY *= -1;
|
4539 | skewX += skewX <= 0 ? 180 : -180;
|
4540 | }
|
4541 | }
|
4542 |
|
4543 | uncache = uncache || cache.uncache;
|
4544 | 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;
|
4545 | 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;
|
4546 | cache.z = z + px;
|
4547 | cache.scaleX = _round(scaleX);
|
4548 | cache.scaleY = _round(scaleY);
|
4549 | cache.rotation = _round(rotation) + deg;
|
4550 | cache.rotationX = _round(rotationX) + deg;
|
4551 | cache.rotationY = _round(rotationY) + deg;
|
4552 | cache.skewX = skewX + deg;
|
4553 | cache.skewY = skewY + deg;
|
4554 | cache.transformPerspective = perspective + px;
|
4555 |
|
4556 | if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || 0) {
|
4557 | style[_transformOriginProp] = _firstTwoOnly(origin);
|
4558 | }
|
4559 |
|
4560 | cache.xOffset = cache.yOffset = 0;
|
4561 | cache.force3D = _config.force3D;
|
4562 | cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms;
|
4563 | cache.uncache = 0;
|
4564 | return cache;
|
4565 | },
|
4566 | _firstTwoOnly = function _firstTwoOnly(value) {
|
4567 | return (value = value.split(" "))[0] + " " + value[1];
|
4568 | },
|
4569 | _addPxTranslate = function _addPxTranslate(target, start, value) {
|
4570 | var unit = getUnit(start);
|
4571 | return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit;
|
4572 | },
|
4573 | _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) {
|
4574 | cache.z = "0px";
|
4575 | cache.rotationY = cache.rotationX = "0deg";
|
4576 | cache.force3D = 0;
|
4577 |
|
4578 | _renderCSSTransforms(ratio, cache);
|
4579 | },
|
4580 | _zeroDeg = "0deg",
|
4581 | _zeroPx = "0px",
|
4582 | _endParenthesis = ") ",
|
4583 | _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) {
|
4584 | var _ref = cache || this,
|
4585 | xPercent = _ref.xPercent,
|
4586 | yPercent = _ref.yPercent,
|
4587 | x = _ref.x,
|
4588 | y = _ref.y,
|
4589 | z = _ref.z,
|
4590 | rotation = _ref.rotation,
|
4591 | rotationY = _ref.rotationY,
|
4592 | rotationX = _ref.rotationX,
|
4593 | skewX = _ref.skewX,
|
4594 | skewY = _ref.skewY,
|
4595 | scaleX = _ref.scaleX,
|
4596 | scaleY = _ref.scaleY,
|
4597 | transformPerspective = _ref.transformPerspective,
|
4598 | force3D = _ref.force3D,
|
4599 | target = _ref.target,
|
4600 | zOrigin = _ref.zOrigin,
|
4601 | transforms = "",
|
4602 | use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true;
|
4603 |
|
4604 | if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) {
|
4605 | var angle = parseFloat(rotationY) * _DEG2RAD,
|
4606 | a13 = Math.sin(angle),
|
4607 | a33 = Math.cos(angle),
|
4608 | cos;
|
4609 |
|
4610 | angle = parseFloat(rotationX) * _DEG2RAD;
|
4611 | cos = Math.cos(angle);
|
4612 | x = _addPxTranslate(target, x, a13 * cos * -zOrigin);
|
4613 | y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin);
|
4614 | z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin);
|
4615 | }
|
4616 |
|
4617 | if (transformPerspective !== _zeroPx) {
|
4618 | transforms += "perspective(" + transformPerspective + _endParenthesis;
|
4619 | }
|
4620 |
|
4621 | if (xPercent || yPercent) {
|
4622 | transforms += "translate(" + xPercent + "%, " + yPercent + "%) ";
|
4623 | }
|
4624 |
|
4625 | if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) {
|
4626 | transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis;
|
4627 | }
|
4628 |
|
4629 | if (rotation !== _zeroDeg) {
|
4630 | transforms += "rotate(" + rotation + _endParenthesis;
|
4631 | }
|
4632 |
|
4633 | if (rotationY !== _zeroDeg) {
|
4634 | transforms += "rotateY(" + rotationY + _endParenthesis;
|
4635 | }
|
4636 |
|
4637 | if (rotationX !== _zeroDeg) {
|
4638 | transforms += "rotateX(" + rotationX + _endParenthesis;
|
4639 | }
|
4640 |
|
4641 | if (skewX !== _zeroDeg || skewY !== _zeroDeg) {
|
4642 | transforms += "skew(" + skewX + ", " + skewY + _endParenthesis;
|
4643 | }
|
4644 |
|
4645 | if (scaleX !== 1 || scaleY !== 1) {
|
4646 | transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis;
|
4647 | }
|
4648 |
|
4649 | target.style[_transformProp] = transforms || "translate(0, 0)";
|
4650 | },
|
4651 | _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) {
|
4652 | var _ref2 = cache || this,
|
4653 | xPercent = _ref2.xPercent,
|
4654 | yPercent = _ref2.yPercent,
|
4655 | x = _ref2.x,
|
4656 | y = _ref2.y,
|
4657 | rotation = _ref2.rotation,
|
4658 | skewX = _ref2.skewX,
|
4659 | skewY = _ref2.skewY,
|
4660 | scaleX = _ref2.scaleX,
|
4661 | scaleY = _ref2.scaleY,
|
4662 | target = _ref2.target,
|
4663 | xOrigin = _ref2.xOrigin,
|
4664 | yOrigin = _ref2.yOrigin,
|
4665 | xOffset = _ref2.xOffset,
|
4666 | yOffset = _ref2.yOffset,
|
4667 | forceCSS = _ref2.forceCSS,
|
4668 | tx = parseFloat(x),
|
4669 | ty = parseFloat(y),
|
4670 | a11,
|
4671 | a21,
|
4672 | a12,
|
4673 | a22,
|
4674 | temp;
|
4675 |
|
4676 | rotation = parseFloat(rotation);
|
4677 | skewX = parseFloat(skewX);
|
4678 | skewY = parseFloat(skewY);
|
4679 |
|
4680 | if (skewY) {
|
4681 | skewY = parseFloat(skewY);
|
4682 | skewX += skewY;
|
4683 | rotation += skewY;
|
4684 | }
|
4685 |
|
4686 | if (rotation || skewX) {
|
4687 | rotation *= _DEG2RAD;
|
4688 | skewX *= _DEG2RAD;
|
4689 | a11 = Math.cos(rotation) * scaleX;
|
4690 | a21 = Math.sin(rotation) * scaleX;
|
4691 | a12 = Math.sin(rotation - skewX) * -scaleY;
|
4692 | a22 = Math.cos(rotation - skewX) * scaleY;
|
4693 |
|
4694 | if (skewX) {
|
4695 | skewY *= _DEG2RAD;
|
4696 | temp = Math.tan(skewX - skewY);
|
4697 | temp = Math.sqrt(1 + temp * temp);
|
4698 | a12 *= temp;
|
4699 | a22 *= temp;
|
4700 |
|
4701 | if (skewY) {
|
4702 | temp = Math.tan(skewY);
|
4703 | temp = Math.sqrt(1 + temp * temp);
|
4704 | a11 *= temp;
|
4705 | a21 *= temp;
|
4706 | }
|
4707 | }
|
4708 |
|
4709 | a11 = _round(a11);
|
4710 | a21 = _round(a21);
|
4711 | a12 = _round(a12);
|
4712 | a22 = _round(a22);
|
4713 | } else {
|
4714 | a11 = scaleX;
|
4715 | a22 = scaleY;
|
4716 | a21 = a12 = 0;
|
4717 | }
|
4718 |
|
4719 | if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) {
|
4720 | tx = _convertToUnit(target, "x", x, "px");
|
4721 | ty = _convertToUnit(target, "y", y, "px");
|
4722 | }
|
4723 |
|
4724 | if (xOrigin || yOrigin || xOffset || yOffset) {
|
4725 | tx = _round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset);
|
4726 | ty = _round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset);
|
4727 | }
|
4728 |
|
4729 | if (xPercent || yPercent) {
|
4730 | temp = target.getBBox();
|
4731 | tx = _round(tx + xPercent / 100 * temp.width);
|
4732 | ty = _round(ty + yPercent / 100 * temp.height);
|
4733 | }
|
4734 |
|
4735 | temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")";
|
4736 | target.setAttribute("transform", temp);
|
4737 | forceCSS && (target.style[_transformProp] = temp);
|
4738 | },
|
4739 | _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue) {
|
4740 | var cap = 360,
|
4741 | isString = _isString(endValue),
|
4742 | endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1),
|
4743 | change = endNum - startNum,
|
4744 | finalValue = startNum + change + "deg",
|
4745 | direction,
|
4746 | pt;
|
4747 |
|
4748 | if (isString) {
|
4749 | direction = endValue.split("_")[1];
|
4750 |
|
4751 | if (direction === "short") {
|
4752 | change %= cap;
|
4753 |
|
4754 | if (change !== change % (cap / 2)) {
|
4755 | change += change < 0 ? cap : -cap;
|
4756 | }
|
4757 | }
|
4758 |
|
4759 | if (direction === "cw" && change < 0) {
|
4760 | change = (change + cap * _bigNum$1) % cap - ~~(change / cap) * cap;
|
4761 | } else if (direction === "ccw" && change > 0) {
|
4762 | change = (change - cap * _bigNum$1) % cap - ~~(change / cap) * cap;
|
4763 | }
|
4764 | }
|
4765 |
|
4766 | plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd);
|
4767 | pt.e = finalValue;
|
4768 | pt.u = "deg";
|
4769 |
|
4770 | plugin._props.push(property);
|
4771 |
|
4772 | return pt;
|
4773 | },
|
4774 | _assign = function _assign(target, source) {
|
4775 | for (var p in source) {
|
4776 | target[p] = source[p];
|
4777 | }
|
4778 |
|
4779 | return target;
|
4780 | },
|
4781 | _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) {
|
4782 | var startCache = _assign({}, target._gsap),
|
4783 | exclude = "perspective,force3D,transformOrigin,svgOrigin",
|
4784 | style = target.style,
|
4785 | endCache,
|
4786 | p,
|
4787 | startValue,
|
4788 | endValue,
|
4789 | startNum,
|
4790 | endNum,
|
4791 | startUnit,
|
4792 | endUnit;
|
4793 |
|
4794 | if (startCache.svg) {
|
4795 | startValue = target.getAttribute("transform");
|
4796 | target.setAttribute("transform", "");
|
4797 | style[_transformProp] = transforms;
|
4798 | endCache = _parseTransform(target, 1);
|
4799 |
|
4800 | _removeProperty(target, _transformProp);
|
4801 |
|
4802 | target.setAttribute("transform", startValue);
|
4803 | } else {
|
4804 | startValue = getComputedStyle(target)[_transformProp];
|
4805 | style[_transformProp] = transforms;
|
4806 | endCache = _parseTransform(target, 1);
|
4807 | style[_transformProp] = startValue;
|
4808 | }
|
4809 |
|
4810 | for (p in _transformProps) {
|
4811 | startValue = startCache[p];
|
4812 | endValue = endCache[p];
|
4813 |
|
4814 | if (startValue !== endValue && exclude.indexOf(p) < 0) {
|
4815 | startUnit = getUnit(startValue);
|
4816 | endUnit = getUnit(endValue);
|
4817 | startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue);
|
4818 | endNum = parseFloat(endValue);
|
4819 | plugin._pt = new PropTween(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp);
|
4820 | plugin._pt.u = endUnit || 0;
|
4821 |
|
4822 | plugin._props.push(p);
|
4823 | }
|
4824 | }
|
4825 |
|
4826 | _assign(endCache, startCache);
|
4827 | };
|
4828 |
|
4829 | _forEachName("padding,margin,Width,Radius", function (name, index) {
|
4830 | var t = "Top",
|
4831 | r = "Right",
|
4832 | b = "Bottom",
|
4833 | l = "Left",
|
4834 | props = (index < 3 ? [t, r, b, l] : [t + l, t + r, b + r, b + l]).map(function (side) {
|
4835 | return index < 2 ? name + side : "border" + side + name;
|
4836 | });
|
4837 |
|
4838 | _specialProps[index > 1 ? "border" + name : name] = function (plugin, target, property, endValue, tween) {
|
4839 | var a, vars;
|
4840 |
|
4841 | if (arguments.length < 4) {
|
4842 | a = props.map(function (prop) {
|
4843 | return _get(plugin, prop, property);
|
4844 | });
|
4845 | vars = a.join(" ");
|
4846 | return vars.split(a[0]).length === 5 ? a[0] : vars;
|
4847 | }
|
4848 |
|
4849 | a = (endValue + "").split(" ");
|
4850 | vars = {};
|
4851 | props.forEach(function (prop, i) {
|
4852 | return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0];
|
4853 | });
|
4854 | plugin.init(target, vars, tween);
|
4855 | };
|
4856 | });
|
4857 |
|
4858 | var CSSPlugin = {
|
4859 | name: "css",
|
4860 | register: _initCore,
|
4861 | targetTest: function targetTest(target) {
|
4862 | return target.style && target.nodeType;
|
4863 | },
|
4864 | init: function init(target, vars, tween, index, targets) {
|
4865 | var props = this._props,
|
4866 | style = target.style,
|
4867 | startAt = tween.vars.startAt,
|
4868 | startValue,
|
4869 | endValue,
|
4870 | endNum,
|
4871 | startNum,
|
4872 | type,
|
4873 | specialProp,
|
4874 | p,
|
4875 | startUnit,
|
4876 | endUnit,
|
4877 | relative,
|
4878 | isTransformRelated,
|
4879 | transformPropTween,
|
4880 | cache,
|
4881 | smooth,
|
4882 | hasPriority;
|
4883 | _pluginInitted || _initCore();
|
4884 |
|
4885 | for (p in vars) {
|
4886 | if (p === "autoRound") {
|
4887 | continue;
|
4888 | }
|
4889 |
|
4890 | endValue = vars[p];
|
4891 |
|
4892 | if (_plugins[p] && _checkPlugin(p, vars, tween, index, target, targets)) {
|
4893 | continue;
|
4894 | }
|
4895 |
|
4896 | type = typeof endValue;
|
4897 | specialProp = _specialProps[p];
|
4898 |
|
4899 | if (type === "function") {
|
4900 | endValue = endValue.call(tween, index, target, targets);
|
4901 | type = typeof endValue;
|
4902 | }
|
4903 |
|
4904 | if (type === "string" && ~endValue.indexOf("random(")) {
|
4905 | endValue = _replaceRandom(endValue);
|
4906 | }
|
4907 |
|
4908 | if (specialProp) {
|
4909 | specialProp(this, target, p, endValue, tween) && (hasPriority = 1);
|
4910 | } else if (p.substr(0, 2) === "--") {
|
4911 | startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim();
|
4912 | endValue += "";
|
4913 | _colorExp.lastIndex = 0;
|
4914 |
|
4915 | if (!_colorExp.test(startValue)) {
|
4916 | startUnit = getUnit(startValue);
|
4917 | endUnit = getUnit(endValue);
|
4918 | }
|
4919 |
|
4920 | endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit);
|
4921 | this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p);
|
4922 | props.push(p);
|
4923 | } else if (type !== "undefined") {
|
4924 | if (startAt && p in startAt) {
|
4925 | startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p];
|
4926 | _isString(startValue) && ~startValue.indexOf("random(") && (startValue = _replaceRandom(startValue));
|
4927 | getUnit(startValue + "") || (startValue += _config.units[p] || getUnit(_get(target, p)) || "");
|
4928 | (startValue + "").charAt(1) === "=" && (startValue = _get(target, p));
|
4929 | } else {
|
4930 | startValue = _get(target, p);
|
4931 | }
|
4932 |
|
4933 | startNum = parseFloat(startValue);
|
4934 | relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2);
|
4935 | relative && (endValue = endValue.substr(2));
|
4936 | endNum = parseFloat(endValue);
|
4937 |
|
4938 | if (p in _propertyAliases) {
|
4939 | if (p === "autoAlpha") {
|
4940 | if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) {
|
4941 | startNum = 0;
|
4942 | }
|
4943 |
|
4944 | _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum);
|
4945 | }
|
4946 |
|
4947 | if (p !== "scale" && p !== "transform") {
|
4948 | p = _propertyAliases[p];
|
4949 | ~p.indexOf(",") && (p = p.split(",")[0]);
|
4950 | }
|
4951 | }
|
4952 |
|
4953 | isTransformRelated = p in _transformProps;
|
4954 |
|
4955 | if (isTransformRelated) {
|
4956 | if (!transformPropTween) {
|
4957 | cache = target._gsap;
|
4958 | cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform);
|
4959 | smooth = vars.smoothOrigin !== false && cache.smooth;
|
4960 | transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1);
|
4961 | transformPropTween.dep = 1;
|
4962 | }
|
4963 |
|
4964 | if (p === "scale") {
|
4965 | this._pt = new PropTween(this._pt, cache, "scaleY", cache.scaleY, (relative ? _parseRelative(cache.scaleY, relative + endNum) : endNum) - cache.scaleY || 0);
|
4966 | props.push("scaleY", p);
|
4967 | p += "X";
|
4968 | } else if (p === "transformOrigin") {
|
4969 | endValue = _convertKeywordsToPercentages(endValue);
|
4970 |
|
4971 | if (cache.svg) {
|
4972 | _applySVGOrigin(target, endValue, 0, smooth, 0, this);
|
4973 | } else {
|
4974 | endUnit = parseFloat(endValue.split(" ")[2]) || 0;
|
4975 | endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit);
|
4976 |
|
4977 | _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue));
|
4978 | }
|
4979 |
|
4980 | continue;
|
4981 | } else if (p === "svgOrigin") {
|
4982 | _applySVGOrigin(target, endValue, 1, smooth, 0, this);
|
4983 |
|
4984 | continue;
|
4985 | } else if (p in _rotationalProperties) {
|
4986 | _addRotationalPropTween(this, cache, p, startNum, relative ? _parseRelative(startNum, relative + endValue) : endValue);
|
4987 |
|
4988 | continue;
|
4989 | } else if (p === "smoothOrigin") {
|
4990 | _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue);
|
4991 |
|
4992 | continue;
|
4993 | } else if (p === "force3D") {
|
4994 | cache[p] = endValue;
|
4995 | continue;
|
4996 | } else if (p === "transform") {
|
4997 | _addRawTransformPTs(this, endValue, target);
|
4998 |
|
4999 | continue;
|
5000 | }
|
5001 | } else if (!(p in style)) {
|
5002 | p = _checkPropPrefix(p) || p;
|
5003 | }
|
5004 |
|
5005 | if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) {
|
5006 | startUnit = (startValue + "").substr((startNum + "").length);
|
5007 | endNum || (endNum = 0);
|
5008 | endUnit = getUnit(endValue) || (p in _config.units ? _config.units[p] : startUnit);
|
5009 | startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit));
|
5010 | 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);
|
5011 | this._pt.u = endUnit || 0;
|
5012 |
|
5013 | if (startUnit !== endUnit && endUnit !== "%") {
|
5014 | this._pt.b = startValue;
|
5015 | this._pt.r = _renderCSSPropWithBeginning;
|
5016 | }
|
5017 | } else if (!(p in style)) {
|
5018 | if (p in target) {
|
5019 | this.add(target, p, startValue || target[p], relative ? relative + endValue : endValue, index, targets);
|
5020 | } else {
|
5021 | _missingPlugin(p, endValue);
|
5022 |
|
5023 | continue;
|
5024 | }
|
5025 | } else {
|
5026 | _tweenComplexCSSString.call(this, target, p, startValue, relative ? relative + endValue : endValue);
|
5027 | }
|
5028 |
|
5029 | props.push(p);
|
5030 | }
|
5031 | }
|
5032 |
|
5033 | hasPriority && _sortPropTweensByPriority(this);
|
5034 | },
|
5035 | get: _get,
|
5036 | aliases: _propertyAliases,
|
5037 | getSetter: function getSetter(target, property, plugin) {
|
5038 | var p = _propertyAliases[property];
|
5039 | p && p.indexOf(",") < 0 && (property = p);
|
5040 | 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);
|
5041 | },
|
5042 | core: {
|
5043 | _removeProperty: _removeProperty,
|
5044 | _getMatrix: _getMatrix
|
5045 | }
|
5046 | };
|
5047 | gsap.utils.checkPrefix = _checkPropPrefix;
|
5048 |
|
5049 | (function (positionAndScale, rotation, others, aliases) {
|
5050 | var all = _forEachName(positionAndScale + "," + rotation + "," + others, function (name) {
|
5051 | _transformProps[name] = 1;
|
5052 | });
|
5053 |
|
5054 | _forEachName(rotation, function (name) {
|
5055 | _config.units[name] = "deg";
|
5056 | _rotationalProperties[name] = 1;
|
5057 | });
|
5058 |
|
5059 | _propertyAliases[all[13]] = positionAndScale + "," + rotation;
|
5060 |
|
5061 | _forEachName(aliases, function (name) {
|
5062 | var split = name.split(":");
|
5063 | _propertyAliases[split[1]] = all[split[0]];
|
5064 | });
|
5065 | })("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");
|
5066 |
|
5067 | _forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function (name) {
|
5068 | _config.units[name] = "px";
|
5069 | });
|
5070 |
|
5071 | gsap.registerPlugin(CSSPlugin);
|
5072 |
|
5073 | var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap,
|
5074 | TweenMaxWithCSS = gsapWithCSS.core.Tween;
|
5075 |
|
5076 | exports.Back = Back;
|
5077 | exports.Bounce = Bounce;
|
5078 | exports.CSSPlugin = CSSPlugin;
|
5079 | exports.Circ = Circ;
|
5080 | exports.Cubic = Cubic;
|
5081 | exports.Elastic = Elastic;
|
5082 | exports.Expo = Expo;
|
5083 | exports.Linear = Linear;
|
5084 | exports.Power0 = Power0;
|
5085 | exports.Power1 = Power1;
|
5086 | exports.Power2 = Power2;
|
5087 | exports.Power3 = Power3;
|
5088 | exports.Power4 = Power4;
|
5089 | exports.Quad = Quad;
|
5090 | exports.Quart = Quart;
|
5091 | exports.Quint = Quint;
|
5092 | exports.Sine = Sine;
|
5093 | exports.SteppedEase = SteppedEase;
|
5094 | exports.Strong = Strong;
|
5095 | exports.TimelineLite = Timeline;
|
5096 | exports.TimelineMax = Timeline;
|
5097 | exports.TweenLite = Tween;
|
5098 | exports.TweenMax = TweenMaxWithCSS;
|
5099 | exports.default = gsapWithCSS;
|
5100 | exports.gsap = gsapWithCSS;
|
5101 |
|
5102 | if (typeof(window) === 'undefined' || window !== exports) {Object.defineProperty(exports, '__esModule', { value: true });} else {delete window.default;}
|
5103 |
|
5104 | })));
|