From 376d89684737941425f753024cd52c507a28ae0f Mon Sep 17 00:00:00 2001 From: Jan Paepke Date: Fri, 14 Aug 2020 11:18:23 +0200 Subject: [PATCH] released 2.0.8 --- README.md | 8 +- bower.json | 79 ++----------------- dev/build/config.json | 4 +- package.json | 4 +- scrollmagic/minified/ScrollMagic.min.js | 4 +- .../minified/plugins/animation.gsap.min.js | 4 +- .../plugins/animation.velocity.min.js | 2 +- .../plugins/debug.addIndicators.min.js | 2 +- .../plugins/jquery.ScrollMagic.min.js | 2 +- scrollmagic/uncompressed/ScrollMagic.js | 12 +-- .../uncompressed/plugins/animation.gsap.js | 54 +++++++++---- .../plugins/animation.velocity.js | 6 +- .../plugins/debug.addIndicators.js | 6 +- .../plugins/jquery.ScrollMagic.js | 6 +- 14 files changed, 76 insertions(+), 117 deletions(-) diff --git a/README.md b/README.md index fb41915a..d3fde48d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ScrollMagic v2.0.7 [![Build Status](https://api.travis-ci.org/janpaepke/ScrollMagic.svg?branch=master)](https://travis-ci.org/janpaepke/ScrollMagic) +# ScrollMagic v2.0.8 [![Build Status](https://api.travis-ci.org/janpaepke/ScrollMagic.svg?branch=master)](https://travis-ci.org/janpaepke/ScrollMagic) ### The javascript library for magical scroll interactions. @@ -82,15 +82,15 @@ npm install scrollmagic If you don't want to host ScrollMagic yourself, you can include it from [cdnjs](https://cdnjs.com/libraries/ScrollMagic): ``` -https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.7/ScrollMagic.min.js +https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.8/ScrollMagic.min.js ``` All plugins and uncompressed files are also available on cdnjs. For example: ``` -https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.7/plugins/debug.addIndicators.js -https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.7/plugins/debug.addIndicators.min.js +https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.8/plugins/debug.addIndicators.js +https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.8/plugins/debug.addIndicators.min.js ``` ## Installation diff --git a/bower.json b/bower.json index 72fbbd27..f21a4752 100644 --- a/bower.json +++ b/bower.json @@ -1,83 +1,18 @@ { "name": "scrollmagic", - "version": "2.0.7", + "version": "2.0.8", "description": "The javascript library for magical scroll interactions.", "homepage": "http://ScrollMagic.io", "repository": { "type": "git", "url": "https://github.com/janpaepke/ScrollMagic.git" }, - "authors": [ - { - "name": "Jan Paepke", - "homepage": "http://www.janpaepke.de" - } - ], + "authors": [{ + "name": "Jan Paepke", + "homepage": "http://www.janpaepke.de" + }], "main": "scrollmagic/uncompressed/ScrollMagic.js", - "keywords": [ - "scroll", - "scrolling", - "animation", - "sticky", - "pin", - "fixed", - "scrollbar", - "scrub", - "sync", - "position", - "progress", - "parallax", - "events", - "classes", - "jquery-plugin", - "ecosystem:jquery", - "scroll", - "scrolling", - "animation", - "sticky", - "pin", - "fixed", - "scrollbar", - "scrub", - "sync", - "position", - "progress", - "parallax", - "events", - "classes", - "jquery-plugin", - "ecosystem:jquery", - "scroll", - "scrolling", - "animation", - "sticky", - "pin", - "fixed", - "scrollbar", - "scrub", - "sync", - "position", - "progress", - "parallax", - "events", - "classes", - "jquery-plugin", - "ecosystem:jquery" - ], - "ignore": [ - "**/.*", - "css", - "dev", - "docs", - "examples", - "img", - "js", - "index.html", - "gulpfile.js", - "CONTRIBUTING.md", - "CHANGELOG.md", - "package.json", - "ScrollMagic.jquery.json" - ], + "keywords": ["scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery", "scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery", "scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery", "scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery"], + "ignore": ["**/.*", "css", "dev", "docs", "examples", "img", "js", "index.html", "gulpfile.js", "CONTRIBUTING.md", "CHANGELOG.md", "package.json", "ScrollMagic.jquery.json"], "license": ["MIT", "GPL-3.0+"] } diff --git a/dev/build/config.json b/dev/build/config.json index 6882aa51..040a518f 100644 --- a/dev/build/config.json +++ b/dev/build/config.json @@ -1,6 +1,6 @@ { - "version": "2.0.7", - "lastupdate": "2019-05-07", + "version": "2.0.8", + "lastupdate": "2020-08-14", "info": { "description": "The javascript library for magical scroll interactions.", "homepage": "http://ScrollMagic.io", diff --git a/package.json b/package.json index 7a721f92..63836a54 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "scrollmagic", "title": "ScrollMagic", - "version": "2.0.7", + "version": "2.0.8", "description": "The javascript library for magical scroll interactions.", "author": { "name": "Jan Paepke", @@ -55,7 +55,7 @@ "start": "node ./node_modules/gulp/bin/gulp open-demo" }, "homepage": "http://ScrollMagic.io", - "keywords": ["scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery", "scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery", "scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery"], + "keywords": ["scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery", "scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery", "scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery", "scroll", "scrolling", "animation", "sticky", "pin", "fixed", "scrollbar", "scrub", "sync", "position", "progress", "parallax", "events", "classes", "jquery-plugin", "ecosystem:jquery"], "bugs": "https://github.com/janpaepke/ScrollMagic/issues", "files": ["scrollmagic", "LICENSE.md", "README.md"] } diff --git a/scrollmagic/minified/ScrollMagic.min.js b/scrollmagic/minified/ScrollMagic.min.js index 0427d84a..47111c33 100644 --- a/scrollmagic/minified/ScrollMagic.min.js +++ b/scrollmagic/minified/ScrollMagic.min.js @@ -1,2 +1,2 @@ -/*! ScrollMagic v2.0.7 | (c) 2019 Jan Paepke (@janpaepke) | license & info: http://scrollmagic.io */ -!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.ScrollMagic=t()}(this,function(){"use strict";var _=function(){};_.version="2.0.7",window.addEventListener("mousewheel",function(){});var P="data-scrollmagic-pin-spacer";_.Controller=function(e){var n,r,i="REVERSE",t="PAUSED",o=z.defaults,s=this,a=R.extend({},o,e),l=[],c=!1,f=0,u=t,d=!0,h=0,p=!0,g=function(){0t.scrollOffset()?1:-1}),t};return this.addScene=function(e){if(R.type.Array(e))e.forEach(function(e,t){s.addScene(e)});else if(e instanceof _.Scene)if(e.controller()!==s)e.addTo(s);else if(l.indexOf(e)<0)for(var t in l.push(e),l=x(l),e.on("shift.controller_sort",function(){l=x(l)}),a.globalSceneOptions)e[t]&&e[t].call(e,a.globalSceneOptions[t]);return s},this.removeScene=function(e){if(R.type.Array(e))e.forEach(function(e,t){s.removeScene(e)});else{var t=l.indexOf(e);-1=a.start?1:0,d.trigger("update",{startPos:a.start,endPos:a.end,scrollPos:n}),d.progress(t)}else m&&p===f&&C(!0);else l.updateScene(d,!1);return d},this.refresh=function(){return o(),y(),d},this.progress=function(e){if(arguments.length){var t=!1,n=p,r=l?l.info("scrollDirection"):"PAUSED",i=h.reverse||g<=e;if(0===h.duration?(t=g!=e,p=0===(g=e<1&&i?0:1)?c:f):e<0&&p!==c&&i?(p=c,t=!(g=0)):0<=e&&e<1&&i?(g=e,p=f,t=!0):1<=e&&p!==u?(g=1,p=u,t=!0):p!==f||i||C(),t){var o={progress:g,state:p,scrollDirection:r},s=p!=n,a=function(e){d.trigger(e,o)};s&&n!==f&&(a("enter"),a(n===c?"start":"end")),a("progress"),s&&p!==f&&(a(p===c?"start":"end"),a("leave"))}return d}return g};var m,w,t=function(){a={start:v+h.offset},l&&h.triggerElement&&(a.start-=l.info("size")*h.triggerHook),a.end=a.start+h.duration},o=function(e){if(n){var t="duration";x(t,n.call(d))&&!e&&(d.trigger("change",{what:t,newval:h[t]}),d.trigger("shift",{reason:t}))}},y=function(e){var t=0,n=h.triggerElement;if(l&&(n||0t.scrollOffset()?1:-1}),t};return this.addScene=function(e){if(R.type.Array(e))e.forEach(function(e,t){s.addScene(e)});else if(e instanceof _.Scene)if(e.controller()!==s)e.addTo(s);else if(l.indexOf(e)<0)for(var t in l.push(e),l=x(l),e.on("shift.controller_sort",function(){l=x(l)}),a.globalSceneOptions)e[t]&&e[t].call(e,a.globalSceneOptions[t]);return s},this.removeScene=function(e){if(R.type.Array(e))e.forEach(function(e,t){s.removeScene(e)});else{var t=l.indexOf(e);-1=a.start?1:0,d.trigger("update",{startPos:a.start,endPos:a.end,scrollPos:n}),d.progress(t)}else m&&p===f&&C(!0);else l.updateScene(d,!1);return d},this.refresh=function(){return o(),y(),d},this.progress=function(e){if(arguments.length){var t=!1,n=p,r=l?l.info("scrollDirection"):"PAUSED",i=h.reverse||g<=e;if(0===h.duration?(t=g!=e,p=0===(g=e<1&&i?0:1)?c:f):e<0&&p!==c&&i?(p=c,t=!(g=0)):0<=e&&e<1&&i?(g=e,p=f,t=!0):1<=e&&p!==u?(g=1,p=u,t=!0):p!==f||i||C(),t){var o={progress:g,state:p,scrollDirection:r},s=p!=n,a=function(e){d.trigger(e,o)};s&&n!==f&&(a("enter"),a(n===c?"start":"end")),a("progress"),s&&p!==f&&(a(p===c?"start":"end"),a("leave"))}return d}return g};var m,w,t=function(){a={start:v+h.offset},l&&h.triggerElement&&(a.start-=l.info("size")*h.triggerHook),a.end=a.start+h.duration},o=function(e){if(n){var t="duration";x(t,n.call(d))&&!e&&(d.trigger("change",{what:t,newval:h[t]}),d.trigger("shift",{reason:t}))}},y=function(e){var t=0,n=h.triggerElement;if(l&&(n||0 As of ScrollMagic 2.0.0 you need to use \'new ScrollMagic.Controller()\' to create a new controller instance. Use \'new ScrollMagic.Scene()\' to instance a scene.'); }; - ScrollMagic.version = "2.0.7"; + ScrollMagic.version = "2.0.8"; // TODO: temporary workaround for chrome's scroll jitter bug - window.addEventListener("mousewheel", function () {}); + if (typeof (window) !== 'undefined') { + window.addEventListener("mousewheel", void(0)); + } // global const var PIN_SPACER_ATTRIBUTE = "data-scrollmagic-pin-spacer"; diff --git a/scrollmagic/uncompressed/plugins/animation.gsap.js b/scrollmagic/uncompressed/plugins/animation.gsap.js index f2e2b826..475615d9 100644 --- a/scrollmagic/uncompressed/plugins/animation.gsap.js +++ b/scrollmagic/uncompressed/plugins/animation.gsap.js @@ -1,10 +1,10 @@ /*! - * ScrollMagic v2.0.7 (2019-05-07) + * ScrollMagic v2.0.8 (2020-08-14) * The javascript library for magical scroll interactions. - * (c) 2019 Jan Paepke (@janpaepke) + * (c) 2020 Jan Paepke (@janpaepke) * Project Website: http://scrollmagic.io * - * @version 2.0.7 + * @version 2.0.8 * @license Dual licensed under MIT license and GPL. * @author Jan Paepke - e-mail@janpaepke.de * @@ -28,19 +28,22 @@ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ScrollMagic', 'TweenMax', 'TimelineMax'], factory); + define(['ScrollMagic', 'gsap', 'TweenMax', 'TimelineMax'], factory); } else if (typeof exports === 'object') { // CommonJS // Loads whole gsap package onto global scope. - require('gsap'); - factory(require('scrollmagic'), TweenMax, TimelineMax); + var gsap = require("gsap/dist/gsap") || require("gsap"); + + // TweenMax/TimelineMax will be global in v2. In v3, they will be on the gsap object + factory(require('scrollmagic'), gsap, TweenMax || gsap, TimelineMax || gsap); } else { // Browser globals - factory(root.ScrollMagic || (root.jQuery && root.jQuery.ScrollMagic), root.TweenMax || root.TweenLite, root.TimelineMax || root.TimelineLite); + factory(root.ScrollMagic || (root.jQuery && root.jQuery.ScrollMagic), root.gsap, root.gsap || root.TweenMax || root.TweenLite, root.gsap || root.TimelineMax || root.TimelineLite); } -}(this, function (ScrollMagic, Tween, Timeline) { +}(this, function (ScrollMagic, Gsap, Tween, Timeline) { "use strict"; var NAMESPACE = "animation.gsap"; + var GSAP3_OR_GREATER = Gsap && parseFloat(Gsap.version) >= 3; var console = window.console || {}, @@ -197,16 +200,33 @@ */ Scene.setTween = function (TweenObject, duration, params) { var newTween; + if (arguments.length > 1) { - if (arguments.length < 3) { - params = duration; - duration = 1; + var durationIsSet = typeof arguments['1'] === 'number'; + + if (GSAP3_OR_GREATER) { + // If we're using gsap 3 with proper gsap 3 syntax of 2 arguments + if (!durationIsSet) { + params = duration; + } + // Add a duration is there isn't one + if (!params.hasOwnProperty('duration')) { + params.duration = durationIsSet ? duration : 1; + } + } else { + // If we're using gsap 2 or earlier syntax + if (arguments.length < 3) { + params = duration; + duration = 1; + } } - TweenObject = Tween.to(TweenObject, duration, params); + + // 2 arguments should be gsap 3 syntax, and 3 arguments for + TweenObject = GSAP3_OR_GREATER ? Tween.to(TweenObject, params) : Tween.to(TweenObject, duration, params); } try { - // wrap Tween into a Timeline Object if available to include delay and repeats in the duration and standardize methods. - if (Timeline) { + // wrap Tween into a Timeline Object if not gsap 3 or greater and available to include delay and repeats in the duration and standardize methods. + if (Timeline && !GSAP3_OR_GREATER) { newTween = new Timeline({ smoothChildTiming: true }) @@ -254,6 +274,8 @@ // warn about tween overwrites, when an element is tweened multiple times if (parseFloat(TweenLite.version) >= 1.14) { // onOverwrite only present since GSAP v1.14.0 var + // However, onInterrupt deprecated onOverwrite in GSAP v3 + methodUsed = GSAP3_OR_GREATER ? 'onInterrupt' : 'onOverwrite', list = _tween.getChildren ? _tween.getChildren(true, true, false) : [_tween], // get all nested tween objects newCallback = function () { log(2, "WARNING: tween was overwritten by another. To learn how to avoid this issue see here: https://github.com/janpaepke/ScrollMagic/wiki/WARNING:-tween-was-overwritten-by-another"); @@ -262,8 +284,8 @@ /*jshint loopfunc: true */ thisTween = list[i]; if (oldCallback !== newCallback) { // if tweens is added more than once - oldCallback = thisTween.vars.onOverwrite; - thisTween.vars.onOverwrite = function () { + oldCallback = thisTween.vars[methodUsed]; + thisTween.vars[methodUsed] = function () { if (oldCallback) { oldCallback.apply(this, arguments); } diff --git a/scrollmagic/uncompressed/plugins/animation.velocity.js b/scrollmagic/uncompressed/plugins/animation.velocity.js index 874faa70..3da705a2 100644 --- a/scrollmagic/uncompressed/plugins/animation.velocity.js +++ b/scrollmagic/uncompressed/plugins/animation.velocity.js @@ -1,10 +1,10 @@ /*! - * ScrollMagic v2.0.7 (2019-05-07) + * ScrollMagic v2.0.8 (2020-08-14) * The javascript library for magical scroll interactions. - * (c) 2019 Jan Paepke (@janpaepke) + * (c) 2020 Jan Paepke (@janpaepke) * Project Website: http://scrollmagic.io * - * @version 2.0.7 + * @version 2.0.8 * @license Dual licensed under MIT license and GPL. * @author Jan Paepke - e-mail@janpaepke.de * diff --git a/scrollmagic/uncompressed/plugins/debug.addIndicators.js b/scrollmagic/uncompressed/plugins/debug.addIndicators.js index de12a868..daf65c3a 100644 --- a/scrollmagic/uncompressed/plugins/debug.addIndicators.js +++ b/scrollmagic/uncompressed/plugins/debug.addIndicators.js @@ -1,10 +1,10 @@ /*! - * ScrollMagic v2.0.7 (2019-05-07) + * ScrollMagic v2.0.8 (2020-08-14) * The javascript library for magical scroll interactions. - * (c) 2019 Jan Paepke (@janpaepke) + * (c) 2020 Jan Paepke (@janpaepke) * Project Website: http://scrollmagic.io * - * @version 2.0.7 + * @version 2.0.8 * @license Dual licensed under MIT license and GPL. * @author Jan Paepke - e-mail@janpaepke.de * diff --git a/scrollmagic/uncompressed/plugins/jquery.ScrollMagic.js b/scrollmagic/uncompressed/plugins/jquery.ScrollMagic.js index 564b7136..20ac0f7b 100644 --- a/scrollmagic/uncompressed/plugins/jquery.ScrollMagic.js +++ b/scrollmagic/uncompressed/plugins/jquery.ScrollMagic.js @@ -1,10 +1,10 @@ /*! - * ScrollMagic v2.0.7 (2019-05-07) + * ScrollMagic v2.0.8 (2020-08-14) * The javascript library for magical scroll interactions. - * (c) 2019 Jan Paepke (@janpaepke) + * (c) 2020 Jan Paepke (@janpaepke) * Project Website: http://scrollmagic.io * - * @version 2.0.7 + * @version 2.0.8 * @license Dual licensed under MIT license and GPL. * @author Jan Paepke - e-mail@janpaepke.de *