greensock-rails 1.11.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +2 -0
  3. data/README.md +47 -0
  4. data/lib/greensock/rails.rb +9 -0
  5. data/lib/greensock/rails/version.rb +5 -0
  6. data/vendor/assets/javascripts/greensock/TimelineLite.js +622 -0
  7. data/vendor/assets/javascripts/greensock/TimelineMax.js +1060 -0
  8. data/vendor/assets/javascripts/greensock/TweenLite.js +1654 -0
  9. data/vendor/assets/javascripts/greensock/TweenMax.js +6662 -0
  10. data/vendor/assets/javascripts/greensock/easing/EasePack.js +343 -0
  11. data/vendor/assets/javascripts/greensock/jquery.gsap.js +167 -0
  12. data/vendor/assets/javascripts/greensock/plugins/AttrPlugin.js +51 -0
  13. data/vendor/assets/javascripts/greensock/plugins/BezierPlugin.js +574 -0
  14. data/vendor/assets/javascripts/greensock/plugins/CSSPlugin.js +2260 -0
  15. data/vendor/assets/javascripts/greensock/plugins/CSSRulePlugin.js +100 -0
  16. data/vendor/assets/javascripts/greensock/plugins/ColorPropsPlugin.js +122 -0
  17. data/vendor/assets/javascripts/greensock/plugins/DirectionalRotationPlugin.js +80 -0
  18. data/vendor/assets/javascripts/greensock/plugins/EaselPlugin.js +298 -0
  19. data/vendor/assets/javascripts/greensock/plugins/KineticPlugin.js +298 -0
  20. data/vendor/assets/javascripts/greensock/plugins/RaphaelPlugin.js +367 -0
  21. data/vendor/assets/javascripts/greensock/plugins/RoundPropsPlugin.js +73 -0
  22. data/vendor/assets/javascripts/greensock/plugins/ScrollToPlugin.js +115 -0
  23. data/vendor/assets/javascripts/greensock/plugins/TEMPLATE_Plugin.js +74 -0
  24. data/vendor/assets/javascripts/greensock/plugins/TextPlugin.js +108 -0
  25. data/vendor/assets/javascripts/greensock/utils/Draggable.js +1438 -0
  26. metadata +97 -0
@@ -0,0 +1,1654 @@
1
+ /*!
2
+ * VERSION: 1.11.4
3
+ * DATE: 2014-01-18
4
+ * UPDATES AND DOCS AT: http://www.greensock.com
5
+ *
6
+ * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
7
+ * This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
8
+ * Club GreenSock members, the software agreement that was issued with your membership.
9
+ *
10
+ * @author: Jack Doyle, jack@greensock.com
11
+ */
12
+ (function(window) {
13
+
14
+ "use strict";
15
+ var _globals = window.GreenSockGlobals || window;
16
+ if (_globals.TweenLite) {
17
+ return; //in case the core set of classes is already loaded, don't instantiate twice.
18
+ }
19
+ var _namespace = function(ns) {
20
+ var a = ns.split("."),
21
+ p = _globals, i;
22
+ for (i = 0; i < a.length; i++) {
23
+ p[a[i]] = p = p[a[i]] || {};
24
+ }
25
+ return p;
26
+ },
27
+ gs = _namespace("com.greensock"),
28
+ _tinyNum = 0.0000000001,
29
+ _slice = [].slice,
30
+ _emptyFunc = function() {},
31
+ _isArray = (function() { //works around issues in iframe environments where the Array global isn't shared, thus if the object originates in a different window/iframe, "(obj instanceof Array)" will evaluate false. We added some speed optimizations to avoid Object.prototype.toString.call() unless it's absolutely necessary because it's VERY slow (like 20x slower)
32
+ var toString = Object.prototype.toString,
33
+ array = toString.call([]);
34
+ return function(obj) {
35
+ return obj != null && (obj instanceof Array || (typeof(obj) === "object" && !!obj.push && toString.call(obj) === array));
36
+ };
37
+ }()),
38
+ a, i, p, _ticker, _tickerActive,
39
+ _defLookup = {},
40
+
41
+ /**
42
+ * @constructor
43
+ * Defines a GreenSock class, optionally with an array of dependencies that must be instantiated first and passed into the definition.
44
+ * This allows users to load GreenSock JS files in any order even if they have interdependencies (like CSSPlugin extends TweenPlugin which is
45
+ * inside TweenLite.js, but if CSSPlugin is loaded first, it should wait to run its code until TweenLite.js loads and instantiates TweenPlugin
46
+ * and then pass TweenPlugin to CSSPlugin's definition). This is all done automatically and internally.
47
+ *
48
+ * Every definition will be added to a "com.greensock" global object (typically window, but if a window.GreenSockGlobals object is found,
49
+ * it will go there as of v1.7). For example, TweenLite will be found at window.com.greensock.TweenLite and since it's a global class that should be available anywhere,
50
+ * it is ALSO referenced at window.TweenLite. However some classes aren't considered global, like the base com.greensock.core.Animation class, so
51
+ * those will only be at the package like window.com.greensock.core.Animation. Again, if you define a GreenSockGlobals object on the window, everything
52
+ * gets tucked neatly inside there instead of on the window directly. This allows you to do advanced things like load multiple versions of GreenSock
53
+ * files and put them into distinct objects (imagine a banner ad uses a newer version but the main site uses an older one). In that case, you could
54
+ * sandbox the banner one like:
55
+ *
56
+ * <script>
57
+ * var gs = window.GreenSockGlobals = {}; //the newer version we're about to load could now be referenced in a "gs" object, like gs.TweenLite.to(...). Use whatever alias you want as long as it's unique, "gs" or "banner" or whatever.
58
+ * </script>
59
+ * <script src="js/greensock/v1.7/TweenMax.js"></script>
60
+ * <script>
61
+ * window.GreenSockGlobals = null; //reset it back to null so that the next load of TweenMax affects the window and we can reference things directly like TweenLite.to(...)
62
+ * </script>
63
+ * <script src="js/greensock/v1.6/TweenMax.js"></script>
64
+ * <script>
65
+ * gs.TweenLite.to(...); //would use v1.7
66
+ * TweenLite.to(...); //would use v1.6
67
+ * </script>
68
+ *
69
+ * @param {!string} ns The namespace of the class definition, leaving off "com.greensock." as that's assumed. For example, "TweenLite" or "plugins.CSSPlugin" or "easing.Back".
70
+ * @param {!Array.<string>} dependencies An array of dependencies (described as their namespaces minus "com.greensock." prefix). For example ["TweenLite","plugins.TweenPlugin","core.Animation"]
71
+ * @param {!function():Object} func The function that should be called and passed the resolved dependencies which will return the actual class for this definition.
72
+ * @param {boolean=} global If true, the class will be added to the global scope (typically window unless you define a window.GreenSockGlobals object)
73
+ */
74
+ Definition = function(ns, dependencies, func, global) {
75
+ this.sc = (_defLookup[ns]) ? _defLookup[ns].sc : []; //subclasses
76
+ _defLookup[ns] = this;
77
+ this.gsClass = null;
78
+ this.func = func;
79
+ var _classes = [];
80
+ this.check = function(init) {
81
+ var i = dependencies.length,
82
+ missing = i,
83
+ cur, a, n, cl;
84
+ while (--i > -1) {
85
+ if ((cur = _defLookup[dependencies[i]] || new Definition(dependencies[i], [])).gsClass) {
86
+ _classes[i] = cur.gsClass;
87
+ missing--;
88
+ } else if (init) {
89
+ cur.sc.push(this);
90
+ }
91
+ }
92
+ if (missing === 0 && func) {
93
+ a = ("com.greensock." + ns).split(".");
94
+ n = a.pop();
95
+ cl = _namespace(a.join("."))[n] = this.gsClass = func.apply(func, _classes);
96
+
97
+ //exports to multiple environments
98
+ if (global) {
99
+ _globals[n] = cl; //provides a way to avoid global namespace pollution. By default, the main classes like TweenLite, Power1, Strong, etc. are added to window unless a GreenSockGlobals is defined. So if you want to have things added to a custom object instead, just do something like window.GreenSockGlobals = {} before loading any GreenSock files. You can even set up an alias like window.GreenSockGlobals = windows.gs = {} so that you can access everything like gs.TweenLite. Also remember that ALL classes are added to the window.com.greensock object (in their respective packages, like com.greensock.easing.Power1, com.greensock.TweenLite, etc.)
100
+ if (typeof(define) === "function" && define.amd){ //AMD
101
+ define((window.GreenSockAMDPath ? window.GreenSockAMDPath + "/" : "") + ns.split(".").join("/"), [], function() { return cl; });
102
+ } else if (typeof(module) !== "undefined" && module.exports){ //node
103
+ module.exports = cl;
104
+ }
105
+ }
106
+ for (i = 0; i < this.sc.length; i++) {
107
+ this.sc[i].check();
108
+ }
109
+ }
110
+ };
111
+ this.check(true);
112
+ },
113
+
114
+ //used to create Definition instances (which basically registers a class that has dependencies).
115
+ _gsDefine = window._gsDefine = function(ns, dependencies, func, global) {
116
+ return new Definition(ns, dependencies, func, global);
117
+ },
118
+
119
+ //a quick way to create a class that doesn't have any dependencies. Returns the class, but first registers it in the GreenSock namespace so that other classes can grab it (other classes might be dependent on the class).
120
+ _class = gs._class = function(ns, func, global) {
121
+ func = func || function() {};
122
+ _gsDefine(ns, [], function(){ return func; }, global);
123
+ return func;
124
+ };
125
+
126
+ _gsDefine.globals = _globals;
127
+
128
+
129
+
130
+ /*
131
+ * ----------------------------------------------------------------
132
+ * Ease
133
+ * ----------------------------------------------------------------
134
+ */
135
+ var _baseParams = [0, 0, 1, 1],
136
+ _blankArray = [],
137
+ Ease = _class("easing.Ease", function(func, extraParams, type, power) {
138
+ this._func = func;
139
+ this._type = type || 0;
140
+ this._power = power || 0;
141
+ this._params = extraParams ? _baseParams.concat(extraParams) : _baseParams;
142
+ }, true),
143
+ _easeMap = Ease.map = {},
144
+ _easeReg = Ease.register = function(ease, names, types, create) {
145
+ var na = names.split(","),
146
+ i = na.length,
147
+ ta = (types || "easeIn,easeOut,easeInOut").split(","),
148
+ e, name, j, type;
149
+ while (--i > -1) {
150
+ name = na[i];
151
+ e = create ? _class("easing."+name, null, true) : gs.easing[name] || {};
152
+ j = ta.length;
153
+ while (--j > -1) {
154
+ type = ta[j];
155
+ _easeMap[name + "." + type] = _easeMap[type + name] = e[type] = ease.getRatio ? ease : ease[type] || new ease();
156
+ }
157
+ }
158
+ };
159
+
160
+ p = Ease.prototype;
161
+ p._calcEnd = false;
162
+ p.getRatio = function(p) {
163
+ if (this._func) {
164
+ this._params[0] = p;
165
+ return this._func.apply(null, this._params);
166
+ }
167
+ var t = this._type,
168
+ pw = this._power,
169
+ r = (t === 1) ? 1 - p : (t === 2) ? p : (p < 0.5) ? p * 2 : (1 - p) * 2;
170
+ if (pw === 1) {
171
+ r *= r;
172
+ } else if (pw === 2) {
173
+ r *= r * r;
174
+ } else if (pw === 3) {
175
+ r *= r * r * r;
176
+ } else if (pw === 4) {
177
+ r *= r * r * r * r;
178
+ }
179
+ return (t === 1) ? 1 - r : (t === 2) ? r : (p < 0.5) ? r / 2 : 1 - (r / 2);
180
+ };
181
+
182
+ //create all the standard eases like Linear, Quad, Cubic, Quart, Quint, Strong, Power0, Power1, Power2, Power3, and Power4 (each with easeIn, easeOut, and easeInOut)
183
+ a = ["Linear","Quad","Cubic","Quart","Quint,Strong"];
184
+ i = a.length;
185
+ while (--i > -1) {
186
+ p = a[i]+",Power"+i;
187
+ _easeReg(new Ease(null,null,1,i), p, "easeOut", true);
188
+ _easeReg(new Ease(null,null,2,i), p, "easeIn" + ((i === 0) ? ",easeNone" : ""));
189
+ _easeReg(new Ease(null,null,3,i), p, "easeInOut");
190
+ }
191
+ _easeMap.linear = gs.easing.Linear.easeIn;
192
+ _easeMap.swing = gs.easing.Quad.easeInOut; //for jQuery folks
193
+
194
+
195
+ /*
196
+ * ----------------------------------------------------------------
197
+ * EventDispatcher
198
+ * ----------------------------------------------------------------
199
+ */
200
+ var EventDispatcher = _class("events.EventDispatcher", function(target) {
201
+ this._listeners = {};
202
+ this._eventTarget = target || this;
203
+ });
204
+ p = EventDispatcher.prototype;
205
+
206
+ p.addEventListener = function(type, callback, scope, useParam, priority) {
207
+ priority = priority || 0;
208
+ var list = this._listeners[type],
209
+ index = 0,
210
+ listener, i;
211
+ if (list == null) {
212
+ this._listeners[type] = list = [];
213
+ }
214
+ i = list.length;
215
+ while (--i > -1) {
216
+ listener = list[i];
217
+ if (listener.c === callback && listener.s === scope) {
218
+ list.splice(i, 1);
219
+ } else if (index === 0 && listener.pr < priority) {
220
+ index = i + 1;
221
+ }
222
+ }
223
+ list.splice(index, 0, {c:callback, s:scope, up:useParam, pr:priority});
224
+ if (this === _ticker && !_tickerActive) {
225
+ _ticker.wake();
226
+ }
227
+ };
228
+
229
+ p.removeEventListener = function(type, callback) {
230
+ var list = this._listeners[type], i;
231
+ if (list) {
232
+ i = list.length;
233
+ while (--i > -1) {
234
+ if (list[i].c === callback) {
235
+ list.splice(i, 1);
236
+ return;
237
+ }
238
+ }
239
+ }
240
+ };
241
+
242
+ p.dispatchEvent = function(type) {
243
+ var list = this._listeners[type],
244
+ i, t, listener;
245
+ if (list) {
246
+ i = list.length;
247
+ t = this._eventTarget;
248
+ while (--i > -1) {
249
+ listener = list[i];
250
+ if (listener.up) {
251
+ listener.c.call(listener.s || t, {type:type, target:t});
252
+ } else {
253
+ listener.c.call(listener.s || t);
254
+ }
255
+ }
256
+ }
257
+ };
258
+
259
+
260
+ /*
261
+ * ----------------------------------------------------------------
262
+ * Ticker
263
+ * ----------------------------------------------------------------
264
+ */
265
+ var _reqAnimFrame = window.requestAnimationFrame,
266
+ _cancelAnimFrame = window.cancelAnimationFrame,
267
+ _getTime = Date.now || function() {return new Date().getTime();},
268
+ _lastUpdate = _getTime();
269
+
270
+ //now try to determine the requestAnimationFrame and cancelAnimationFrame functions and if none are found, we'll use a setTimeout()/clearTimeout() polyfill.
271
+ a = ["ms","moz","webkit","o"];
272
+ i = a.length;
273
+ while (--i > -1 && !_reqAnimFrame) {
274
+ _reqAnimFrame = window[a[i] + "RequestAnimationFrame"];
275
+ _cancelAnimFrame = window[a[i] + "CancelAnimationFrame"] || window[a[i] + "CancelRequestAnimationFrame"];
276
+ }
277
+
278
+ _class("Ticker", function(fps, useRAF) {
279
+ var _self = this,
280
+ _startTime = _getTime(),
281
+ _useRAF = (useRAF !== false && _reqAnimFrame),
282
+ _fps, _req, _id, _gap, _nextTime,
283
+ _tick = function(manual) {
284
+ _lastUpdate = _getTime();
285
+ _self.time = (_lastUpdate - _startTime) / 1000;
286
+ var overlap = _self.time - _nextTime,
287
+ dispatch;
288
+ if (!_fps || overlap > 0 || manual === true) {
289
+ _self.frame++;
290
+ _nextTime += overlap + (overlap >= _gap ? 0.004 : _gap - overlap);
291
+ dispatch = true;
292
+ }
293
+ if (manual !== true) { //make sure the request is made before we dispatch the "tick" event so that timing is maintained. Otherwise, if processing the "tick" requires a bunch of time (like 15ms) and we're using a setTimeout() that's based on 16.7ms, it'd technically take 31.7ms between frames otherwise.
294
+ _id = _req(_tick);
295
+ }
296
+ if (dispatch) {
297
+ _self.dispatchEvent("tick");
298
+ }
299
+ };
300
+
301
+ EventDispatcher.call(_self);
302
+ _self.time = _self.frame = 0;
303
+ _self.tick = function() {
304
+ _tick(true);
305
+ };
306
+
307
+ _self.sleep = function() {
308
+ if (_id == null) {
309
+ return;
310
+ }
311
+ if (!_useRAF || !_cancelAnimFrame) {
312
+ clearTimeout(_id);
313
+ } else {
314
+ _cancelAnimFrame(_id);
315
+ }
316
+ _req = _emptyFunc;
317
+ _id = null;
318
+ if (_self === _ticker) {
319
+ _tickerActive = false;
320
+ }
321
+ };
322
+
323
+ _self.wake = function() {
324
+ if (_id !== null) {
325
+ _self.sleep();
326
+ }
327
+ _req = (_fps === 0) ? _emptyFunc : (!_useRAF || !_reqAnimFrame) ? function(f) { return setTimeout(f, ((_nextTime - _self.time) * 1000 + 1) | 0); } : _reqAnimFrame;
328
+ if (_self === _ticker) {
329
+ _tickerActive = true;
330
+ }
331
+ _tick(2);
332
+ };
333
+
334
+ _self.fps = function(value) {
335
+ if (!arguments.length) {
336
+ return _fps;
337
+ }
338
+ _fps = value;
339
+ _gap = 1 / (_fps || 60);
340
+ _nextTime = this.time + _gap;
341
+ _self.wake();
342
+ };
343
+
344
+ _self.useRAF = function(value) {
345
+ if (!arguments.length) {
346
+ return _useRAF;
347
+ }
348
+ _self.sleep();
349
+ _useRAF = value;
350
+ _self.fps(_fps);
351
+ };
352
+ _self.fps(fps);
353
+
354
+ //a bug in iOS 6 Safari occasionally prevents the requestAnimationFrame from working initially, so we use a 1.5-second timeout that automatically falls back to setTimeout() if it senses this condition.
355
+ setTimeout(function() {
356
+ if (_useRAF && (!_id || _self.frame < 5)) {
357
+ _self.useRAF(false);
358
+ }
359
+ }, 1500);
360
+ });
361
+
362
+ p = gs.Ticker.prototype = new gs.events.EventDispatcher();
363
+ p.constructor = gs.Ticker;
364
+
365
+
366
+ /*
367
+ * ----------------------------------------------------------------
368
+ * Animation
369
+ * ----------------------------------------------------------------
370
+ */
371
+ var Animation = _class("core.Animation", function(duration, vars) {
372
+ this.vars = vars = vars || {};
373
+ this._duration = this._totalDuration = duration || 0;
374
+ this._delay = Number(vars.delay) || 0;
375
+ this._timeScale = 1;
376
+ this._active = (vars.immediateRender === true);
377
+ this.data = vars.data;
378
+ this._reversed = (vars.reversed === true);
379
+
380
+ if (!_rootTimeline) {
381
+ return;
382
+ }
383
+ if (!_tickerActive) { //some browsers (like iOS 6 Safari) shut down JavaScript execution when the tab is disabled and they [occasionally] neglect to start up requestAnimationFrame again when returning - this code ensures that the engine starts up again properly.
384
+ _ticker.wake();
385
+ }
386
+
387
+ var tl = this.vars.useFrames ? _rootFramesTimeline : _rootTimeline;
388
+ tl.add(this, tl._time);
389
+
390
+ if (this.vars.paused) {
391
+ this.paused(true);
392
+ }
393
+ });
394
+
395
+ _ticker = Animation.ticker = new gs.Ticker();
396
+ p = Animation.prototype;
397
+ p._dirty = p._gc = p._initted = p._paused = false;
398
+ p._totalTime = p._time = 0;
399
+ p._rawPrevTime = -1;
400
+ p._next = p._last = p._onUpdate = p._timeline = p.timeline = null;
401
+ p._paused = false;
402
+
403
+
404
+ //some browsers (like iOS) occasionally drop the requestAnimationFrame event when the user switches to a different tab and then comes back again, so we use a 2-second setTimeout() to sense if/when that condition occurs and then wake() the ticker.
405
+ var _checkTimeout = function() {
406
+ if (_tickerActive && _getTime() - _lastUpdate > 2000) {
407
+ _ticker.wake();
408
+ }
409
+ setTimeout(_checkTimeout, 2000);
410
+ };
411
+ _checkTimeout();
412
+
413
+
414
+ p.play = function(from, suppressEvents) {
415
+ if (arguments.length) {
416
+ this.seek(from, suppressEvents);
417
+ }
418
+ return this.reversed(false).paused(false);
419
+ };
420
+
421
+ p.pause = function(atTime, suppressEvents) {
422
+ if (arguments.length) {
423
+ this.seek(atTime, suppressEvents);
424
+ }
425
+ return this.paused(true);
426
+ };
427
+
428
+ p.resume = function(from, suppressEvents) {
429
+ if (arguments.length) {
430
+ this.seek(from, suppressEvents);
431
+ }
432
+ return this.paused(false);
433
+ };
434
+
435
+ p.seek = function(time, suppressEvents) {
436
+ return this.totalTime(Number(time), suppressEvents !== false);
437
+ };
438
+
439
+ p.restart = function(includeDelay, suppressEvents) {
440
+ return this.reversed(false).paused(false).totalTime(includeDelay ? -this._delay : 0, (suppressEvents !== false), true);
441
+ };
442
+
443
+ p.reverse = function(from, suppressEvents) {
444
+ if (arguments.length) {
445
+ this.seek((from || this.totalDuration()), suppressEvents);
446
+ }
447
+ return this.reversed(true).paused(false);
448
+ };
449
+
450
+ p.render = function(time, suppressEvents, force) {
451
+ //stub - we override this method in subclasses.
452
+ };
453
+
454
+ p.invalidate = function() {
455
+ return this;
456
+ };
457
+
458
+ p.isActive = function() {
459
+ var tl = this._timeline, //the 2 root timelines won't have a _timeline; they're always active.
460
+ startTime = this._startTime,
461
+ rawTime;
462
+ return (!tl || (!this._gc && !this._paused && tl.isActive() && (rawTime = tl.rawTime()) >= startTime && rawTime < startTime + this.totalDuration() / this._timeScale));
463
+ };
464
+
465
+ p._enabled = function (enabled, ignoreTimeline) {
466
+ if (!_tickerActive) {
467
+ _ticker.wake();
468
+ }
469
+ this._gc = !enabled;
470
+ this._active = this.isActive();
471
+ if (ignoreTimeline !== true) {
472
+ if (enabled && !this.timeline) {
473
+ this._timeline.add(this, this._startTime - this._delay);
474
+ } else if (!enabled && this.timeline) {
475
+ this._timeline._remove(this, true);
476
+ }
477
+ }
478
+ return false;
479
+ };
480
+
481
+
482
+ p._kill = function(vars, target) {
483
+ return this._enabled(false, false);
484
+ };
485
+
486
+ p.kill = function(vars, target) {
487
+ this._kill(vars, target);
488
+ return this;
489
+ };
490
+
491
+ p._uncache = function(includeSelf) {
492
+ var tween = includeSelf ? this : this.timeline;
493
+ while (tween) {
494
+ tween._dirty = true;
495
+ tween = tween.timeline;
496
+ }
497
+ return this;
498
+ };
499
+
500
+ p._swapSelfInParams = function(params) {
501
+ var i = params.length,
502
+ copy = params.concat();
503
+ while (--i > -1) {
504
+ if (params[i] === "{self}") {
505
+ copy[i] = this;
506
+ }
507
+ }
508
+ return copy;
509
+ };
510
+
511
+ //----Animation getters/setters --------------------------------------------------------
512
+
513
+ p.eventCallback = function(type, callback, params, scope) {
514
+ if ((type || "").substr(0,2) === "on") {
515
+ var v = this.vars;
516
+ if (arguments.length === 1) {
517
+ return v[type];
518
+ }
519
+ if (callback == null) {
520
+ delete v[type];
521
+ } else {
522
+ v[type] = callback;
523
+ v[type + "Params"] = (_isArray(params) && params.join("").indexOf("{self}") !== -1) ? this._swapSelfInParams(params) : params;
524
+ v[type + "Scope"] = scope;
525
+ }
526
+ if (type === "onUpdate") {
527
+ this._onUpdate = callback;
528
+ }
529
+ }
530
+ return this;
531
+ };
532
+
533
+ p.delay = function(value) {
534
+ if (!arguments.length) {
535
+ return this._delay;
536
+ }
537
+ if (this._timeline.smoothChildTiming) {
538
+ this.startTime( this._startTime + value - this._delay );
539
+ }
540
+ this._delay = value;
541
+ return this;
542
+ };
543
+
544
+ p.duration = function(value) {
545
+ if (!arguments.length) {
546
+ this._dirty = false;
547
+ return this._duration;
548
+ }
549
+ this._duration = this._totalDuration = value;
550
+ this._uncache(true); //true in case it's a TweenMax or TimelineMax that has a repeat - we'll need to refresh the totalDuration.
551
+ if (this._timeline.smoothChildTiming) if (this._time > 0) if (this._time < this._duration) if (value !== 0) {
552
+ this.totalTime(this._totalTime * (value / this._duration), true);
553
+ }
554
+ return this;
555
+ };
556
+
557
+ p.totalDuration = function(value) {
558
+ this._dirty = false;
559
+ return (!arguments.length) ? this._totalDuration : this.duration(value);
560
+ };
561
+
562
+ p.time = function(value, suppressEvents) {
563
+ if (!arguments.length) {
564
+ return this._time;
565
+ }
566
+ if (this._dirty) {
567
+ this.totalDuration();
568
+ }
569
+ return this.totalTime((value > this._duration) ? this._duration : value, suppressEvents);
570
+ };
571
+
572
+ p.totalTime = function(time, suppressEvents, uncapped) {
573
+ if (!_tickerActive) {
574
+ _ticker.wake();
575
+ }
576
+ if (!arguments.length) {
577
+ return this._totalTime;
578
+ }
579
+ if (this._timeline) {
580
+ if (time < 0 && !uncapped) {
581
+ time += this.totalDuration();
582
+ }
583
+ if (this._timeline.smoothChildTiming) {
584
+ if (this._dirty) {
585
+ this.totalDuration();
586
+ }
587
+ var totalDuration = this._totalDuration,
588
+ tl = this._timeline;
589
+ if (time > totalDuration && !uncapped) {
590
+ time = totalDuration;
591
+ }
592
+ this._startTime = (this._paused ? this._pauseTime : tl._time) - ((!this._reversed ? time : totalDuration - time) / this._timeScale);
593
+ if (!tl._dirty) { //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here.
594
+ this._uncache(false);
595
+ }
596
+ //in case any of the ancestor timelines had completed but should now be enabled, we should reset their totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The startTime of that child would get pushed out, but one of the ancestors may have completed.
597
+ if (tl._timeline) {
598
+ while (tl._timeline) {
599
+ if (tl._timeline._time !== (tl._startTime + tl._totalTime) / tl._timeScale) {
600
+ tl.totalTime(tl._totalTime, true);
601
+ }
602
+ tl = tl._timeline;
603
+ }
604
+ }
605
+ }
606
+ if (this._gc) {
607
+ this._enabled(true, false);
608
+ }
609
+ if (this._totalTime !== time || this._duration === 0) {
610
+ this.render(time, suppressEvents, false);
611
+ }
612
+ }
613
+ return this;
614
+ };
615
+
616
+ p.progress = p.totalProgress = function(value, suppressEvents) {
617
+ return (!arguments.length) ? this._time / this.duration() : this.totalTime(this.duration() * value, suppressEvents);
618
+ };
619
+
620
+ p.startTime = function(value) {
621
+ if (!arguments.length) {
622
+ return this._startTime;
623
+ }
624
+ if (value !== this._startTime) {
625
+ this._startTime = value;
626
+ if (this.timeline) if (this.timeline._sortChildren) {
627
+ this.timeline.add(this, value - this._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct.
628
+ }
629
+ }
630
+ return this;
631
+ };
632
+
633
+ p.timeScale = function(value) {
634
+ if (!arguments.length) {
635
+ return this._timeScale;
636
+ }
637
+ value = value || _tinyNum; //can't allow zero because it'll throw the math off
638
+ if (this._timeline && this._timeline.smoothChildTiming) {
639
+ var pauseTime = this._pauseTime,
640
+ t = (pauseTime || pauseTime === 0) ? pauseTime : this._timeline.totalTime();
641
+ this._startTime = t - ((t - this._startTime) * this._timeScale / value);
642
+ }
643
+ this._timeScale = value;
644
+ return this._uncache(false);
645
+ };
646
+
647
+ p.reversed = function(value) {
648
+ if (!arguments.length) {
649
+ return this._reversed;
650
+ }
651
+ if (value != this._reversed) {
652
+ this._reversed = value;
653
+ this.totalTime(((this._timeline && !this._timeline.smoothChildTiming) ? this.totalDuration() - this._totalTime : this._totalTime), true);
654
+ }
655
+ return this;
656
+ };
657
+
658
+ p.paused = function(value) {
659
+ if (!arguments.length) {
660
+ return this._paused;
661
+ }
662
+ if (value != this._paused) if (this._timeline) {
663
+ if (!_tickerActive && !value) {
664
+ _ticker.wake();
665
+ }
666
+ var tl = this._timeline,
667
+ raw = tl.rawTime(),
668
+ elapsed = raw - this._pauseTime;
669
+ if (!value && tl.smoothChildTiming) {
670
+ this._startTime += elapsed;
671
+ this._uncache(false);
672
+ }
673
+ this._pauseTime = value ? raw : null;
674
+ this._paused = value;
675
+ this._active = this.isActive();
676
+ if (!value && elapsed !== 0 && this._initted && this.duration()) {
677
+ this.render((tl.smoothChildTiming ? this._totalTime : (raw - this._startTime) / this._timeScale), true, true); //in case the target's properties changed via some other tween or manual update by the user, we should force a render.
678
+ }
679
+ }
680
+ if (this._gc && !value) {
681
+ this._enabled(true, false);
682
+ }
683
+ return this;
684
+ };
685
+
686
+
687
+ /*
688
+ * ----------------------------------------------------------------
689
+ * SimpleTimeline
690
+ * ----------------------------------------------------------------
691
+ */
692
+ var SimpleTimeline = _class("core.SimpleTimeline", function(vars) {
693
+ Animation.call(this, 0, vars);
694
+ this.autoRemoveChildren = this.smoothChildTiming = true;
695
+ });
696
+
697
+ p = SimpleTimeline.prototype = new Animation();
698
+ p.constructor = SimpleTimeline;
699
+ p.kill()._gc = false;
700
+ p._first = p._last = null;
701
+ p._sortChildren = false;
702
+
703
+ p.add = p.insert = function(child, position, align, stagger) {
704
+ var prevTween, st;
705
+ child._startTime = Number(position || 0) + child._delay;
706
+ if (child._paused) if (this !== child._timeline) { //we only adjust the _pauseTime if it wasn't in this timeline already. Remember, sometimes a tween will be inserted again into the same timeline when its startTime is changed so that the tweens in the TimelineLite/Max are re-ordered properly in the linked list (so everything renders in the proper order).
707
+ child._pauseTime = child._startTime + ((this.rawTime() - child._startTime) / child._timeScale);
708
+ }
709
+ if (child.timeline) {
710
+ child.timeline._remove(child, true); //removes from existing timeline so that it can be properly added to this one.
711
+ }
712
+ child.timeline = child._timeline = this;
713
+ if (child._gc) {
714
+ child._enabled(true, true);
715
+ }
716
+ prevTween = this._last;
717
+ if (this._sortChildren) {
718
+ st = child._startTime;
719
+ while (prevTween && prevTween._startTime > st) {
720
+ prevTween = prevTween._prev;
721
+ }
722
+ }
723
+ if (prevTween) {
724
+ child._next = prevTween._next;
725
+ prevTween._next = child;
726
+ } else {
727
+ child._next = this._first;
728
+ this._first = child;
729
+ }
730
+ if (child._next) {
731
+ child._next._prev = child;
732
+ } else {
733
+ this._last = child;
734
+ }
735
+ child._prev = prevTween;
736
+ if (this._timeline) {
737
+ this._uncache(true);
738
+ }
739
+ return this;
740
+ };
741
+
742
+ p._remove = function(tween, skipDisable) {
743
+ if (tween.timeline === this) {
744
+ if (!skipDisable) {
745
+ tween._enabled(false, true);
746
+ }
747
+ tween.timeline = null;
748
+
749
+ if (tween._prev) {
750
+ tween._prev._next = tween._next;
751
+ } else if (this._first === tween) {
752
+ this._first = tween._next;
753
+ }
754
+ if (tween._next) {
755
+ tween._next._prev = tween._prev;
756
+ } else if (this._last === tween) {
757
+ this._last = tween._prev;
758
+ }
759
+
760
+ if (this._timeline) {
761
+ this._uncache(true);
762
+ }
763
+ }
764
+ return this;
765
+ };
766
+
767
+ p.render = function(time, suppressEvents, force) {
768
+ var tween = this._first,
769
+ next;
770
+ this._totalTime = this._time = this._rawPrevTime = time;
771
+ while (tween) {
772
+ next = tween._next; //record it here because the value could change after rendering...
773
+ if (tween._active || (time >= tween._startTime && !tween._paused)) {
774
+ if (!tween._reversed) {
775
+ tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
776
+ } else {
777
+ tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
778
+ }
779
+ }
780
+ tween = next;
781
+ }
782
+ };
783
+
784
+ p.rawTime = function() {
785
+ if (!_tickerActive) {
786
+ _ticker.wake();
787
+ }
788
+ return this._totalTime;
789
+ };
790
+
791
+
792
+ /*
793
+ * ----------------------------------------------------------------
794
+ * TweenLite
795
+ * ----------------------------------------------------------------
796
+ */
797
+ var TweenLite = _class("TweenLite", function(target, duration, vars) {
798
+ Animation.call(this, duration, vars);
799
+ this.render = TweenLite.prototype.render; //speed optimization (avoid prototype lookup on this "hot" method)
800
+
801
+ if (target == null) {
802
+ throw "Cannot tween a null target.";
803
+ }
804
+
805
+ this.target = target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target;
806
+
807
+ var isSelector = (target.jquery || (target.length && target !== window && target[0] && (target[0] === window || (target[0].nodeType && target[0].style && !target.nodeType)))),
808
+ overwrite = this.vars.overwrite,
809
+ i, targ, targets;
810
+
811
+ this._overwrite = overwrite = (overwrite == null) ? _overwriteLookup[TweenLite.defaultOverwrite] : (typeof(overwrite) === "number") ? overwrite >> 0 : _overwriteLookup[overwrite];
812
+
813
+ if ((isSelector || target instanceof Array || (target.push && _isArray(target))) && typeof(target[0]) !== "number") {
814
+ this._targets = targets = _slice.call(target, 0);
815
+ this._propLookup = [];
816
+ this._siblings = [];
817
+ for (i = 0; i < targets.length; i++) {
818
+ targ = targets[i];
819
+ if (!targ) {
820
+ targets.splice(i--, 1);
821
+ continue;
822
+ } else if (typeof(targ) === "string") {
823
+ targ = targets[i--] = TweenLite.selector(targ); //in case it's an array of strings
824
+ if (typeof(targ) === "string") {
825
+ targets.splice(i+1, 1); //to avoid an endless loop (can't imagine why the selector would return a string, but just in case)
826
+ }
827
+ continue;
828
+ } else if (targ.length && targ !== window && targ[0] && (targ[0] === window || (targ[0].nodeType && targ[0].style && !targ.nodeType))) { //in case the user is passing in an array of selector objects (like jQuery objects), we need to check one more level and pull things out if necessary. Also note that <select> elements pass all the criteria regarding length and the first child having style, so we must also check to ensure the target isn't an HTML node itself.
829
+ targets.splice(i--, 1);
830
+ this._targets = targets = targets.concat(_slice.call(targ, 0));
831
+ continue;
832
+ }
833
+ this._siblings[i] = _register(targ, this, false);
834
+ if (overwrite === 1) if (this._siblings[i].length > 1) {
835
+ _applyOverwrite(targ, this, null, 1, this._siblings[i]);
836
+ }
837
+ }
838
+
839
+ } else {
840
+ this._propLookup = {};
841
+ this._siblings = _register(target, this, false);
842
+ if (overwrite === 1) if (this._siblings.length > 1) {
843
+ _applyOverwrite(target, this, null, 1, this._siblings);
844
+ }
845
+ }
846
+ if (this.vars.immediateRender || (duration === 0 && this._delay === 0 && this.vars.immediateRender !== false)) {
847
+ this.render(-this._delay, false, true);
848
+ }
849
+ }, true),
850
+ _isSelector = function(v) {
851
+ return (v.length && v !== window && v[0] && (v[0] === window || (v[0].nodeType && v[0].style && !v.nodeType))); //we cannot check "nodeType" if the target is window from within an iframe, otherwise it will trigger a security error in some browsers like Firefox.
852
+ },
853
+ _autoCSS = function(vars, target) {
854
+ var css = {},
855
+ p;
856
+ for (p in vars) {
857
+ if (!_reservedProps[p] && (!(p in target) || p === "x" || p === "y" || p === "width" || p === "height" || p === "className" || p === "border") && (!_plugins[p] || (_plugins[p] && _plugins[p]._autoCSS))) { //note: <img> elements contain read-only "x" and "y" properties. We should also prioritize editing css width/height rather than the element's properties.
858
+ css[p] = vars[p];
859
+ delete vars[p];
860
+ }
861
+ }
862
+ vars.css = css;
863
+ };
864
+
865
+ p = TweenLite.prototype = new Animation();
866
+ p.constructor = TweenLite;
867
+ p.kill()._gc = false;
868
+
869
+ //----TweenLite defaults, overwrite management, and root updates ----------------------------------------------------
870
+
871
+ p.ratio = 0;
872
+ p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
873
+ p._notifyPluginsOfEnabled = false;
874
+
875
+ TweenLite.version = "1.11.4";
876
+ TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
877
+ TweenLite.defaultOverwrite = "auto";
878
+ TweenLite.ticker = _ticker;
879
+ TweenLite.autoSleep = true;
880
+ TweenLite.selector = window.$ || window.jQuery || function(e) { if (window.$) { TweenLite.selector = window.$; return window.$(e); } return window.document ? window.document.getElementById((e.charAt(0) === "#") ? e.substr(1) : e) : e; };
881
+
882
+ var _internals = TweenLite._internals = {isArray:_isArray, isSelector:_isSelector}, //gives us a way to expose certain private values to other GreenSock classes without contaminating tha main TweenLite object.
883
+ _plugins = TweenLite._plugins = {},
884
+ _tweenLookup = TweenLite._tweenLookup = {},
885
+ _tweenLookupNum = 0,
886
+ _reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1},
887
+ _overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0},
888
+ _rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(),
889
+ _rootTimeline = Animation._rootTimeline = new SimpleTimeline();
890
+
891
+ _rootTimeline._startTime = _ticker.time;
892
+ _rootFramesTimeline._startTime = _ticker.frame;
893
+ _rootTimeline._active = _rootFramesTimeline._active = true;
894
+
895
+ Animation._updateRoot = function() {
896
+ _rootTimeline.render((_ticker.time - _rootTimeline._startTime) * _rootTimeline._timeScale, false, false);
897
+ _rootFramesTimeline.render((_ticker.frame - _rootFramesTimeline._startTime) * _rootFramesTimeline._timeScale, false, false);
898
+ if (!(_ticker.frame % 120)) { //dump garbage every 120 frames...
899
+ var i, a, p;
900
+ for (p in _tweenLookup) {
901
+ a = _tweenLookup[p].tweens;
902
+ i = a.length;
903
+ while (--i > -1) {
904
+ if (a[i]._gc) {
905
+ a.splice(i, 1);
906
+ }
907
+ }
908
+ if (a.length === 0) {
909
+ delete _tweenLookup[p];
910
+ }
911
+ }
912
+ //if there are no more tweens in the root timelines, or if they're all paused, make the _timer sleep to reduce load on the CPU slightly
913
+ p = _rootTimeline._first;
914
+ if (!p || p._paused) if (TweenLite.autoSleep && !_rootFramesTimeline._first && _ticker._listeners.tick.length === 1) {
915
+ while (p && p._paused) {
916
+ p = p._next;
917
+ }
918
+ if (!p) {
919
+ _ticker.sleep();
920
+ }
921
+ }
922
+ }
923
+ };
924
+
925
+ _ticker.addEventListener("tick", Animation._updateRoot);
926
+
927
+ var _register = function(target, tween, scrub) {
928
+ var id = target._gsTweenID, a, i;
929
+ if (!_tweenLookup[id || (target._gsTweenID = id = "t" + (_tweenLookupNum++))]) {
930
+ _tweenLookup[id] = {target:target, tweens:[]};
931
+ }
932
+ if (tween) {
933
+ a = _tweenLookup[id].tweens;
934
+ a[(i = a.length)] = tween;
935
+ if (scrub) {
936
+ while (--i > -1) {
937
+ if (a[i] === tween) {
938
+ a.splice(i, 1);
939
+ }
940
+ }
941
+ }
942
+ }
943
+ return _tweenLookup[id].tweens;
944
+ },
945
+
946
+ _applyOverwrite = function(target, tween, props, mode, siblings) {
947
+ var i, changed, curTween, l;
948
+ if (mode === 1 || mode >= 4) {
949
+ l = siblings.length;
950
+ for (i = 0; i < l; i++) {
951
+ if ((curTween = siblings[i]) !== tween) {
952
+ if (!curTween._gc) if (curTween._enabled(false, false)) {
953
+ changed = true;
954
+ }
955
+ } else if (mode === 5) {
956
+ break;
957
+ }
958
+ }
959
+ return changed;
960
+ }
961
+ //NOTE: Add 0.0000000001 to overcome floating point errors that can cause the startTime to be VERY slightly off (when a tween's time() is set for example)
962
+ var startTime = tween._startTime + _tinyNum,
963
+ overlaps = [],
964
+ oCount = 0,
965
+ zeroDur = (tween._duration === 0),
966
+ globalStart;
967
+ i = siblings.length;
968
+ while (--i > -1) {
969
+ if ((curTween = siblings[i]) === tween || curTween._gc || curTween._paused) {
970
+ //ignore
971
+ } else if (curTween._timeline !== tween._timeline) {
972
+ globalStart = globalStart || _checkOverlap(tween, 0, zeroDur);
973
+ if (_checkOverlap(curTween, globalStart, zeroDur) === 0) {
974
+ overlaps[oCount++] = curTween;
975
+ }
976
+ } else if (curTween._startTime <= startTime) if (curTween._startTime + curTween.totalDuration() / curTween._timeScale > startTime) if (!((zeroDur || !curTween._initted) && startTime - curTween._startTime <= 0.0000000002)) {
977
+ overlaps[oCount++] = curTween;
978
+ }
979
+ }
980
+
981
+ i = oCount;
982
+ while (--i > -1) {
983
+ curTween = overlaps[i];
984
+ if (mode === 2) if (curTween._kill(props, target)) {
985
+ changed = true;
986
+ }
987
+ if (mode !== 2 || (!curTween._firstPT && curTween._initted)) {
988
+ if (curTween._enabled(false, false)) { //if all property tweens have been overwritten, kill the tween.
989
+ changed = true;
990
+ }
991
+ }
992
+ }
993
+ return changed;
994
+ },
995
+
996
+ _checkOverlap = function(tween, reference, zeroDur) {
997
+ var tl = tween._timeline,
998
+ ts = tl._timeScale,
999
+ t = tween._startTime;
1000
+ while (tl._timeline) {
1001
+ t += tl._startTime;
1002
+ ts *= tl._timeScale;
1003
+ if (tl._paused) {
1004
+ return -100;
1005
+ }
1006
+ tl = tl._timeline;
1007
+ }
1008
+ t /= ts;
1009
+ return (t > reference) ? t - reference : ((zeroDur && t === reference) || (!tween._initted && t - reference < 2 * _tinyNum)) ? _tinyNum : ((t += tween.totalDuration() / tween._timeScale / ts) > reference + _tinyNum) ? 0 : t - reference - _tinyNum;
1010
+ };
1011
+
1012
+
1013
+ //---- TweenLite instance methods -----------------------------------------------------------------------------
1014
+
1015
+ p._init = function() {
1016
+ var v = this.vars,
1017
+ op = this._overwrittenProps,
1018
+ dur = this._duration,
1019
+ immediate = v.immediateRender,
1020
+ ease = v.ease,
1021
+ i, initPlugins, pt, p;
1022
+ if (v.startAt) {
1023
+ if (this._startAt) {
1024
+ this._startAt.render(-1, true); //if we've run a startAt previously (when the tween instantiated), we should revert it so that the values re-instantiate correctly particularly for relative tweens. Without this, a TweenLite.fromTo(obj, 1, {x:"+=100"}, {x:"-=100"}), for example, would actually jump to +=200 because the startAt would run twice, doubling the relative change.
1025
+ }
1026
+ v.startAt.overwrite = 0;
1027
+ v.startAt.immediateRender = true;
1028
+ this._startAt = TweenLite.to(this.target, 0, v.startAt);
1029
+ if (immediate) {
1030
+ if (this._time > 0) {
1031
+ this._startAt = null; //tweens that render immediately (like most from() and fromTo() tweens) shouldn't revert when their parent timeline's playhead goes backward past the startTime because the initial render could have happened anytime and it shouldn't be directly correlated to this tween's startTime. Imagine setting up a complex animation where the beginning states of various objects are rendered immediately but the tween doesn't happen for quite some time - if we revert to the starting values as soon as the playhead goes backward past the tween's startTime, it will throw things off visually. Reversion should only happen in TimelineLite/Max instances where immediateRender was false (which is the default in the convenience methods like from()).
1032
+ } else if (dur !== 0) {
1033
+ return; //we skip initialization here so that overwriting doesn't occur until the tween actually begins. Otherwise, if you create several immediateRender:true tweens of the same target/properties to drop into a TimelineLite or TimelineMax, the last one created would overwrite the first ones because they didn't get placed into the timeline yet before the first render occurs and kicks in overwriting.
1034
+ }
1035
+ }
1036
+ } else if (v.runBackwards && dur !== 0) {
1037
+ //from() tweens must be handled uniquely: their beginning values must be rendered but we don't want overwriting to occur yet (when time is still 0). Wait until the tween actually begins before doing all the routines like overwriting. At that time, we should render at the END of the tween to ensure that things initialize correctly (remember, from() tweens go backwards)
1038
+ if (this._startAt) {
1039
+ this._startAt.render(-1, true);
1040
+ this._startAt = null;
1041
+ } else {
1042
+ pt = {};
1043
+ for (p in v) { //copy props into a new object and skip any reserved props, otherwise onComplete or onUpdate or onStart could fire. We should, however, permit autoCSS to go through.
1044
+ if (!_reservedProps[p] || p === "autoCSS") {
1045
+ pt[p] = v[p];
1046
+ }
1047
+ }
1048
+ pt.overwrite = 0;
1049
+ pt.data = "isFromStart"; //we tag the tween with as "isFromStart" so that if [inside a plugin] we need to only do something at the very END of a tween, we have a way of identifying this tween as merely the one that's setting the beginning values for a "from()" tween. For example, clearProps in CSSPlugin should only get applied at the very END of a tween and without this tag, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in.
1050
+ this._startAt = TweenLite.to(this.target, 0, pt);
1051
+ if (!v.immediateRender) {
1052
+ this._startAt.render(-1, true); //for tweens that aren't rendered immediately, we still need to use the _startAt to record the starting values so that we can revert to them if the parent timeline's playhead goes backward beyond the beginning, but we immediately revert the tween back otherwise the parent tween that's currently instantiating wouldn't see the wrong starting values (since they were changed by the _startAt tween)
1053
+ } else if (this._time === 0) {
1054
+ return;
1055
+ }
1056
+ }
1057
+ }
1058
+ if (!ease) {
1059
+ this._ease = TweenLite.defaultEase;
1060
+ } else if (ease instanceof Ease) {
1061
+ this._ease = (v.easeParams instanceof Array) ? ease.config.apply(ease, v.easeParams) : ease;
1062
+ } else {
1063
+ this._ease = (typeof(ease) === "function") ? new Ease(ease, v.easeParams) : _easeMap[ease] || TweenLite.defaultEase;
1064
+ }
1065
+ this._easeType = this._ease._type;
1066
+ this._easePower = this._ease._power;
1067
+ this._firstPT = null;
1068
+
1069
+ if (this._targets) {
1070
+ i = this._targets.length;
1071
+ while (--i > -1) {
1072
+ if ( this._initProps( this._targets[i], (this._propLookup[i] = {}), this._siblings[i], (op ? op[i] : null)) ) {
1073
+ initPlugins = true;
1074
+ }
1075
+ }
1076
+ } else {
1077
+ initPlugins = this._initProps(this.target, this._propLookup, this._siblings, op);
1078
+ }
1079
+
1080
+ if (initPlugins) {
1081
+ TweenLite._onPluginEvent("_onInitAllProps", this); //reorders the array in order of priority. Uses a static TweenPlugin method in order to minimize file size in TweenLite
1082
+ }
1083
+ if (op) if (!this._firstPT) if (typeof(this.target) !== "function") { //if all tweening properties have been overwritten, kill the tween. If the target is a function, it's probably a delayedCall so let it live.
1084
+ this._enabled(false, false);
1085
+ }
1086
+ if (v.runBackwards) {
1087
+ pt = this._firstPT;
1088
+ while (pt) {
1089
+ pt.s += pt.c;
1090
+ pt.c = -pt.c;
1091
+ pt = pt._next;
1092
+ }
1093
+ }
1094
+ this._onUpdate = v.onUpdate;
1095
+ this._initted = true;
1096
+ };
1097
+
1098
+ p._initProps = function(target, propLookup, siblings, overwrittenProps) {
1099
+ var p, i, initPlugins, plugin, a, pt, v;
1100
+ if (target == null) {
1101
+ return false;
1102
+ }
1103
+ if (!this.vars.css) if (target.style) if (target !== window && target.nodeType) if (_plugins.css) if (this.vars.autoCSS !== false) { //it's so common to use TweenLite/Max to animate the css of DOM elements, we assume that if the target is a DOM element, that's what is intended (a convenience so that users don't have to wrap things in css:{}, although we still recommend it for a slight performance boost and better specificity). Note: we cannot check "nodeType" on the window inside an iframe.
1104
+ _autoCSS(this.vars, target);
1105
+ }
1106
+ for (p in this.vars) {
1107
+ v = this.vars[p];
1108
+ if (_reservedProps[p]) {
1109
+ if (v) if ((v instanceof Array) || (v.push && _isArray(v))) if (v.join("").indexOf("{self}") !== -1) {
1110
+ this.vars[p] = v = this._swapSelfInParams(v, this);
1111
+ }
1112
+
1113
+ } else if (_plugins[p] && (plugin = new _plugins[p]())._onInitTween(target, this.vars[p], this)) {
1114
+
1115
+ //t - target [object]
1116
+ //p - property [string]
1117
+ //s - start [number]
1118
+ //c - change [number]
1119
+ //f - isFunction [boolean]
1120
+ //n - name [string]
1121
+ //pg - isPlugin [boolean]
1122
+ //pr - priority [number]
1123
+ this._firstPT = pt = {_next:this._firstPT, t:plugin, p:"setRatio", s:0, c:1, f:true, n:p, pg:true, pr:plugin._priority};
1124
+ i = plugin._overwriteProps.length;
1125
+ while (--i > -1) {
1126
+ propLookup[plugin._overwriteProps[i]] = this._firstPT;
1127
+ }
1128
+ if (plugin._priority || plugin._onInitAllProps) {
1129
+ initPlugins = true;
1130
+ }
1131
+ if (plugin._onDisable || plugin._onEnable) {
1132
+ this._notifyPluginsOfEnabled = true;
1133
+ }
1134
+
1135
+ } else {
1136
+ this._firstPT = propLookup[p] = pt = {_next:this._firstPT, t:target, p:p, f:(typeof(target[p]) === "function"), n:p, pg:false, pr:0};
1137
+ pt.s = (!pt.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]();
1138
+ pt.c = (typeof(v) === "string" && v.charAt(1) === "=") ? parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) : (Number(v) - pt.s) || 0;
1139
+ }
1140
+ if (pt) if (pt._next) {
1141
+ pt._next._prev = pt;
1142
+ }
1143
+ }
1144
+
1145
+ if (overwrittenProps) if (this._kill(overwrittenProps, target)) { //another tween may have tried to overwrite properties of this tween before init() was called (like if two tweens start at the same time, the one created second will run first)
1146
+ return this._initProps(target, propLookup, siblings, overwrittenProps);
1147
+ }
1148
+ if (this._overwrite > 1) if (this._firstPT) if (siblings.length > 1) if (_applyOverwrite(target, this, propLookup, this._overwrite, siblings)) {
1149
+ this._kill(propLookup, target);
1150
+ return this._initProps(target, propLookup, siblings, overwrittenProps);
1151
+ }
1152
+ return initPlugins;
1153
+ };
1154
+
1155
+ p.render = function(time, suppressEvents, force) {
1156
+ var prevTime = this._time,
1157
+ duration = this._duration,
1158
+ isComplete, callback, pt, rawPrevTime;
1159
+ if (time >= duration) {
1160
+ this._totalTime = this._time = duration;
1161
+ this.ratio = this._ease._calcEnd ? this._ease.getRatio(1) : 1;
1162
+ if (!this._reversed) {
1163
+ isComplete = true;
1164
+ callback = "onComplete";
1165
+ }
1166
+ if (duration === 0) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
1167
+ rawPrevTime = this._rawPrevTime;
1168
+ if (time === 0 || rawPrevTime < 0 || rawPrevTime === _tinyNum) if (rawPrevTime !== time) {
1169
+ force = true;
1170
+ if (rawPrevTime > _tinyNum) {
1171
+ callback = "onReverseComplete";
1172
+ }
1173
+ }
1174
+ this._rawPrevTime = rawPrevTime = (!suppressEvents || time || rawPrevTime === 0) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
1175
+ }
1176
+
1177
+ } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
1178
+ this._totalTime = this._time = 0;
1179
+ this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0;
1180
+ if (prevTime !== 0 || (duration === 0 && this._rawPrevTime > _tinyNum)) {
1181
+ callback = "onReverseComplete";
1182
+ isComplete = this._reversed;
1183
+ }
1184
+ if (time < 0) {
1185
+ this._active = false;
1186
+ if (duration === 0) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
1187
+ if (this._rawPrevTime >= 0) {
1188
+ force = true;
1189
+ }
1190
+ this._rawPrevTime = rawPrevTime = (!suppressEvents || time || this._rawPrevTime === 0) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
1191
+ }
1192
+ } else if (!this._initted) { //if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately.
1193
+ force = true;
1194
+ }
1195
+ } else {
1196
+ this._totalTime = this._time = time;
1197
+
1198
+ if (this._easeType) {
1199
+ var r = time / duration, type = this._easeType, pow = this._easePower;
1200
+ if (type === 1 || (type === 3 && r >= 0.5)) {
1201
+ r = 1 - r;
1202
+ }
1203
+ if (type === 3) {
1204
+ r *= 2;
1205
+ }
1206
+ if (pow === 1) {
1207
+ r *= r;
1208
+ } else if (pow === 2) {
1209
+ r *= r * r;
1210
+ } else if (pow === 3) {
1211
+ r *= r * r * r;
1212
+ } else if (pow === 4) {
1213
+ r *= r * r * r * r;
1214
+ }
1215
+
1216
+ if (type === 1) {
1217
+ this.ratio = 1 - r;
1218
+ } else if (type === 2) {
1219
+ this.ratio = r;
1220
+ } else if (time / duration < 0.5) {
1221
+ this.ratio = r / 2;
1222
+ } else {
1223
+ this.ratio = 1 - (r / 2);
1224
+ }
1225
+
1226
+ } else {
1227
+ this.ratio = this._ease.getRatio(time / duration);
1228
+ }
1229
+
1230
+ }
1231
+
1232
+ if (this._time === prevTime && !force) {
1233
+ return;
1234
+ } else if (!this._initted) {
1235
+ this._init();
1236
+ if (!this._initted || this._gc) { //immediateRender tweens typically won't initialize until the playhead advances (_time is greater than 0) in order to ensure that overwriting occurs properly. Also, if all of the tweening properties have been overwritten (which would cause _gc to be true, as set in _init()), we shouldn't continue otherwise an onStart callback could be called for example.
1237
+ return;
1238
+ }
1239
+ //_ease is initially set to defaultEase, so now that init() has run, _ease is set properly and we need to recalculate the ratio. Overall this is faster than using conditional logic earlier in the method to avoid having to set ratio twice because we only init() once but renderTime() gets called VERY frequently.
1240
+ if (this._time && !isComplete) {
1241
+ this.ratio = this._ease.getRatio(this._time / duration);
1242
+ } else if (isComplete && this._ease._calcEnd) {
1243
+ this.ratio = this._ease.getRatio((this._time === 0) ? 0 : 1);
1244
+ }
1245
+ }
1246
+
1247
+ if (!this._active) if (!this._paused && this._time !== prevTime && time >= 0) {
1248
+ this._active = true; //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done.
1249
+ }
1250
+ if (prevTime === 0) {
1251
+ if (this._startAt) {
1252
+ if (time >= 0) {
1253
+ this._startAt.render(time, suppressEvents, force);
1254
+ } else if (!callback) {
1255
+ callback = "_dummyGS"; //if no callback is defined, use a dummy value just so that the condition at the end evaluates as true because _startAt should render AFTER the normal render loop when the time is negative. We could handle this in a more intuitive way, of course, but the render loop is the MOST important thing to optimize, so this technique allows us to avoid adding extra conditional logic in a high-frequency area.
1256
+ }
1257
+ }
1258
+ if (this.vars.onStart) if (this._time !== 0 || duration === 0) if (!suppressEvents) {
1259
+ this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
1260
+ }
1261
+ }
1262
+
1263
+ pt = this._firstPT;
1264
+ while (pt) {
1265
+ if (pt.f) {
1266
+ pt.t[pt.p](pt.c * this.ratio + pt.s);
1267
+ } else {
1268
+ pt.t[pt.p] = pt.c * this.ratio + pt.s;
1269
+ }
1270
+ pt = pt._next;
1271
+ }
1272
+
1273
+ if (this._onUpdate) {
1274
+ if (time < 0) if (this._startAt && this._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
1275
+ this._startAt.render(time, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete.
1276
+ }
1277
+ if (!suppressEvents) if (this._time !== prevTime || isComplete) {
1278
+ this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
1279
+ }
1280
+ }
1281
+
1282
+ if (callback) if (!this._gc) { //check _gc because there's a chance that kill() could be called in an onUpdate
1283
+ if (time < 0 && this._startAt && !this._onUpdate && this._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
1284
+ this._startAt.render(time, suppressEvents, force);
1285
+ }
1286
+ if (isComplete) {
1287
+ if (this._timeline.autoRemoveChildren) {
1288
+ this._enabled(false, false);
1289
+ }
1290
+ this._active = false;
1291
+ }
1292
+ if (!suppressEvents && this.vars[callback]) {
1293
+ this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray);
1294
+ }
1295
+ if (duration === 0 && this._rawPrevTime === _tinyNum && rawPrevTime !== _tinyNum) { //the onComplete or onReverseComplete could trigger movement of the playhead and for zero-duration tweens (which must discern direction) that land directly back on their start time, we don't want to fire again on the next render. Think of several addPause()'s in a timeline that forces the playhead to a certain spot, but what if it's already paused and another tween is tweening the "time" of the timeline? Each time it moves [forward] past that spot, it would move back, and since suppressEvents is true, it'd reset _rawPrevTime to _tinyNum so that when it begins again, the callback would fire (so ultimately it could bounce back and forth during that tween). Again, this is a very uncommon scenario, but possible nonetheless.
1296
+ this._rawPrevTime = 0;
1297
+ }
1298
+ }
1299
+
1300
+ };
1301
+
1302
+ p._kill = function(vars, target) {
1303
+ if (vars === "all") {
1304
+ vars = null;
1305
+ }
1306
+ if (vars == null) if (target == null || target === this.target) {
1307
+ return this._enabled(false, false);
1308
+ }
1309
+ target = (typeof(target) !== "string") ? (target || this._targets || this.target) : TweenLite.selector(target) || target;
1310
+ var i, overwrittenProps, p, pt, propLookup, changed, killProps, record;
1311
+ if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") {
1312
+ i = target.length;
1313
+ while (--i > -1) {
1314
+ if (this._kill(vars, target[i])) {
1315
+ changed = true;
1316
+ }
1317
+ }
1318
+ } else {
1319
+ if (this._targets) {
1320
+ i = this._targets.length;
1321
+ while (--i > -1) {
1322
+ if (target === this._targets[i]) {
1323
+ propLookup = this._propLookup[i] || {};
1324
+ this._overwrittenProps = this._overwrittenProps || [];
1325
+ overwrittenProps = this._overwrittenProps[i] = vars ? this._overwrittenProps[i] || {} : "all";
1326
+ break;
1327
+ }
1328
+ }
1329
+ } else if (target !== this.target) {
1330
+ return false;
1331
+ } else {
1332
+ propLookup = this._propLookup;
1333
+ overwrittenProps = this._overwrittenProps = vars ? this._overwrittenProps || {} : "all";
1334
+ }
1335
+
1336
+ if (propLookup) {
1337
+ killProps = vars || propLookup;
1338
+ record = (vars !== overwrittenProps && overwrittenProps !== "all" && vars !== propLookup && (typeof(vars) !== "object" || !vars._tempKill)); //_tempKill is a super-secret way to delete a particular tweening property but NOT have it remembered as an official overwritten property (like in BezierPlugin)
1339
+ for (p in killProps) {
1340
+ if ((pt = propLookup[p])) {
1341
+ if (pt.pg && pt.t._kill(killProps)) {
1342
+ changed = true; //some plugins need to be notified so they can perform cleanup tasks first
1343
+ }
1344
+ if (!pt.pg || pt.t._overwriteProps.length === 0) {
1345
+ if (pt._prev) {
1346
+ pt._prev._next = pt._next;
1347
+ } else if (pt === this._firstPT) {
1348
+ this._firstPT = pt._next;
1349
+ }
1350
+ if (pt._next) {
1351
+ pt._next._prev = pt._prev;
1352
+ }
1353
+ pt._next = pt._prev = null;
1354
+ }
1355
+ delete propLookup[p];
1356
+ }
1357
+ if (record) {
1358
+ overwrittenProps[p] = 1;
1359
+ }
1360
+ }
1361
+ if (!this._firstPT && this._initted) { //if all tweening properties are killed, kill the tween. Without this line, if there's a tween with multiple targets and then you killTweensOf() each target individually, the tween would technically still remain active and fire its onComplete even though there aren't any more properties tweening.
1362
+ this._enabled(false, false);
1363
+ }
1364
+ }
1365
+ }
1366
+ return changed;
1367
+ };
1368
+
1369
+ p.invalidate = function() {
1370
+ if (this._notifyPluginsOfEnabled) {
1371
+ TweenLite._onPluginEvent("_onDisable", this);
1372
+ }
1373
+ this._firstPT = null;
1374
+ this._overwrittenProps = null;
1375
+ this._onUpdate = null;
1376
+ this._startAt = null;
1377
+ this._initted = this._active = this._notifyPluginsOfEnabled = false;
1378
+ this._propLookup = (this._targets) ? {} : [];
1379
+ return this;
1380
+ };
1381
+
1382
+ p._enabled = function(enabled, ignoreTimeline) {
1383
+ if (!_tickerActive) {
1384
+ _ticker.wake();
1385
+ }
1386
+ if (enabled && this._gc) {
1387
+ var targets = this._targets,
1388
+ i;
1389
+ if (targets) {
1390
+ i = targets.length;
1391
+ while (--i > -1) {
1392
+ this._siblings[i] = _register(targets[i], this, true);
1393
+ }
1394
+ } else {
1395
+ this._siblings = _register(this.target, this, true);
1396
+ }
1397
+ }
1398
+ Animation.prototype._enabled.call(this, enabled, ignoreTimeline);
1399
+ if (this._notifyPluginsOfEnabled) if (this._firstPT) {
1400
+ return TweenLite._onPluginEvent((enabled ? "_onEnable" : "_onDisable"), this);
1401
+ }
1402
+ return false;
1403
+ };
1404
+
1405
+
1406
+ //----TweenLite static methods -----------------------------------------------------
1407
+
1408
+ TweenLite.to = function(target, duration, vars) {
1409
+ return new TweenLite(target, duration, vars);
1410
+ };
1411
+
1412
+ TweenLite.from = function(target, duration, vars) {
1413
+ vars.runBackwards = true;
1414
+ vars.immediateRender = (vars.immediateRender != false);
1415
+ return new TweenLite(target, duration, vars);
1416
+ };
1417
+
1418
+ TweenLite.fromTo = function(target, duration, fromVars, toVars) {
1419
+ toVars.startAt = fromVars;
1420
+ toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false);
1421
+ return new TweenLite(target, duration, toVars);
1422
+ };
1423
+
1424
+ TweenLite.delayedCall = function(delay, callback, params, scope, useFrames) {
1425
+ return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, onCompleteScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, onReverseCompleteScope:scope, immediateRender:false, useFrames:useFrames, overwrite:0});
1426
+ };
1427
+
1428
+ TweenLite.set = function(target, vars) {
1429
+ return new TweenLite(target, 0, vars);
1430
+ };
1431
+
1432
+ TweenLite.getTweensOf = function(target, onlyActive) {
1433
+ if (target == null) { return []; }
1434
+ target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target;
1435
+ var i, a, j, t;
1436
+ if ((_isArray(target) || _isSelector(target)) && typeof(target[0]) !== "number") {
1437
+ i = target.length;
1438
+ a = [];
1439
+ while (--i > -1) {
1440
+ a = a.concat(TweenLite.getTweensOf(target[i], onlyActive));
1441
+ }
1442
+ i = a.length;
1443
+ //now get rid of any duplicates (tweens of arrays of objects could cause duplicates)
1444
+ while (--i > -1) {
1445
+ t = a[i];
1446
+ j = i;
1447
+ while (--j > -1) {
1448
+ if (t === a[j]) {
1449
+ a.splice(i, 1);
1450
+ }
1451
+ }
1452
+ }
1453
+ } else {
1454
+ a = _register(target).concat();
1455
+ i = a.length;
1456
+ while (--i > -1) {
1457
+ if (a[i]._gc || (onlyActive && !a[i].isActive())) {
1458
+ a.splice(i, 1);
1459
+ }
1460
+ }
1461
+ }
1462
+ return a;
1463
+ };
1464
+
1465
+ TweenLite.killTweensOf = TweenLite.killDelayedCallsTo = function(target, onlyActive, vars) {
1466
+ if (typeof(onlyActive) === "object") {
1467
+ vars = onlyActive; //for backwards compatibility (before "onlyActive" parameter was inserted)
1468
+ onlyActive = false;
1469
+ }
1470
+ var a = TweenLite.getTweensOf(target, onlyActive),
1471
+ i = a.length;
1472
+ while (--i > -1) {
1473
+ a[i]._kill(vars, target);
1474
+ }
1475
+ };
1476
+
1477
+
1478
+
1479
+ /*
1480
+ * ----------------------------------------------------------------
1481
+ * TweenPlugin (could easily be split out as a separate file/class, but included for ease of use (so that people don't need to include another <script> call before loading plugins which is easy to forget)
1482
+ * ----------------------------------------------------------------
1483
+ */
1484
+ var TweenPlugin = _class("plugins.TweenPlugin", function(props, priority) {
1485
+ this._overwriteProps = (props || "").split(",");
1486
+ this._propName = this._overwriteProps[0];
1487
+ this._priority = priority || 0;
1488
+ this._super = TweenPlugin.prototype;
1489
+ }, true);
1490
+
1491
+ p = TweenPlugin.prototype;
1492
+ TweenPlugin.version = "1.10.1";
1493
+ TweenPlugin.API = 2;
1494
+ p._firstPT = null;
1495
+
1496
+ p._addTween = function(target, prop, start, end, overwriteProp, round) {
1497
+ var c, pt;
1498
+ if (end != null && (c = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - start : parseInt(end.charAt(0) + "1", 10) * Number(end.substr(2)))) {
1499
+ this._firstPT = pt = {_next:this._firstPT, t:target, p:prop, s:start, c:c, f:(typeof(target[prop]) === "function"), n:overwriteProp || prop, r:round};
1500
+ if (pt._next) {
1501
+ pt._next._prev = pt;
1502
+ }
1503
+ return pt;
1504
+ }
1505
+ };
1506
+
1507
+ p.setRatio = function(v) {
1508
+ var pt = this._firstPT,
1509
+ min = 0.000001,
1510
+ val;
1511
+ while (pt) {
1512
+ val = pt.c * v + pt.s;
1513
+ if (pt.r) {
1514
+ val = (val + ((val > 0) ? 0.5 : -0.5)) | 0; //about 4x faster than Math.round()
1515
+ } else if (val < min) if (val > -min) { //prevents issues with converting very small numbers to strings in the browser
1516
+ val = 0;
1517
+ }
1518
+ if (pt.f) {
1519
+ pt.t[pt.p](val);
1520
+ } else {
1521
+ pt.t[pt.p] = val;
1522
+ }
1523
+ pt = pt._next;
1524
+ }
1525
+ };
1526
+
1527
+ p._kill = function(lookup) {
1528
+ var a = this._overwriteProps,
1529
+ pt = this._firstPT,
1530
+ i;
1531
+ if (lookup[this._propName] != null) {
1532
+ this._overwriteProps = [];
1533
+ } else {
1534
+ i = a.length;
1535
+ while (--i > -1) {
1536
+ if (lookup[a[i]] != null) {
1537
+ a.splice(i, 1);
1538
+ }
1539
+ }
1540
+ }
1541
+ while (pt) {
1542
+ if (lookup[pt.n] != null) {
1543
+ if (pt._next) {
1544
+ pt._next._prev = pt._prev;
1545
+ }
1546
+ if (pt._prev) {
1547
+ pt._prev._next = pt._next;
1548
+ pt._prev = null;
1549
+ } else if (this._firstPT === pt) {
1550
+ this._firstPT = pt._next;
1551
+ }
1552
+ }
1553
+ pt = pt._next;
1554
+ }
1555
+ return false;
1556
+ };
1557
+
1558
+ p._roundProps = function(lookup, value) {
1559
+ var pt = this._firstPT;
1560
+ while (pt) {
1561
+ if (lookup[this._propName] || (pt.n != null && lookup[ pt.n.split(this._propName + "_").join("") ])) { //some properties that are very plugin-specific add a prefix named after the _propName plus an underscore, so we need to ignore that extra stuff here.
1562
+ pt.r = value;
1563
+ }
1564
+ pt = pt._next;
1565
+ }
1566
+ };
1567
+
1568
+ TweenLite._onPluginEvent = function(type, tween) {
1569
+ var pt = tween._firstPT,
1570
+ changed, pt2, first, last, next;
1571
+ if (type === "_onInitAllProps") {
1572
+ //sorts the PropTween linked list in order of priority because some plugins need to render earlier/later than others, like MotionBlurPlugin applies its effects after all x/y/alpha tweens have rendered on each frame.
1573
+ while (pt) {
1574
+ next = pt._next;
1575
+ pt2 = first;
1576
+ while (pt2 && pt2.pr > pt.pr) {
1577
+ pt2 = pt2._next;
1578
+ }
1579
+ if ((pt._prev = pt2 ? pt2._prev : last)) {
1580
+ pt._prev._next = pt;
1581
+ } else {
1582
+ first = pt;
1583
+ }
1584
+ if ((pt._next = pt2)) {
1585
+ pt2._prev = pt;
1586
+ } else {
1587
+ last = pt;
1588
+ }
1589
+ pt = next;
1590
+ }
1591
+ pt = tween._firstPT = first;
1592
+ }
1593
+ while (pt) {
1594
+ if (pt.pg) if (typeof(pt.t[type]) === "function") if (pt.t[type]()) {
1595
+ changed = true;
1596
+ }
1597
+ pt = pt._next;
1598
+ }
1599
+ return changed;
1600
+ };
1601
+
1602
+ TweenPlugin.activate = function(plugins) {
1603
+ var i = plugins.length;
1604
+ while (--i > -1) {
1605
+ if (plugins[i].API === TweenPlugin.API) {
1606
+ _plugins[(new plugins[i]())._propName] = plugins[i];
1607
+ }
1608
+ }
1609
+ return true;
1610
+ };
1611
+
1612
+ //provides a more concise way to define plugins that have no dependencies besides TweenPlugin and TweenLite, wrapping common boilerplate stuff into one function (added in 1.9.0). You don't NEED to use this to define a plugin - the old way still works and can be useful in certain (rare) situations.
1613
+ _gsDefine.plugin = function(config) {
1614
+ if (!config || !config.propName || !config.init || !config.API) { throw "illegal plugin definition."; }
1615
+ var propName = config.propName,
1616
+ priority = config.priority || 0,
1617
+ overwriteProps = config.overwriteProps,
1618
+ map = {init:"_onInitTween", set:"setRatio", kill:"_kill", round:"_roundProps", initAll:"_onInitAllProps"},
1619
+ Plugin = _class("plugins." + propName.charAt(0).toUpperCase() + propName.substr(1) + "Plugin",
1620
+ function() {
1621
+ TweenPlugin.call(this, propName, priority);
1622
+ this._overwriteProps = overwriteProps || [];
1623
+ }, (config.global === true)),
1624
+ p = Plugin.prototype = new TweenPlugin(propName),
1625
+ prop;
1626
+ p.constructor = Plugin;
1627
+ Plugin.API = config.API;
1628
+ for (prop in map) {
1629
+ if (typeof(config[prop]) === "function") {
1630
+ p[map[prop]] = config[prop];
1631
+ }
1632
+ }
1633
+ Plugin.version = config.version;
1634
+ TweenPlugin.activate([Plugin]);
1635
+ return Plugin;
1636
+ };
1637
+
1638
+
1639
+ //now run through all the dependencies discovered and if any are missing, log that to the console as a warning. This is why it's best to have TweenLite load last - it can check all the dependencies for you.
1640
+ a = window._gsQueue;
1641
+ if (a) {
1642
+ for (i = 0; i < a.length; i++) {
1643
+ a[i]();
1644
+ }
1645
+ for (p in _defLookup) {
1646
+ if (!_defLookup[p].func) {
1647
+ window.console.log("GSAP encountered missing dependency: com.greensock." + p);
1648
+ }
1649
+ }
1650
+ }
1651
+
1652
+ _tickerActive = false; //ensures that the first official animation forces a ticker.tick() to update the time when it is instantiated
1653
+
1654
+ })(window);