Skip to content

Commit

Permalink
2.1.1
Browse files Browse the repository at this point in the history
- NEW: you can optionally define an "each" value for advanced staggers (which refers to the gap between each start times) instead of an "amount" (which refers to the TOTAL amount of time that gets split up between all start times). For example, if there are 10 elements and you define {each:1} that would put 1 second between each start time, but if you define {amount:1} that would put 0.1 between each (1 divided by 10), assuming linear ease.

- NEW: you can invert the effect of an advanced stagger by using a negative number for amount (or each). So {from:"center", amount:-1.5} would actually cause it to animate from the outer edges inward toward the center!

- FIXED: if there was no stagger value passed into a TimelineLite/Max staggerTo()/staggerFrom()/staggerFromTo() call, it could throw an error.

- FIXED: a TweenMax or TimelineMax that has a repeatDelay and has passed the first iteration may go to the incorrect time when you set the time via the time() method.

- FIXED: MorphSVGPlugin could throw an error if the target wasn't a DOM element.
  • Loading branch information
gsap-dev committed Feb 22, 2019
1 parent 087853f commit 720ac30
Show file tree
Hide file tree
Showing 18 changed files with 88 additions and 81 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ This is the public repository for GreenSock's JavaScript tools like <a href="htt
### CDN
TweenMax is most popular because it has all the essential tools plus several common <a href="https://greensock.com/plugins/?product_id=4921">plugins</a>, all in one file:
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.0/TweenMax.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.1/TweenMax.min.js"></script>
```
Click the green "Download GSAP" button at <a href="https://greensock.com/?download=GSAP-JS">greensock.com</a> for more options. Click "customize" at the bottom of the resulting window to see all the extra plugins and tool URLs.

Draggable, for example, is at:
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.0/utils/Draggable.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.1/utils/Draggable.min.js"></script>
```

Most ad networks have GSAP on their CDNs as well, so contact them for the appropriate URL(s).
Expand Down Expand Up @@ -67,6 +67,7 @@ For <a href="https://greensock.com/club/">Club GreenSock</a>-only plugins, downl
* <a href="https://greensock.com/docs/NPMUsage">NPM &amp; Webpack usage guide</a>
* <a href="https://greensock.com/examples-showcases">Examples &amp; showcases</a>
* <a href="https://greensock.com/why-gsap/">Why GSAP?</a> (a practical guide for developers)
* <a href="https://codepen.io/GreenSock/full/jdawKx">Advanced staggers</a>
* <a href="https://greensock.com/draggable/">Draggable demo</a>
* <a href="https://greensock.com/svg-tips/">Animating SVG with GSAP</a>
* <a href="https://greensock.com/club/">Club GreenSock</a> (get access to bonus plugins and tools not in this repository)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gsap",
"version": "2.1.0",
"version": "2.1.1",
"description": "The most flexible, high-performance animation library on the planet. Animate any property of any object. Solves browser quirks.",
"author": {
"name": "Jack Doyle",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gsap",
"version": "2.1.0",
"version": "2.1.1",
"description": "GSAP is a JavaScript library for creating high-performance animations that work in **every** major browser (or beyond the browser). No other library delivers such advanced sequencing, reliability, API efficiency, and tight control while solving real-world problems on over 7 million sites. GSAP works around countless browser inconsistencies; your animations 'just work'. Animate CSS properties, SVG, canvas libraries, custom properties of generic objects, colors, strings...pretty much anything! At its core, GSAP is a property manipulator, updating values over time very quickly with extreme accuracy. And it's up to 20x faster than jQuery! See http://greensock.com/why-gsap/ for details about what makes GSAP so special.",
"homepage": "https://greensock.com/gsap/",
"module": "./src/esm/index.js",
Expand Down
15 changes: 8 additions & 7 deletions src/esm/TimelineLite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* VERSION: 2.1.0
* DATE: 2019-02-15
* VERSION: 2.1.1
* DATE: 2019-02-21
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
Expand Down Expand Up @@ -74,12 +74,12 @@ _gsScope._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","Twee
}
return toVars;
},
//for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length}. Returns a function that expects the following parameters: index, target, array. Recognizes the following
//for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length, each}. Returns a function that expects the following parameters: index, target, array. Recognizes the following
_distribute = function(v) {
if (typeof(v) === "function") {
return v;
}
var vars = isNaN(v) ? v : {n:1, from:(v < 0) ? ((v = -v) && "end") : 0}, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all.
var vars = (typeof(v) === "object") ? v : {each:v}, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all.
ease = vars.ease,
from = vars.from || 0,
base = vars.base || 0,
Expand Down Expand Up @@ -116,15 +116,16 @@ _gsScope._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","Twee
}
distances.max = max - min;
distances.min = min;
distances.v = vars.n ? l * (v || 0) : vars.amount;
distances.v = l = vars.amount || (vars.each * (wrap > l ? l : !axis ? Math.max(wrap, l / wrap) : axis === "y" ? l / wrap : wrap)) || 0;
distances.b = (l < 0) ? base - l : base;
}
l = (distances[i] - distances.min) / distances.max;
return base + (ease ? ease.getRatio(l) : l) * distances.v;
return distances.b + (ease ? ease.getRatio(l) : l) * distances.v;
};
},
p = TimelineLite.prototype = new SimpleTimeline();

TimelineLite.version = "2.1.0";
TimelineLite.version = "2.1.1";
TimelineLite.distribute = _distribute;
p.constructor = TimelineLite;
p.kill()._gc = p._forcingPlayhead = p._hasPause = false;
Expand Down
8 changes: 4 additions & 4 deletions src/esm/TimelineMax.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* VERSION: 2.1.0
* DATE: 2019-02-15
* VERSION: 2.1.1
* DATE: 2019-02-21
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
Expand Down Expand Up @@ -34,7 +34,7 @@ _gsScope._gsDefine("TimelineMax", ["TimelineLite","TweenLite","easing.Ease"], fu

p.constructor = TimelineMax;
p.kill()._gc = false;
TimelineMax.version = "2.1.0";
TimelineMax.version = "2.1.1";

p.invalidate = function() {
this._yoyo = !!this.vars.yoyo;
Expand Down Expand Up @@ -477,7 +477,7 @@ _gsScope._gsDefine("TimelineMax", ["TimelineLite","TweenLite","easing.Ease"], fu
}
var duration = this._duration,
cycle = this._cycle,
cycleDur = cycle * (duration * this._repeatDelay);
cycleDur = cycle * (duration + this._repeatDelay);
if (value > duration) {
value = duration;
}
Expand Down
6 changes: 3 additions & 3 deletions src/esm/TweenLite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* VERSION: 2.1.0
* DATE: 2019-02-15
* VERSION: 2.1.1
* DATE: 2019-02-21
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
Expand Down Expand Up @@ -972,7 +972,7 @@ export var TweenLite = (function(window) {
p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
p._notifyPluginsOfEnabled = p._lazy = false;

TweenLite.version = "2.1.0";
TweenLite.version = "2.1.1";
TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
TweenLite.defaultOverwrite = "auto";
TweenLite.ticker = _ticker;
Expand Down
4 changes: 2 additions & 2 deletions src/esm/TweenMax.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* VERSION: 2.1.0
* DATE: 2019-02-15
* VERSION: 2.1.1
* DATE: 2019-02-21
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
Expand Down
17 changes: 9 additions & 8 deletions src/esm/TweenMaxBase.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* VERSION: 2.1.0
* DATE: 2019-02-15
* VERSION: 2.1.1
* DATE: 2019-02-21
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
Expand Down Expand Up @@ -32,12 +32,12 @@ _gsScope._gsDefine("TweenMax", ["core.Animation","core.SimpleTimeline","TweenLit
}
delete vars.cycle;
},
//for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length}. Returns a function that expects the following parameters: index, target, array. Recognizes the following
//for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length, each}. Returns a function that expects the following parameters: index, target, array. Recognizes the following
_distribute = function(v) {
if (typeof(v) === "function") {
return v;
}
var vars = isNaN(v) ? v : {n:1, from:(v < 0) ? ((v = -v) && "end") : 0}, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all.
var vars = (typeof(v) === "object") ? v : {each:v}, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all.
ease = vars.ease,
from = vars.from || 0,
base = vars.base || 0,
Expand Down Expand Up @@ -74,10 +74,11 @@ _gsScope._gsDefine("TweenMax", ["core.Animation","core.SimpleTimeline","TweenLit
}
distances.max = max - min;
distances.min = min;
distances.v = vars.n ? l * (v || 0) : vars.amount;
distances.v = l = vars.amount || (vars.each * (wrap > l ? l : !axis ? Math.max(wrap, l / wrap) : axis === "y" ? l / wrap : wrap)) || 0;
distances.b = (l < 0) ? base - l : base;
}
l = (distances[i] - distances.min) / distances.max;
return base + (ease ? ease.getRatio(l) : l) * distances.v;
return distances.b + (ease ? ease.getRatio(l) : l) * distances.v;
};
},
TweenMax = function(target, duration, vars) {
Expand All @@ -98,7 +99,7 @@ _gsScope._gsDefine("TweenMax", ["core.Animation","core.SimpleTimeline","TweenLit
p = TweenMax.prototype = TweenLite.to({}, 0.1, {}),
_blankArray = [];

TweenMax.version = "2.1.0";
TweenMax.version = "2.1.1";
p.constructor = TweenMax;
p.kill()._gc = false;
TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf;
Expand Down Expand Up @@ -610,7 +611,7 @@ _gsScope._gsDefine("TweenMax", ["core.Animation","core.SimpleTimeline","TweenLit
}
var duration = this._duration,
cycle = this._cycle,
cycleDur = cycle * (duration * this._repeatDelay);
cycleDur = cycle * (duration + this._repeatDelay);
if (value > duration) {
value = duration;
}
Expand Down
4 changes: 2 additions & 2 deletions src/esm/all.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* VERSION: 2.1.0
* DATE: 2019-02-15
* VERSION: 2.1.1
* DATE: 2019-02-21
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion src/esm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gsap",
"version": "2.1.0",
"version": "2.1.1",
"description": "GSAP is a JavaScript library for creating high-performance animations that work in **every** major browser (or beyond the browser). No other library delivers such advanced sequencing, reliability, API efficiency, and tight control while solving real-world problems on over 4 million sites. GSAP works around countless browser inconsistencies; your animations 'just work'. Animate CSS properties, SVG, canvas libraries, custom properties of generic objects, colors, strings...pretty much anything! At its core, GSAP is a property manipulator, updating values over time very quickly with extreme accuracy. And it's up to 20x faster than jQuery! See http://greensock.com/why-gsap/ for details about what makes GSAP so special.",
"homepage": "https://greensock.com/gsap/",
"filename": "index.js",
Expand Down
Loading

0 comments on commit 720ac30

Please sign in to comment.