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:
|
3
|
-
* DATE:
|
2
|
+
* VERSION: 0.3.0
|
3
|
+
* DATE: 2016-07-12
|
4
4
|
* UPDATES AND DOCS AT: http://greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
|
@@ -16,11 +16,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
16
16
|
|
17
17
|
_gsScope._gsDefine.plugin({
|
18
18
|
propName: "directionalRotation",
|
19
|
-
version: "0.
|
19
|
+
version: "0.3.0",
|
20
20
|
API: 2,
|
21
21
|
|
22
22
|
//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
|
23
|
-
init: function(target, value, tween) {
|
23
|
+
init: function(target, value, tween, index) {
|
24
24
|
if (typeof(value) !== "object") {
|
25
25
|
value = {rotation:value};
|
26
26
|
}
|
@@ -30,7 +30,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
30
30
|
p, v, start, end, dif, split;
|
31
31
|
for (p in value) {
|
32
32
|
if (p !== "useRadians") {
|
33
|
-
|
33
|
+
end = value[p];
|
34
|
+
if (typeof(end) === "function") {
|
35
|
+
end = end(index, target);
|
36
|
+
}
|
37
|
+
split = (end + "").split("_");
|
34
38
|
v = split[0];
|
35
39
|
start = parseFloat( (typeof(target[p]) !== "function") ? target[p] : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]() );
|
36
40
|
end = this.finals[p] = (typeof(v) === "string" && v.charAt(1) === "=") ? start + parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) : Number(v) || 0;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 0.
|
3
|
-
* DATE:
|
2
|
+
* VERSION: 0.2.0
|
3
|
+
* DATE: 2016-07-12
|
4
4
|
* UPDATES AND DOCS AT: http://greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
|
@@ -229,15 +229,19 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
229
229
|
_gsScope._gsDefine.plugin({
|
230
230
|
propName: "easel",
|
231
231
|
priority: -1,
|
232
|
-
version: "0.
|
232
|
+
version: "0.2.0",
|
233
233
|
API: 2,
|
234
234
|
|
235
235
|
//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
|
236
|
-
init: function(target, value, tween) {
|
236
|
+
init: function(target, value, tween, index) {
|
237
237
|
this._target = target;
|
238
|
-
var p, pt, tint, colorMatrix;
|
238
|
+
var p, pt, tint, colorMatrix, end;
|
239
239
|
for (p in value) {
|
240
240
|
|
241
|
+
end = value[p];
|
242
|
+
if (typeof(end) === "function") {
|
243
|
+
end = end(index, target);
|
244
|
+
}
|
241
245
|
if (p === "colorFilter" || p === "tint" || p === "tintAmount" || p === "exposure" || p === "brightness") {
|
242
246
|
if (!tint) {
|
243
247
|
_parseColorFilter(target, value.colorFilter || value, this);
|
@@ -251,8 +255,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
251
255
|
}
|
252
256
|
|
253
257
|
} else if (p === "frame") {
|
254
|
-
this._firstPT = pt = {_next:this._firstPT, t:target, p:"gotoAndStop", s:target.currentFrame, f:true, n:"frame", pr:0, type:0,
|
255
|
-
pt.c = (typeof(
|
258
|
+
this._firstPT = pt = {_next:this._firstPT, t:target, p:"gotoAndStop", s:target.currentFrame, f:true, n:"frame", pr:0, type:0, m:Math.round};
|
259
|
+
pt.c = (typeof(end) === "number") ? end - pt.s : (typeof(end) === "string") ? parseFloat(end.split("=").join("")) : 0;
|
256
260
|
if (pt._next) {
|
257
261
|
pt._next._prev = pt;
|
258
262
|
}
|
@@ -260,7 +264,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
260
264
|
} else if (target[p] != null) {
|
261
265
|
this._firstPT = pt = {_next:this._firstPT, t:target, p:p, f:(typeof(target[p]) === "function"), n:p, pr:0, type:0};
|
262
266
|
pt.s = (!pt.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]();
|
263
|
-
pt.c = (typeof(
|
267
|
+
pt.c = (typeof(end) === "number") ? end - pt.s : (typeof(end) === "string") ? parseFloat(end.split("=").join("")) : 0;
|
264
268
|
|
265
269
|
if (pt._next) {
|
266
270
|
pt._next._prev = pt;
|
@@ -278,8 +282,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
278
282
|
val;
|
279
283
|
while (pt) {
|
280
284
|
val = pt.c * v + pt.s;
|
281
|
-
if (pt.
|
282
|
-
val =
|
285
|
+
if (pt.m) {
|
286
|
+
val = pt.m(val, pt.t);
|
283
287
|
} else if (val < min && val > -min) {
|
284
288
|
val = 0;
|
285
289
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 0.1.
|
3
|
-
* DATE:
|
2
|
+
* VERSION: 0.1.3
|
3
|
+
* DATE: 2016-07-12
|
4
4
|
* UPDATES AND DOCS AT: http://greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
|
@@ -17,7 +17,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
17
17
|
_gsScope._gsDefine.plugin({
|
18
18
|
propName: "endArray",
|
19
19
|
API: 2,
|
20
|
-
version: "0.1.
|
20
|
+
version: "0.1.3",
|
21
21
|
|
22
22
|
//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
|
23
23
|
init: function(target, value, tween) {
|
@@ -25,7 +25,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
25
25
|
a = this.a = [],
|
26
26
|
start, end;
|
27
27
|
this.target = target;
|
28
|
-
this.
|
28
|
+
this._mod = 0;
|
29
29
|
if (!i) {
|
30
30
|
return false;
|
31
31
|
}
|
@@ -39,9 +39,9 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
39
39
|
return true;
|
40
40
|
},
|
41
41
|
|
42
|
-
|
43
|
-
if (
|
44
|
-
this.
|
42
|
+
mod: function(lookup) {
|
43
|
+
if (typeof(lookup.endArray) === "function") {
|
44
|
+
this._mod = lookup.endArray;
|
45
45
|
}
|
46
46
|
},
|
47
47
|
|
@@ -50,11 +50,12 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
50
50
|
var target = this.target,
|
51
51
|
a = this.a,
|
52
52
|
i = a.length,
|
53
|
+
mod = this._mod,
|
53
54
|
e, val;
|
54
|
-
if (
|
55
|
+
if (mod) {
|
55
56
|
while (--i > -1) {
|
56
57
|
e = a[i];
|
57
|
-
target[e.i] =
|
58
|
+
target[e.i] = mod(e.s + e.c * ratio, target);
|
58
59
|
}
|
59
60
|
} else {
|
60
61
|
while (--i > -1) {
|
@@ -0,0 +1,158 @@
|
|
1
|
+
/*!
|
2
|
+
* VERSION: 0.0.2
|
3
|
+
* DATE: 2016-07-14
|
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 _cssRatioSetter = function(pt, cssp, mod) { //Takes an individual CSSPropTween and converts it into a type:2 that has a setRatio that does everything the regular CSSPlugin.setRatio() method does but applying the mod() too. We do this to keep the main CSSPlugin.setRatio() as fast as possible (the vast majority of times, no mod() will be necessary)
|
18
|
+
var type = pt.type,
|
19
|
+
oldSetRatio = pt.setRatio,
|
20
|
+
tween = cssp._tween,
|
21
|
+
target = cssp._target;
|
22
|
+
pt.type = 2;
|
23
|
+
pt.m = mod;
|
24
|
+
pt.setRatio = function(v) {
|
25
|
+
var min = 0.000001,
|
26
|
+
val, str, i;
|
27
|
+
if (v === 1 && (tween._time === tween._duration || tween._time === 0)) {
|
28
|
+
|
29
|
+
if (type !== 2) {
|
30
|
+
if (pt.r && type !== -1) {
|
31
|
+
val = Math.round(pt.s + pt.c);
|
32
|
+
if (!type) {
|
33
|
+
pt.t[pt.p] = mod(val + pt.xs0, target);
|
34
|
+
} else if (type === 1) {
|
35
|
+
str = pt.xs0 + val + pt.xs1;
|
36
|
+
for (i = 1; i < pt.l; i++) {
|
37
|
+
str += pt["xn"+i] + pt["xs"+(i+1)];
|
38
|
+
}
|
39
|
+
pt.t[pt.p] = mod(str, target);
|
40
|
+
}
|
41
|
+
} else {
|
42
|
+
pt.t[pt.p] = mod(pt.e, target);
|
43
|
+
}
|
44
|
+
} else {
|
45
|
+
oldSetRatio.call(pt, v);
|
46
|
+
}
|
47
|
+
|
48
|
+
} else if (v || !(tween._time === tween._duration || tween._time === 0) || tween._rawPrevTime === -0.000001) {
|
49
|
+
val = pt.c * v + pt.s;
|
50
|
+
if (pt.r) {
|
51
|
+
val = Math.round(val);
|
52
|
+
} else if (val < min) if (val > -min) {
|
53
|
+
val = 0;
|
54
|
+
}
|
55
|
+
if (!type) {
|
56
|
+
pt.t[pt.p] = mod(val + pt.xs0, target);
|
57
|
+
} else if (type === 1) {
|
58
|
+
str = pt.xs0 + val + pt.xs1;
|
59
|
+
for (i = 1; i < pt.l; i++) {
|
60
|
+
str += pt["xn"+i] + pt["xs"+(i+1)];
|
61
|
+
}
|
62
|
+
pt.t[pt.p] = mod(str, target);
|
63
|
+
|
64
|
+
} else if (type === -1) { //non-tweening value
|
65
|
+
pt.t[pt.p] = mod(pt.xs0, target);
|
66
|
+
|
67
|
+
} else if (oldSetRatio) {
|
68
|
+
oldSetRatio.call(pt, v);
|
69
|
+
}
|
70
|
+
|
71
|
+
} else {
|
72
|
+
if (type !== 2) {
|
73
|
+
pt.t[pt.p] = mod(pt.b, target);
|
74
|
+
} else {
|
75
|
+
oldSetRatio.call(pt, v);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
};
|
79
|
+
},
|
80
|
+
_modCSS = function(lookup, cssp) {
|
81
|
+
var pt = cssp._firstPT,
|
82
|
+
hasBezier = (lookup.rotation && cssp._overwriteProps.join("").indexOf("bezier") !== -1); //when a Bezier tween is applying autoRotation, it's a very special case we need to handle differently.
|
83
|
+
while (pt) {
|
84
|
+
if (typeof(lookup[pt.p]) === "function") {
|
85
|
+
_cssRatioSetter(pt, cssp, lookup[pt.p]);
|
86
|
+
} else if (hasBezier && pt.n === "bezier" && pt.plugin._overwriteProps.join("").indexOf("rotation") !== -1) {
|
87
|
+
pt.data.mod = lookup.rotation;
|
88
|
+
}
|
89
|
+
pt = pt._next;
|
90
|
+
}
|
91
|
+
},
|
92
|
+
|
93
|
+
ModifiersPlugin = _gsScope._gsDefine.plugin({
|
94
|
+
propName: "modifiers",
|
95
|
+
version: "0.0.2",
|
96
|
+
API: 2,
|
97
|
+
|
98
|
+
//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
|
99
|
+
init: function(target, value, tween) {
|
100
|
+
this._tween = tween;
|
101
|
+
this._vars = value;
|
102
|
+
return true;
|
103
|
+
},
|
104
|
+
|
105
|
+
initAll: function() {
|
106
|
+
var tween = this._tween,
|
107
|
+
lookup = this._vars,
|
108
|
+
mpt = this,
|
109
|
+
pt = tween._firstPT,
|
110
|
+
val, next;
|
111
|
+
while (pt) {
|
112
|
+
next = pt._next; //record here, because it may get removed
|
113
|
+
val = lookup[pt.n];
|
114
|
+
if (pt.pg) {
|
115
|
+
if (pt.t._propName === "css") { //handle CSSPlugin uniquely (for performance, due to the fact that the values almost always are a concatenation of numbers and strings, like suffixes, and we don't want to slow down the regular CSSPlugin setRatio() performance with conditional checks for if the value needs to be modded, so we pull any modding prop out and change it to a type:2 one that simply calls a setRatio() method where we encapsulate the modding and update all together. That way, it says in the main CSSProp linked list and just has some custom logic applied to it inside its setRatio())
|
116
|
+
_modCSS(lookup, pt.t);
|
117
|
+
} else if (pt.t !== mpt) { //don't run modProps on modProps :)
|
118
|
+
val = lookup[pt.t._propName];
|
119
|
+
pt.t._mod((typeof(val) === "object") ? val : lookup);
|
120
|
+
}
|
121
|
+
} else if (typeof(val) === "function") {
|
122
|
+
if (pt.f === 2 && pt.t) { //a blob (text containing multiple numeric values)
|
123
|
+
pt.t._applyPT.m = val;
|
124
|
+
} else {
|
125
|
+
this._add(pt.t, pt.p, pt.s, pt.c, val);
|
126
|
+
//remove from linked list
|
127
|
+
if (next) {
|
128
|
+
next._prev = pt._prev;
|
129
|
+
}
|
130
|
+
if (pt._prev) {
|
131
|
+
pt._prev._next = next;
|
132
|
+
} else if (tween._firstPT === pt) {
|
133
|
+
tween._firstPT = next;
|
134
|
+
}
|
135
|
+
pt._next = pt._prev = null;
|
136
|
+
tween._propLookup[pt.n] = mpt;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
pt = next;
|
140
|
+
}
|
141
|
+
return false;
|
142
|
+
}
|
143
|
+
|
144
|
+
}),
|
145
|
+
p = ModifiersPlugin.prototype;
|
146
|
+
|
147
|
+
p._add = function(target, p, s, c, mod) {
|
148
|
+
this._addTween(target, p, s, s + c, p, mod);
|
149
|
+
this._overwriteProps.push(p);
|
150
|
+
};
|
151
|
+
|
152
|
+
p = _gsScope._gsDefine.globals.TweenLite.version.split(".");
|
153
|
+
if (Number(p[0]) <= 1 && Number(p[1]) < 19 && window.console) {
|
154
|
+
console.log("ModifiersPlugin requires GSAP 1.19.0 or later.");
|
155
|
+
}
|
156
|
+
|
157
|
+
|
158
|
+
}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 1.
|
3
|
-
* DATE: 2015-
|
2
|
+
* VERSION: 1.6.0
|
3
|
+
* DATE: 2015-07-16
|
4
4
|
* UPDATES AND DOCS AT: http://greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
|
@@ -16,7 +16,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
16
16
|
|
17
17
|
var RoundPropsPlugin = _gsScope._gsDefine.plugin({
|
18
18
|
propName: "roundProps",
|
19
|
-
version: "1.
|
19
|
+
version: "1.6.0",
|
20
20
|
priority: -1,
|
21
21
|
API: 2,
|
22
22
|
|
@@ -30,7 +30,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
30
30
|
_roundLinkedList = function(node) {
|
31
31
|
while (node) {
|
32
32
|
if (!node.f && !node.blob) {
|
33
|
-
node.
|
33
|
+
node.m = Math.round;
|
34
34
|
}
|
35
35
|
node = node._next;
|
36
36
|
}
|
@@ -45,7 +45,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
45
45
|
rpt = tween._propLookup.roundProps,
|
46
46
|
prop, pt, next;
|
47
47
|
while (--i > -1) {
|
48
|
-
lookup[rp[i]] =
|
48
|
+
lookup[rp[i]] = Math.round;
|
49
49
|
}
|
50
50
|
i = rp.length;
|
51
51
|
while (--i > -1) {
|
@@ -54,7 +54,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
54
54
|
while (pt) {
|
55
55
|
next = pt._next; //record here, because it may get removed
|
56
56
|
if (pt.pg) {
|
57
|
-
pt.t.
|
57
|
+
pt.t._mod(lookup);
|
58
58
|
} else if (pt.n === prop) {
|
59
59
|
if (pt.f === 2 && pt.t) { //a blob (text containing multiple numeric values)
|
60
60
|
_roundLinkedList(pt.t._firstPT);
|
@@ -80,7 +80,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
80
80
|
};
|
81
81
|
|
82
82
|
p._add = function(target, p, s, c) {
|
83
|
-
this._addTween(target, p, s, s + c, p,
|
83
|
+
this._addTween(target, p, s, s + c, p, Math.round);
|
84
84
|
this._overwriteProps.push(p);
|
85
85
|
};
|
86
86
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 1.
|
3
|
-
* DATE:
|
2
|
+
* VERSION: 1.8.0
|
3
|
+
* DATE: 2016-07-09
|
4
4
|
* UPDATES AND DOCS AT: http://greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
|
@@ -23,11 +23,55 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
23
23
|
body = document.body;
|
24
24
|
return (element === _window || element === _doc || element === body) ? Math.max(_doc[scroll], body[scroll]) - (_window["inner" + dim] || _doc[client] || body[client]) : element[scroll] - element["offset" + dim];
|
25
25
|
},
|
26
|
+
_unwrapElement = function(value) {
|
27
|
+
if (typeof(value) === "string") {
|
28
|
+
value = TweenLite.selector(value);
|
29
|
+
}
|
30
|
+
if (value.length && value !== _window && value[0] && value[0].style && !value.nodeType) {
|
31
|
+
value = value[0];
|
32
|
+
}
|
33
|
+
return (value === _window || (value.nodeType && value.style)) ? value : null;
|
34
|
+
},
|
35
|
+
_buildGetter = function(e, axis) { //pass in an element and an axis ("x" or "y") and it'll return a getter function for the scroll position of that element (like scrollTop or scrollLeft, although if the element is the window, it'll use the pageXOffset/pageYOffset or the documentElement's scrollTop/scrollLeft or document.body's. Basically this streamlines things and makes a very fast getter across browsers.
|
36
|
+
var p = "scroll" + ((axis === "x") ? "Left" : "Top");
|
37
|
+
if (e === _window) {
|
38
|
+
if (e.pageXOffset != null) {
|
39
|
+
p = "page" + axis.toUpperCase() + "Offset";
|
40
|
+
} else if (_doc[p] != null) {
|
41
|
+
e = _doc;
|
42
|
+
} else {
|
43
|
+
e = document.body;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
return function() {
|
47
|
+
return e[p];
|
48
|
+
};
|
49
|
+
},
|
50
|
+
_getOffset = function(element, container) {
|
51
|
+
var rect = _unwrapElement(element).getBoundingClientRect(),
|
52
|
+
isRoot = (!container || container === _window || container === document.body),
|
53
|
+
cRect = (isRoot ? _doc : container).getBoundingClientRect(),
|
54
|
+
offsets = {x: rect.left - cRect.left, y: rect.top - cRect.top};
|
55
|
+
if (!isRoot && container) { //only add the current scroll position if it's not the window/body.
|
56
|
+
offsets.x += _buildGetter(container, "x")();
|
57
|
+
offsets.y += _buildGetter(container, "y")();
|
58
|
+
}
|
59
|
+
return offsets;
|
60
|
+
},
|
61
|
+
_parseVal = function(value, target, axis) {
|
62
|
+
var type = typeof(value);
|
63
|
+
if (type === "number" || (type === "string" && value.charAt(1) === "=")) {
|
64
|
+
return value;
|
65
|
+
} else if (value === "max") {
|
66
|
+
return _max(target, axis);
|
67
|
+
}
|
68
|
+
return Math.min(_max(target, axis), _getOffset(value, target)[axis]);
|
69
|
+
},
|
26
70
|
|
27
71
|
ScrollToPlugin = _gsScope._gsDefine.plugin({
|
28
72
|
propName: "scrollTo",
|
29
73
|
API: 2,
|
30
|
-
version:"1.
|
74
|
+
version:"1.8.0",
|
31
75
|
|
32
76
|
//called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
|
33
77
|
init: function(target, value, tween) {
|
@@ -36,19 +80,26 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
36
80
|
this._tween = tween;
|
37
81
|
if (typeof(value) !== "object") {
|
38
82
|
value = {y:value}; //if we don't receive an object as the parameter, assume the user intends "y".
|
83
|
+
if (typeof(value.y) === "string" && value.y !== "max" && value.y.charAt(1) !== "=") {
|
84
|
+
value.x = value.y;
|
85
|
+
}
|
86
|
+
} else if (value.nodeType) {
|
87
|
+
value = {y:value, x:value};
|
39
88
|
}
|
40
89
|
this.vars = value;
|
41
90
|
this._autoKill = (value.autoKill !== false);
|
91
|
+
this.getX = _buildGetter(target, "x");
|
92
|
+
this.getY = _buildGetter(target, "y");
|
42
93
|
this.x = this.xPrev = this.getX();
|
43
94
|
this.y = this.yPrev = this.getY();
|
44
95
|
if (value.x != null) {
|
45
|
-
this._addTween(this, "x", this.x, (value.x
|
96
|
+
this._addTween(this, "x", this.x, _parseVal(value.x, target, "x") - (value.offsetX || 0), "scrollTo_x", true);
|
46
97
|
this._overwriteProps.push("scrollTo_x");
|
47
98
|
} else {
|
48
99
|
this.skipX = true;
|
49
100
|
}
|
50
101
|
if (value.y != null) {
|
51
|
-
this._addTween(this, "y", this.y, (value.y
|
102
|
+
this._addTween(this, "y", this.y, _parseVal(value.y, target, "y") - (value.offsetY || 0), "scrollTo_y", true);
|
52
103
|
this._overwriteProps.push("scrollTo_y");
|
53
104
|
} else {
|
54
105
|
this.skipY = true;
|
@@ -63,7 +114,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
63
114
|
var x = (this._wdw || !this.skipX) ? this.getX() : this.xPrev,
|
64
115
|
y = (this._wdw || !this.skipY) ? this.getY() : this.yPrev,
|
65
116
|
yDif = y - this.yPrev,
|
66
|
-
xDif = x - this.xPrev
|
117
|
+
xDif = x - this.xPrev,
|
118
|
+
threshold = ScrollToPlugin.autoKillThreshold;
|
67
119
|
|
68
120
|
if (this.x < 0) { //can't scroll to a position less than 0! Might happen if someone uses a Back.easeOut or Elastic.easeOut when scrolling back to the top of the page (for example)
|
69
121
|
this.x = 0;
|
@@ -73,10 +125,10 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
73
125
|
}
|
74
126
|
if (this._autoKill) {
|
75
127
|
//note: iOS has a bug that throws off the scroll by several pixels, so we need to check if it's within 7 pixels of the previous one that we set instead of just looking for an exact match.
|
76
|
-
if (!this.skipX && (xDif >
|
128
|
+
if (!this.skipX && (xDif > threshold || xDif < -threshold) && x < _max(this._target, "x")) {
|
77
129
|
this.skipX = true; //if the user scrolls separately, we should stop tweening!
|
78
130
|
}
|
79
|
-
if (!this.skipY && (yDif >
|
131
|
+
if (!this.skipY && (yDif > threshold || yDif < -threshold) && y < _max(this._target, "y")) {
|
80
132
|
this.skipY = true; //if the user scrolls separately, we should stop tweening!
|
81
133
|
}
|
82
134
|
if (this.skipX && this.skipY) {
|
@@ -104,14 +156,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
104
156
|
p = ScrollToPlugin.prototype;
|
105
157
|
|
106
158
|
ScrollToPlugin.max = _max;
|
107
|
-
|
108
|
-
|
109
|
-
return (!this._wdw) ? this._target.scrollLeft : (_window.pageXOffset != null) ? _window.pageXOffset : (_doc.scrollLeft != null) ? _doc.scrollLeft : document.body.scrollLeft;
|
110
|
-
};
|
111
|
-
|
112
|
-
p.getY = function() {
|
113
|
-
return (!this._wdw) ? this._target.scrollTop : (_window.pageYOffset != null) ? _window.pageYOffset : (_doc.scrollTop != null) ? _doc.scrollTop : document.body.scrollTop;
|
114
|
-
};
|
159
|
+
ScrollToPlugin.getOffset = _getOffset;
|
160
|
+
ScrollToPlugin.autoKillThreshold = 7;
|
115
161
|
|
116
162
|
p._kill = function(lookup) {
|
117
163
|
if (lookup.scrollTo_x) {
|
@@ -123,4 +169,18 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
123
169
|
return this._super._kill.call(this, lookup);
|
124
170
|
};
|
125
171
|
|
126
|
-
}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
|
172
|
+
}); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
|
173
|
+
|
174
|
+
//export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date)
|
175
|
+
(function(name) {
|
176
|
+
"use strict";
|
177
|
+
var getGlobal = function() {
|
178
|
+
return (_gsScope.GreenSockGlobals || _gsScope)[name];
|
179
|
+
};
|
180
|
+
if (typeof(define) === "function" && define.amd) { //AMD
|
181
|
+
define(["TweenLite"], getGlobal);
|
182
|
+
} else if (typeof(module) !== "undefined" && module.exports) { //node
|
183
|
+
require("../TweenLite.js");
|
184
|
+
module.exports = getGlobal();
|
185
|
+
}
|
186
|
+
}("ScrollToPlugin"));
|