greensock-rails 1.18.5.0 → 1.19.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/greensock/rails/version.rb +1 -1
- data/vendor/assets/javascripts/greensock/TimelineLite.js +5 -5
- data/vendor/assets/javascripts/greensock/TimelineMax.js +8 -6
- data/vendor/assets/javascripts/greensock/TweenLite.js +53 -31
- data/vendor/assets/javascripts/greensock/TweenMax.js +173 -72
- data/vendor/assets/javascripts/greensock/easing/EasePack.js +3 -3
- data/vendor/assets/javascripts/greensock/plugins/AttrPlugin.js +10 -6
- data/vendor/assets/javascripts/greensock/plugins/BezierPlugin.js +28 -11
- data/vendor/assets/javascripts/greensock/plugins/CSSPlugin.js +71 -19
- data/vendor/assets/javascripts/greensock/plugins/CSSRulePlugin.js +18 -4
- data/vendor/assets/javascripts/greensock/plugins/ColorPropsPlugin.js +8 -5
- data/vendor/assets/javascripts/greensock/plugins/DirectionalRotationPlugin.js +9 -5
- data/vendor/assets/javascripts/greensock/plugins/EaselPlugin.js +14 -10
- data/vendor/assets/javascripts/greensock/plugins/EndArrayPlugin.js +10 -9
- data/vendor/assets/javascripts/greensock/plugins/ModifiersPlugin.js +158 -0
- data/vendor/assets/javascripts/greensock/plugins/RoundPropsPlugin.js +7 -7
- data/vendor/assets/javascripts/greensock/plugins/ScrollToPlugin.js +77 -17
- data/vendor/assets/javascripts/greensock/plugins/TEMPLATE_Plugin.js +4 -3
- data/vendor/assets/javascripts/greensock/plugins/TextPlugin.js +17 -8
- data/vendor/assets/javascripts/greensock/utils/Draggable.js +50 -29
- metadata +2 -2
- data/vendor/assets/javascripts/greensock/plugins/KineticPlugin.js +0 -335
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 1.
|
3
|
-
* DATE:
|
2
|
+
* VERSION: 1.2.0
|
3
|
+
* DATE: 2016-07-14
|
4
4
|
* UPDATES AND DOCS AT: http://greensock.com
|
5
5
|
*
|
6
6
|
* This file is to be used as a simple template for writing your own plugin. See the
|
@@ -33,10 +33,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
33
33
|
* 1) target [object] - the target of the tween. In cases where the tween's original target is an array (or jQuery object), this target will be the individual object inside that array (a new plugin instance is created for each target in the array). For example, TweenLite.to([obj1, obj2, obj3], 1, {x:100}) the target will be obj1 or obj2 or obj3 rather than the array containing them.
|
34
34
|
* 2) value [*] - whatever value is passed as the special property value. For example, TweenLite.to(element, 1, {yourCustomProperty:3}) the value would be 3. Or for TweenLite.to(element, 1, {yourCustomProperty:{subProp1:3, subProp2:"whatever"}});, value would be {subProp1:3, subProp2:"whatever"}.
|
35
35
|
* 3) tween [TweenLite] - the TweenLite (or TweenMax) instance that is managing this plugin instance. This can be useful if you need to check certain state-related properties on the tween (maybe in the set method) like its duration or time. Most of the time, however, you don't need to do anything with the tween. It is provided just in case you want to reference it.
|
36
|
+
* 4) index [integer] - the index number of the target in the tween. For example, if an array is passed in as the target (or selector text), this would be 0 for the first one, 1 for the second, 2 for the third, etc. This was introduced in GSAP 1.19.0
|
36
37
|
*
|
37
38
|
* This function should return true unless you want to have TweenLite/Max skip the plugin altogether and instead treat the property/value like a normal tween (as if the plugin wasn't activated). This is rarely useful, so you should almost always return true.
|
38
39
|
*/
|
39
|
-
init: function(target, value, tween) {
|
40
|
+
init: function(target, value, tween, index) {
|
40
41
|
this._target = target; //we record the target so that we can refer to it in the set method when doing updates.
|
41
42
|
|
42
43
|
/* Next, we create a property tween for "scaleX" and "scaleY" properties of our target
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 0.5.
|
3
|
-
* DATE:
|
2
|
+
* VERSION: 0.5.2
|
3
|
+
* DATE: 2016-06-22
|
4
4
|
* UPDATES AND DOCS AT: http://greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
|
@@ -33,12 +33,17 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
33
33
|
TextPlugin = _gsScope._gsDefine.plugin({
|
34
34
|
propName: "text",
|
35
35
|
API: 2,
|
36
|
-
version:"0.5.
|
36
|
+
version:"0.5.2",
|
37
37
|
|
38
38
|
//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
|
39
|
-
init: function(target, value, tween) {
|
40
|
-
var i,
|
41
|
-
|
39
|
+
init: function(target, value, tween, index) {
|
40
|
+
var i = target.nodeName.toUpperCase(),
|
41
|
+
shrt;
|
42
|
+
if (typeof(value) === "function") {
|
43
|
+
value = value(index, target);
|
44
|
+
}
|
45
|
+
this._svg = (target.getBBox && (i === "TEXT" || i === "TSPAN"));
|
46
|
+
if (!("innerHTML" in target) && !this._svg) {
|
42
47
|
return false;
|
43
48
|
}
|
44
49
|
this._target = target;
|
@@ -66,7 +71,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
66
71
|
this._oldClass = value.oldClass;
|
67
72
|
this._hasClass = true;
|
68
73
|
}
|
69
|
-
i = this._original.length - this._text.length
|
74
|
+
i = this._original.length - this._text.length;
|
70
75
|
shrt = (i < 0) ? this._original : this._text;
|
71
76
|
this._fillChar = value.fillChar || (value.padSpace ? " " : "");
|
72
77
|
if (i < 0) {
|
@@ -98,7 +103,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
98
103
|
} else {
|
99
104
|
str = this._text.slice(0, i).join(this._delimiter) + this._delimiter + this._original.slice(i).join(this._delimiter);
|
100
105
|
}
|
101
|
-
|
106
|
+
if (this._svg) { //SVG text elements don't have an "innerHTML" in Microsoft browsers.
|
107
|
+
this._target.textContent = str;
|
108
|
+
} else {
|
109
|
+
this._target.innerHTML = (this._fillChar === " " && str.indexOf(" ") !== -1) ? str.split(" ").join(" ") : str;
|
110
|
+
}
|
102
111
|
}
|
103
112
|
|
104
113
|
}),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 0.14.
|
3
|
-
* DATE: 2016-
|
2
|
+
* VERSION: 0.14.8
|
3
|
+
* DATE: 2016-07-18
|
4
4
|
* UPDATES AND DOCS AT: http://greensock.com
|
5
5
|
*
|
6
6
|
* Requires TweenLite and CSSPlugin version 1.17.0 or later (TweenMax contains both TweenLite and CSSPlugin). ThrowPropsPlugin is required for momentum-based continuation of movement after the mouse/touch is released (ThrowPropsPlugin is a membership benefit of Club GreenSock - http://greensock.com/club/).
|
@@ -1139,7 +1139,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1139
1139
|
checkAutoScrollBounds = false,
|
1140
1140
|
isClickable = vars.clickableTest || _isClickable,
|
1141
1141
|
clickTime = 0,
|
1142
|
-
enabled, scrollProxy, startPointerX, startPointerY, startElementX, startElementY, hasBounds, hasDragCallback, maxX, minX, maxY, minY, tempVars, cssVars, touch, touchID, rotationOrigin, dirty, old, snapX, snapY, isClicking, touchEventTarget, matrix, interrupted, startScrollTop, startScrollLeft, applyObj, allowNativeTouchScrolling, touchDragAxis, isDispatching, clickDispatch,
|
1142
|
+
enabled, scrollProxy, startPointerX, startPointerY, startElementX, startElementY, hasBounds, hasDragCallback, maxX, minX, maxY, minY, tempVars, cssVars, touch, touchID, rotationOrigin, dirty, old, snapX, snapY, isClicking, touchEventTarget, matrix, interrupted, startScrollTop, startScrollLeft, applyObj, allowNativeTouchScrolling, touchDragAxis, isDispatching, clickDispatch, trustedClickDispatch,
|
1143
1143
|
//this method gets called on every tick of TweenLite.ticker which allows us to synchronize the renders to the core engine (which is typically synchronized with the display refresh via requestAnimationFrame). This is an optimization - it's better than applying the values inside the "mousemove" or "touchmove" event handler which may get called many times inbetween refreshes.
|
1144
1144
|
render = function(suppressEvents) {
|
1145
1145
|
if (self.autoScroll && self.isDragging && (checkAutoScrollBounds || dirty)) {
|
@@ -1269,6 +1269,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1269
1269
|
if (rotationMode) {
|
1270
1270
|
self.rotation = snappedValue;
|
1271
1271
|
}
|
1272
|
+
dirty = true;
|
1272
1273
|
}
|
1273
1274
|
}
|
1274
1275
|
if (snapY) {
|
@@ -1276,9 +1277,10 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1276
1277
|
if (snappedValue !== self.y) {
|
1277
1278
|
self.y = snappedValue;
|
1278
1279
|
}
|
1280
|
+
dirty = true;
|
1279
1281
|
}
|
1280
1282
|
}
|
1281
|
-
if (
|
1283
|
+
if (dirty) {
|
1282
1284
|
render(true);
|
1283
1285
|
}
|
1284
1286
|
if (!skipOnUpdate) {
|
@@ -1478,6 +1480,12 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1478
1480
|
return (self.tween && self.tween.isActive());
|
1479
1481
|
},
|
1480
1482
|
|
1483
|
+
removePlaceholder = function() {
|
1484
|
+
if (_placeholderDiv.parentNode && !isTweening() && !self.isDragging) { //_placeholderDiv just props open auto-scrolling containers so they don't collapse as the user drags left/up. We remove it after dragging (and throwing, if necessary) finishes.
|
1485
|
+
_placeholderDiv.parentNode.removeChild(_placeholderDiv);
|
1486
|
+
}
|
1487
|
+
},
|
1488
|
+
|
1481
1489
|
buildSnapFunc = function(snap, min, max, factor) {
|
1482
1490
|
if (typeof(snap) === "function") {
|
1483
1491
|
return function(n) {
|
@@ -1562,7 +1570,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1562
1570
|
if (allowNativeTouchScrolling || self.autoScroll) {
|
1563
1571
|
_recordMaxScrolls(target.parentNode);
|
1564
1572
|
}
|
1565
|
-
if (
|
1573
|
+
if (target.parentNode && (scrollProxy || (self.autoScroll && !rotationMode && target.parentNode._gsMaxScrollX && !_placeholderDiv.parentNode)) && !target.getBBox) { //add a placeholder div to prevent the parent container from collapsing when the user drags the element left.
|
1566
1574
|
_placeholderDiv.style.width = (target.parentNode.scrollWidth) + "px";
|
1567
1575
|
target.parentNode.appendChild(_placeholderDiv);
|
1568
1576
|
}
|
@@ -1750,7 +1758,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1750
1758
|
self.isPressed = false;
|
1751
1759
|
var originalEvent = e,
|
1752
1760
|
wasDragging = self.isDragging,
|
1753
|
-
|
1761
|
+
placeholderDelayedCall = TweenLite.delayedCall(0.001, removePlaceholder),
|
1762
|
+
touches, i, syntheticEvent, eventTarget, syntheticClick;
|
1754
1763
|
if (touchEventTarget) {
|
1755
1764
|
_removeListener(touchEventTarget, "touchend", onRelease);
|
1756
1765
|
_removeListener(touchEventTarget, "touchmove", onMove);
|
@@ -1764,9 +1773,6 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1764
1773
|
_removeListener(e.target, "mouseup", onRelease);
|
1765
1774
|
}
|
1766
1775
|
dirty = false;
|
1767
|
-
if (_placeholderDiv.parentNode) { //_placeholderDiv just props open auto-scrolling containers so they don't collapse as the user drags left/up.
|
1768
|
-
_placeholderDiv.parentNode.removeChild(_placeholderDiv);
|
1769
|
-
}
|
1770
1776
|
if (isClicking) {
|
1771
1777
|
if (e) {
|
1772
1778
|
_removeListener(e.target, "change", onRelease);
|
@@ -1817,7 +1823,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1817
1823
|
_dispatchEvent(self, "click", "onClick");
|
1818
1824
|
eventTarget = originalEvent.target || originalEvent.srcElement || target; //old IE uses srcElement
|
1819
1825
|
clickTime = _getTime();
|
1820
|
-
|
1826
|
+
syntheticClick = function() { // some browsers (like Firefox) won't trust script-generated clicks, so if the user tries to click on a video to play it, for example, it simply won't work. Since a regular "click" event will most likely be generated anyway (one that has its isTrusted flag set to true), we must slightly delay our script-generated click so that the "real"/trusted one is prioritized. Remember, when there are duplicate events in quick succession, we suppress all but the first one. Some browsers don't even trigger the "real" one at all, so our synthetic one is a safety valve that ensures that no matter what, a click event does get dispatched.
|
1821
1827
|
if (clickTime !== clickDispatch && self.enabled() && !self.isPressed) {
|
1822
1828
|
if (eventTarget.click) { //some browsers (like mobile Safari) don't properly trigger the click event
|
1823
1829
|
eventTarget.click();
|
@@ -1827,7 +1833,10 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1827
1833
|
eventTarget.dispatchEvent(syntheticEvent);
|
1828
1834
|
}
|
1829
1835
|
}
|
1830
|
-
}
|
1836
|
+
};
|
1837
|
+
if (!_isAndroid) { //iOS Safari requires the synthetic click to happen immediately or else it simply won't work, but Android doesn't play nice.
|
1838
|
+
TweenLite.delayedCall(0.00001, syntheticClick); //in addition to the iOS bug workaround, there's a Firefox issue with clicking on things like a video to play, so we must fake a click event in a slightly delayed fashion. Previously, we listened for the "click" event with "capture" false which solved the video-click-to-play issue, but it would allow the "click" event to be dispatched twice like if you were using a jQuery.click() because that was handled in the capture phase, thus we had to switch to the capture phase to avoid the double-dispatching, but do the delayed synthetic click.
|
1839
|
+
}
|
1831
1840
|
}
|
1832
1841
|
} else {
|
1833
1842
|
animate(vars.throwProps); //will skip if throwProps isn't defined or ThrowPropsPlugin isn't loaded.
|
@@ -1839,6 +1848,9 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1839
1848
|
}
|
1840
1849
|
_dispatchEvent(self, "release", "onRelease");
|
1841
1850
|
}
|
1851
|
+
if (isTweening()) {
|
1852
|
+
placeholderDelayedCall.duration( self.tween.duration() ); //sync the timing so that the placeholder DIV gets
|
1853
|
+
}
|
1842
1854
|
if (wasDragging) {
|
1843
1855
|
_dispatchEvent(self, "dragend", "onDragEnd");
|
1844
1856
|
}
|
@@ -1865,25 +1877,32 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
1865
1877
|
}
|
1866
1878
|
},
|
1867
1879
|
|
1868
|
-
onClick = function(e) {
|
1880
|
+
onClick = function(e) { //this was a huge pain in the neck to align all the various browsers and their behaviors. Chrome, Firefox, Safari, Opera, Android, and Microsoft Edge all handle events differently! Some will only trigger native behavior (like checkbox toggling) from trusted events. Others don't even support isTrusted, but require 2 events to flow through before triggering native behavior. Edge treats everything as trusted but also mandates that 2 flow through to trigger the correct native behavior.
|
1869
1881
|
var time = _getTime(),
|
1870
|
-
recentlyClicked = time - clickTime < 40,
|
1871
|
-
recentlyDragged = time - dragEndTime < 40
|
1872
|
-
|
1882
|
+
recentlyClicked = (time - clickTime < 40),
|
1883
|
+
recentlyDragged = (time - dragEndTime < 40),
|
1884
|
+
alreadyDispatched = (recentlyClicked && clickDispatch === clickTime),
|
1885
|
+
isModern = !!e.preventDefault,
|
1886
|
+
alreadyDispatchedTrusted = (recentlyClicked && trustedClickDispatch === clickTime),
|
1887
|
+
trusted = e.isTrusted || (e.isTrusted == null && recentlyClicked && alreadyDispatched); //note: Safari doesn't support isTrusted, and it won't properly execute native behavior (like toggling checkboxes) on the first synthetic "click" event - we must wait for the 2nd and treat it as trusted (but stop propagation at that point). Confusing, I know. Don't you love cross-browser compatibility challenges?
|
1888
|
+
if (isModern && (alreadyDispatched || (recentlyDragged && self.vars.suppressClickOnDrag !== false) )) {
|
1889
|
+
e.stopImmediatePropagation();
|
1890
|
+
}
|
1891
|
+
if (recentlyClicked && (!alreadyDispatched || (trusted !== alreadyDispatchedTrusted))) { //let the first click pass through unhindered. Let the next one only if it's trusted, then no more (stop quick-succession ones)
|
1892
|
+
if (trusted && alreadyDispatched) {
|
1893
|
+
trustedClickDispatch = clickTime;
|
1894
|
+
}
|
1873
1895
|
clickDispatch = clickTime;
|
1874
1896
|
return;
|
1875
1897
|
}
|
1876
1898
|
if (self.isPressed || recentlyDragged || recentlyClicked) {
|
1877
|
-
if (
|
1899
|
+
if (!isModern) {
|
1900
|
+
e.returnValue = false;
|
1901
|
+
} else if (!trusted || !e.detail || !recentlyClicked) {
|
1878
1902
|
e.preventDefault();
|
1879
|
-
if (
|
1880
|
-
e.
|
1903
|
+
if (e.preventManipulation) {
|
1904
|
+
e.preventManipulation(); //for some Microsoft browsers
|
1881
1905
|
}
|
1882
|
-
} else {
|
1883
|
-
e.returnValue = false;
|
1884
|
-
}
|
1885
|
-
if (e.preventManipulation) {
|
1886
|
-
e.preventManipulation(); //for some Microsoft browsers
|
1887
1906
|
}
|
1888
1907
|
}
|
1889
1908
|
};
|
@@ -2006,9 +2025,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
2006
2025
|
}
|
2007
2026
|
syncXY(true);
|
2008
2027
|
}
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2028
|
+
if (sticky) {
|
2029
|
+
setPointerPosition(self.pointerX, self.pointerY);
|
2030
|
+
if (dirty) {
|
2031
|
+
render(true);
|
2032
|
+
}
|
2012
2033
|
}
|
2013
2034
|
if (self.isPressed && !sticky && ((allowX && Math.abs(x - self.x) > 0.01) || (allowY && (Math.abs(y - self.y) > 0.01 && !rotationMode)))) {
|
2014
2035
|
recordStartPositions();
|
@@ -2033,7 +2054,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
2033
2054
|
trigger = triggers[i];
|
2034
2055
|
_addListener(trigger, "mousedown", onPress);
|
2035
2056
|
_addListener(trigger, "touchstart", onPress);
|
2036
|
-
_addListener(trigger, "click", onClick, true);
|
2057
|
+
_addListener(trigger, "click", onClick, true); //note: used to pass true for capture but it prevented click-to-play-video functionality in Firefox.
|
2037
2058
|
if (!rotationMode) {
|
2038
2059
|
_setStyle(trigger, "cursor", vars.cursor || "move");
|
2039
2060
|
}
|
@@ -2164,7 +2185,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
2164
2185
|
p.constructor = Draggable;
|
2165
2186
|
p.pointerX = p.pointerY = 0;
|
2166
2187
|
p.isDragging = p.isPressed = false;
|
2167
|
-
Draggable.version = "0.14.
|
2188
|
+
Draggable.version = "0.14.8";
|
2168
2189
|
Draggable.zIndex = 1000;
|
2169
2190
|
|
2170
2191
|
_addListener(_doc, "touchcancel", function() {
|
@@ -2274,7 +2295,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
2274
2295
|
return (_gsScope.GreenSockGlobals || _gsScope)[name];
|
2275
2296
|
};
|
2276
2297
|
if (typeof(define) === "function" && define.amd) { //AMD
|
2277
|
-
define(["
|
2298
|
+
define(["TweenLite", "CSSPlugin"], getGlobal);
|
2278
2299
|
} else if (typeof(module) !== "undefined" && module.exports) { //node
|
2279
2300
|
require("../TweenLite.js");
|
2280
2301
|
require("../plugins/CSSPlugin.js");
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greensock-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.19.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Pataki, Greensock Team
|
@@ -58,7 +58,7 @@ files:
|
|
58
58
|
- vendor/assets/javascripts/greensock/plugins/DirectionalRotationPlugin.js
|
59
59
|
- vendor/assets/javascripts/greensock/plugins/EaselPlugin.js
|
60
60
|
- vendor/assets/javascripts/greensock/plugins/EndArrayPlugin.js
|
61
|
-
- vendor/assets/javascripts/greensock/plugins/
|
61
|
+
- vendor/assets/javascripts/greensock/plugins/ModifiersPlugin.js
|
62
62
|
- vendor/assets/javascripts/greensock/plugins/RaphaelPlugin.js
|
63
63
|
- vendor/assets/javascripts/greensock/plugins/RoundPropsPlugin.js
|
64
64
|
- vendor/assets/javascripts/greensock/plugins/ScrollToPlugin.js
|
@@ -1,335 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* VERSION: 0.5.2
|
3
|
-
* DATE: 2014-07-17
|
4
|
-
* UPDATES AND DOCS AT: http://greensock.com
|
5
|
-
*
|
6
|
-
* @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
|
7
|
-
* This work is subject to the terms at http://greensock.com/standard-license 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
|
-
var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node
|
13
|
-
(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() {
|
14
|
-
|
15
|
-
"use strict";
|
16
|
-
|
17
|
-
var _specialProps = {scale:1, shadowOffset:1, fillPatternOffset:1, offset:1, fill:2, stroke:2, shadowColor:2}, //type 1 is one that has "x" and "y" components that can be split apart but in order to set them, they must be combined into a single object and passed to one setter (like setScale({x:0.5, y:0.6})). Type 2 is for colors.
|
18
|
-
_getterFuncs = {},
|
19
|
-
_setterFuncs = {},
|
20
|
-
_numExp = /(\d|\.)+/g,
|
21
|
-
_directionalRotationExp = /(?:_cw|_ccw|_short)/,
|
22
|
-
_plugins = _gsScope._gsDefine.globals.com.greensock.plugins,
|
23
|
-
_colorLookup = {aqua:[0,255,255],
|
24
|
-
lime:[0,255,0],
|
25
|
-
silver:[192,192,192],
|
26
|
-
black:[0,0,0],
|
27
|
-
maroon:[128,0,0],
|
28
|
-
teal:[0,128,128],
|
29
|
-
blue:[0,0,255],
|
30
|
-
navy:[0,0,128],
|
31
|
-
white:[255,255,255],
|
32
|
-
fuchsia:[255,0,255],
|
33
|
-
olive:[128,128,0],
|
34
|
-
yellow:[255,255,0],
|
35
|
-
orange:[255,165,0],
|
36
|
-
gray:[128,128,128],
|
37
|
-
purple:[128,0,128],
|
38
|
-
green:[0,128,0],
|
39
|
-
red:[255,0,0],
|
40
|
-
pink:[255,192,203],
|
41
|
-
cyan:[0,255,255],
|
42
|
-
transparent:[255,255,255,0]},
|
43
|
-
_hue = function(h, m1, m2) {
|
44
|
-
h = (h < 0) ? h + 1 : (h > 1) ? h - 1 : h;
|
45
|
-
return ((((h * 6 < 1) ? m1 + (m2 - m1) * h * 6 : (h < 0.5) ? m2 : (h * 3 < 2) ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * 255) + 0.5) | 0;
|
46
|
-
},
|
47
|
-
_parseColor = function(color) {
|
48
|
-
if (color === "" || color == null || color === "none") {
|
49
|
-
return _colorLookup.transparent;
|
50
|
-
}
|
51
|
-
if (_colorLookup[color]) {
|
52
|
-
return _colorLookup[color];
|
53
|
-
}
|
54
|
-
if (typeof(color) === "number") {
|
55
|
-
return [color >> 16, (color >> 8) & 255, color & 255];
|
56
|
-
}
|
57
|
-
if (color.charAt(0) === "#") {
|
58
|
-
if (color.length === 4) { //for shorthand like #9F0
|
59
|
-
color = "#" + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2) + color.charAt(3) + color.charAt(3);
|
60
|
-
}
|
61
|
-
color = parseInt(color.substr(1), 16);
|
62
|
-
return [color >> 16, (color >> 8) & 255, color & 255];
|
63
|
-
}
|
64
|
-
if (color.substr(0, 3) === "hsl") {
|
65
|
-
color = color.match(_numExp);
|
66
|
-
var h = (Number(color[0]) % 360) / 360,
|
67
|
-
s = Number(color[1]) / 100,
|
68
|
-
l = Number(color[2]) / 100,
|
69
|
-
m2 = (l <= 0.5) ? l * (s + 1) : l + s - l * s,
|
70
|
-
m1 = l * 2 - m2;
|
71
|
-
if (color.length > 3) {
|
72
|
-
color[3] = Number(color[3]);
|
73
|
-
}
|
74
|
-
color[0] = _hue(h + 1 / 3, m1, m2);
|
75
|
-
color[1] = _hue(h, m1, m2);
|
76
|
-
color[2] = _hue(h - 1 / 3, m1, m2);
|
77
|
-
return color;
|
78
|
-
}
|
79
|
-
var a = color.match(_numExp) || _colorLookup.transparent,
|
80
|
-
i = a.length;
|
81
|
-
while (--i > -1) {
|
82
|
-
a[i] = Number(a[i]);
|
83
|
-
}
|
84
|
-
return a;
|
85
|
-
},
|
86
|
-
ColorProp = function(target, getter, setter, next) {
|
87
|
-
this.getter = getter;
|
88
|
-
this.setter = setter;
|
89
|
-
var val = _parseColor( target[getter]() );
|
90
|
-
this.proxy = {r:val[0], g:val[1], b:val[2], a:(val.length > 3 ? val[3] : 1)};
|
91
|
-
if (next) {
|
92
|
-
this._next = next;
|
93
|
-
next._prev = this;
|
94
|
-
}
|
95
|
-
},
|
96
|
-
_layersToDraw = [],
|
97
|
-
_ticker, _listening,
|
98
|
-
_onTick = function() {
|
99
|
-
var i = _layersToDraw.length;
|
100
|
-
if (i !== 0) {
|
101
|
-
while (--i > -1) {
|
102
|
-
_layersToDraw[i].draw();
|
103
|
-
_layersToDraw[i]._gsDraw = false;
|
104
|
-
}
|
105
|
-
_layersToDraw.length = 0;
|
106
|
-
} else {
|
107
|
-
_ticker.removeEventListener("tick", _onTick);
|
108
|
-
_listening = false;
|
109
|
-
}
|
110
|
-
},
|
111
|
-
_prepDimensionProp = function(p, dimension) {
|
112
|
-
var alt = (dimension === "x") ? "y" : "x",
|
113
|
-
proxyName = "_gs_" + p;
|
114
|
-
_getterFuncs[p] = function() {
|
115
|
-
return this["get" + p]()[dimension];
|
116
|
-
};
|
117
|
-
_setterFuncs[p] = function(value) {
|
118
|
-
var cur = this["get" + p](),
|
119
|
-
proxy = this[proxyName];
|
120
|
-
if (!proxy) {
|
121
|
-
proxy = this[proxyName] = {};
|
122
|
-
}
|
123
|
-
proxy[dimension] = value;
|
124
|
-
proxy[alt] = cur[alt];
|
125
|
-
this[p](proxy);
|
126
|
-
return this;
|
127
|
-
};
|
128
|
-
},
|
129
|
-
_createGetterSetter = function(getter, setter) {
|
130
|
-
return function(value) {return (arguments.length) ? setter(value) : getter(); };
|
131
|
-
},
|
132
|
-
//looks at every property in the vars and converts them (when appropriate) to the KineticJS equivalent. If it finds a special property for which "x" and "y" must be split apart (like scale, offset, shadowOffset, etc.), it will do that as well. This method returns an array of any names it had to change (like "x", "y", "scale", etc.) so that they can be used in the overwriteProps array.
|
133
|
-
_convertProps = function(target, vars) {
|
134
|
-
var converted = [],
|
135
|
-
p, val, i, proto;
|
136
|
-
for (p in vars) {
|
137
|
-
val = vars[p];
|
138
|
-
if (p !== "bezier" && p !== "autoDraw" && p.substr(0,3) !== "set" && target[p] === undefined) {
|
139
|
-
converted.push(p);
|
140
|
-
delete vars[p];
|
141
|
-
p = "set" + p.charAt(0).toUpperCase() + p.substr(1);
|
142
|
-
vars[p] = val;
|
143
|
-
}
|
144
|
-
if (_specialProps[p]) {
|
145
|
-
if (_specialProps[p] === 1) {
|
146
|
-
vars[p + "X"] = vars[p + "Y"] = vars[p];
|
147
|
-
delete vars[p];
|
148
|
-
return _convertProps(target, vars);
|
149
|
-
} else if (!target[p] && _setterFuncs[p]) {
|
150
|
-
proto = target.prototype || target;
|
151
|
-
proto[p] = _createGetterSetter(_getterFuncs[p], _setterFuncs[p]);
|
152
|
-
}
|
153
|
-
} else if (p === "bezier") {
|
154
|
-
val = (val instanceof Array) ? val : val.values || [];
|
155
|
-
i = val.length;
|
156
|
-
while (--i > -1) {
|
157
|
-
if (i === 0) {
|
158
|
-
converted = converted.concat( _convertProps(target, val[i]) );
|
159
|
-
} else {
|
160
|
-
_convertProps(target, val[i]);
|
161
|
-
}
|
162
|
-
}
|
163
|
-
}
|
164
|
-
}
|
165
|
-
return converted;
|
166
|
-
},
|
167
|
-
_copy = function(obj) {
|
168
|
-
var result = {},
|
169
|
-
p;
|
170
|
-
for (p in obj) {
|
171
|
-
result[p] = obj[p];
|
172
|
-
}
|
173
|
-
return result;
|
174
|
-
},
|
175
|
-
versionValid, p;
|
176
|
-
|
177
|
-
for (p in _specialProps) {
|
178
|
-
if (_specialProps[p] === 1) {
|
179
|
-
_prepDimensionProp(p, "x");
|
180
|
-
_prepDimensionProp(p, "y");
|
181
|
-
}
|
182
|
-
}
|
183
|
-
|
184
|
-
var KineticPlugin = _gsScope._gsDefine.plugin({
|
185
|
-
propName: "kinetic",
|
186
|
-
API: 2,
|
187
|
-
version: "0.5.2",
|
188
|
-
|
189
|
-
//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
|
190
|
-
init: function(target, value, tween) {
|
191
|
-
var p, val, gp, sp, bezierPlugin, directionalRotationPlugin;
|
192
|
-
if (!versionValid && (versionValid = (parseInt(Kinetic.version.split(".")[0], 10)) < 5)) {
|
193
|
-
throw ("The GSAP KineticPlugin that's loaded requires KineticJS version 5.0.0 or later. For earlier versions, use KineticPlugin from GSAP 1.11.3 or earlier.");
|
194
|
-
}
|
195
|
-
this._overwriteProps = _convertProps(target, value); //allow users to pass in shorter names like "x" instead of "setX" and "rotationDeg" instead of "setRotationDeg"
|
196
|
-
this._target = target;
|
197
|
-
this._layer = (value.autoDraw !== false) ? target.getLayer() : null;
|
198
|
-
if (!_ticker && this._layer) {
|
199
|
-
_ticker = tween.constructor.ticker;
|
200
|
-
}
|
201
|
-
for (p in value) {
|
202
|
-
val = value[p];
|
203
|
-
//we must handle colors in a special way, splitting apart the red, green, blue, and alpha.
|
204
|
-
if (_specialProps[p] === 2) {
|
205
|
-
sp = this._firstSP = new ColorProp(target, p, p, this._firstSP);
|
206
|
-
val = _parseColor(val);
|
207
|
-
if (sp.proxy.r !== val[0]) {
|
208
|
-
this._addTween(sp.proxy, "r", sp.proxy.r, val[0], p);
|
209
|
-
}
|
210
|
-
if (sp.proxy.g !== val[1]) {
|
211
|
-
this._addTween(sp.proxy, "g", sp.proxy.g, val[1], p);
|
212
|
-
}
|
213
|
-
if (sp.proxy.b !== val[2]) {
|
214
|
-
this._addTween(sp.proxy, "b", sp.proxy.b, val[2], p);
|
215
|
-
}
|
216
|
-
if ((val.length > 3 || sp.proxy.a !== 1) && sp.proxy.a !== val[3]) {
|
217
|
-
this._addTween(sp.proxy, "a", sp.proxy.a, (val.length > 3 ? val[3] : 1), p);
|
218
|
-
}
|
219
|
-
} else if (p === "bezier") {
|
220
|
-
bezierPlugin = _plugins.BezierPlugin;
|
221
|
-
if (!bezierPlugin) {
|
222
|
-
throw("BezierPlugin not loaded");
|
223
|
-
}
|
224
|
-
bezierPlugin = this._bezier = new bezierPlugin();
|
225
|
-
if (typeof(val) === "object" && val.autoRotate === true) {
|
226
|
-
val.autoRotate = ["x","y","rotation",0,false];
|
227
|
-
}
|
228
|
-
bezierPlugin._onInitTween(target, val, tween);
|
229
|
-
this._overwriteProps = this._overwriteProps.concat(bezierPlugin._overwriteProps);
|
230
|
-
this._addTween(bezierPlugin, "setRatio", 0, 1, p);
|
231
|
-
|
232
|
-
} else if ((p === "rotation" || p === "rotationDeg") && typeof(val) === "string" && _directionalRotationExp.test(val)) {
|
233
|
-
directionalRotationPlugin = _plugins.DirectionalRotationPlugin;
|
234
|
-
if (!directionalRotationPlugin) {
|
235
|
-
throw("DirectionalRotationPlugin not loaded");
|
236
|
-
}
|
237
|
-
directionalRotationPlugin = this._directionalRotation = new directionalRotationPlugin();
|
238
|
-
gp = {useRadians:false};
|
239
|
-
gp[p] = val;
|
240
|
-
directionalRotationPlugin._onInitTween(target, gp, tween);
|
241
|
-
this._addTween(directionalRotationPlugin, "setRatio", 0, 1, p);
|
242
|
-
|
243
|
-
} else if (val instanceof Array) { //for array-based values like "points"
|
244
|
-
this._initArrayTween(target[p](), val, p);
|
245
|
-
|
246
|
-
} else if (p !== "autoDraw") {
|
247
|
-
gp = "get" + p.substr(3);
|
248
|
-
this._addTween(target, p, ((typeof(target[p]) === "function") ? target[( (gp !== "get" && typeof(target[gp]) === "function") ? gp : p)]() : target[p]) || 0, val, p);
|
249
|
-
}
|
250
|
-
this._overwriteProps.push(p);
|
251
|
-
}
|
252
|
-
return true;
|
253
|
-
},
|
254
|
-
|
255
|
-
kill: function(lookup) {
|
256
|
-
lookup = _copy(lookup);
|
257
|
-
_convertProps(this._target, lookup);
|
258
|
-
if (this._bezier) {
|
259
|
-
this._bezier._kill(lookup);
|
260
|
-
}
|
261
|
-
if (this._directionalRotation) {
|
262
|
-
this._directionalRotation._kill(lookup);
|
263
|
-
}
|
264
|
-
return this._super._kill.call(this, lookup);
|
265
|
-
},
|
266
|
-
|
267
|
-
round:function(lookup, value) {
|
268
|
-
lookup = _copy(lookup);
|
269
|
-
_convertProps(this._target, lookup);
|
270
|
-
if (this._bezier) {
|
271
|
-
this._bezier._roundProps(lookup, value);
|
272
|
-
}
|
273
|
-
return this._super._roundProps.call(this, lookup, value);
|
274
|
-
},
|
275
|
-
|
276
|
-
//called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
|
277
|
-
set: function(ratio) {
|
278
|
-
this._super.setRatio.call(this, ratio);
|
279
|
-
var sp = this._firstSP,
|
280
|
-
layer = this._layer,
|
281
|
-
arrayTweens = this._arrayTweens,
|
282
|
-
i, e, p, val, t, proxy;
|
283
|
-
if (sp) {
|
284
|
-
t = this._target;
|
285
|
-
while (sp) {
|
286
|
-
proxy = sp.proxy;
|
287
|
-
t[sp.setter]( (proxy.a !== 1 ? "rgba(" : "rgb(") + (proxy.r | 0) + ", " + (proxy.g | 0) + ", " + (proxy.b | 0) + (proxy.a !== 1 ? ", " + proxy.a : "") + ")");
|
288
|
-
sp = sp._next;
|
289
|
-
}
|
290
|
-
}
|
291
|
-
if (arrayTweens) {
|
292
|
-
i = arrayTweens.length;
|
293
|
-
while (--i > -1) {
|
294
|
-
e = arrayTweens[i];
|
295
|
-
val = e.s + e.c * ratio;
|
296
|
-
e.a[e.i] = (val < 0.000001 && val > -0.000001) ? 0 : val;
|
297
|
-
}
|
298
|
-
for (p in this._arrayProps) {
|
299
|
-
this._target[p](this._arrayProps[p]);
|
300
|
-
}
|
301
|
-
}
|
302
|
-
if (layer && !layer._gsDraw) {
|
303
|
-
_layersToDraw.push(layer);
|
304
|
-
layer._gsDraw = true; //a flag indicating that we need to draw() this layer as soon as all the tweens have finished updating (using a "tick" event listener)
|
305
|
-
if (!_listening) {
|
306
|
-
_ticker.addEventListener("tick", _onTick);
|
307
|
-
_listening = true;
|
308
|
-
}
|
309
|
-
}
|
310
|
-
}
|
311
|
-
|
312
|
-
});
|
313
|
-
|
314
|
-
p = KineticPlugin.prototype;
|
315
|
-
p._initArrayTween = function(a, b, prop) {
|
316
|
-
if (!this._arrayTweens) {
|
317
|
-
this._arrayTweens = []; //stores data about any elements that must tween (ones that match in a and b are ignored (no need to waste resources). For example, {a:array, i:0, s:100, c:50}
|
318
|
-
this._arrayProps = {}; //stores data about which properties are associted with which arrays so that we can apply them in the setRatio() method, like target[property](array), as in target.points([1,2,500,600]);
|
319
|
-
}
|
320
|
-
var i = a.length,
|
321
|
-
tweens = this._arrayTweens,
|
322
|
-
start, end;
|
323
|
-
while (--i > -1) {
|
324
|
-
start = a[i];
|
325
|
-
end = b[i];
|
326
|
-
if (start !== end) {
|
327
|
-
tweens.push({a:a, i:i, s:start, c:end - start});
|
328
|
-
}
|
329
|
-
}
|
330
|
-
if (tweens.length) {
|
331
|
-
this._arrayProps[prop] = a;
|
332
|
-
}
|
333
|
-
};
|
334
|
-
|
335
|
-
}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
|