iwmlib/lib/3rdparty/gsap/src/minified/utils/GSDevTools.min.js

28 lines
78 KiB
JavaScript
Raw Normal View History

/*!
* VERSION: 0.1.9
* DATE: 2019-02-07
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
* GSDevTools is a Club GreenSock membership benefit; You must have a valid membership to use
* this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details.
* This work is subject to the software agreement that was issued with your membership.
*
* @author: Jack Doyle, jack@greensock.com
**/
var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("GSDevTools",["TweenLite","core.Animation","core.SimpleTimeline","TimelineLite","utils.Draggable","plugins.CSSPlugin"],function(a,b,c,d,e){var f,g,h,i,j,k=document,l=k.documentElement,m="http://www.w3.org/2000/svg",n="http://www.w3.org/1999/xhtml",o=0,p={},q=function(a,b,c){var d=k.createElementNS?k.createElementNS("svg"===a?m:n,a):k.createElement(a);return b&&("string"==typeof b&&(b=k.querySelector(b)),b.appendChild(d)),"svg"===a&&(d.setAttribute("xmlns",m),d.setAttribute("xmlns:xlink",n)),c&&(d.style.cssText=c),d},r=function(){k.selection?k.selection.empty():window.getSelection&&window.getSelection().removeAllRanges()},s=b._rootTimeline,t=function(b,c){for(var d=[],e=0,f=b._first;f;)f instanceof a?f.vars.id&&(d[e++]=f):(c&&f.vars.id&&(d[e++]=f),d=d.concat(t(f,c)),e=d.length),f=f._next;return d},u=function(a,b){var c=0,d=Math.max(0,a._repeat),e=a._first;for(e||(c=a.duration());e;)c=Math.max(c,e.totalDuration()>999?e.endTime(!1):e._startTime+e._totalDuration/e._timeScale),e=e._next;return!b&&d?c*(d+1)+a._repeatDelay*d:c},v=function(a){if(!a)return null;if(a instanceof b)return a;for(var c=t(s,!0),d=c.length;--d>-1;)if(c[d].vars.id===a)return c[d]},w=function(a,b,c,d){var e,f,g;return"string"==typeof a&&("="===a.charAt(1)?(e=parseInt(a.charAt(0)+"1",10)*parseFloat(a.substr(2)),0>e&&0===d&&(d=100),a=d/100*b.duration()+e):isNaN(a)&&b.getLabelTime&&-1!==b.getLabelTime(a)?a=b.getLabelTime(a):b===D&&(f=a.indexOf("="),f>0?(e=parseInt(a.charAt(f-1)+"1",10)*parseFloat(a.substr(f+1)),a=a.substr(0,f-1)):e=0,g=v(a),g&&(a=x(g,c/100*g.duration())+e))),a=isNaN(a)?c:parseFloat(a),Math.min(100,Math.max(0,a/b.duration()*100))},x=function(a,b){var c=a;if(b=b||0,c.timeline)for(;c.timeline.timeline;)b=b/c._timeScale+c._startTime,c=c.timeline;return b},y=function(b,c,d){f||(q("style",l).innerHTML=".gs-dev-tools{height:51px;bottom:0;left:0;right:0;display:block;position:fixed;overflow:visible;padding:0}.gs-dev-tools *{box-sizing:content-box;visibility:visible}.gs-dev-tools .gs-top{position:relative;z-index:499}.gs-dev-tools .gs-bottom{display:flex;align-items:center;justify-content:space-between;background-color:rgba(0,0,0,.6);height:42px;border-top:1px solid #999;position:relative}.gs-dev-tools .timeline{position:relative;height:8px;margin-left:15px;margin-right:15px;overflow:visible}.gs-dev-tools .progress-bar,.gs-dev-tools .timeline-track{height:8px;width:100%;position:absolute;top:0;left:0}.gs-dev-tools .timeline-track{background-color:#999;opacity:.6}.gs-dev-tools .progress-bar{background-color:#91e600;height:8px;top:0;width:0;pointer-events:none}.gs-dev-tools .seek-bar{width:100%;position:absolute;height:24px;top:-12px;left:0;background-color:transparent}.gs-dev-tools .in-point,.gs-dev-tools .out-point{width:15px;height:26px;position:absolute;top:-18px}.gs-dev-tools .in-point-shape{fill:#6d9900;stroke:rgba(0,0,0,.5);stroke-width:1}.gs-dev-tools .out-point-shape{fill:#994242;stroke:rgba(0,0,0,.5);stroke-width:1}.gs-dev-tools .in-point{transform:translateX(-100%)}.gs-dev-tools .out-point{left:100%}.gs-dev-tools .grab{stroke:rgba(255,255,255,.3);stroke-width:1}.gs-dev-tools .playhead{position:absolute;top:-5px;transform:translate(-50%,0);left:0;border-radius:50%;width:16px;height:16px;border:1px solid #6d9900;background-color:#91e600}.gs-dev-tools .gs-btn-white{fill:#fff}.gs-dev-tools .pause{opacity:0}.gs-dev-tools .select-animation{vertical-align:middle;position:relative;padding:6px 10px}.gs-dev-tools .select-animation-container{flex-grow:4;width:40%}.gs-dev-tools .select-arrow{display:inline-block;width:12px;height:7px;margin:0 7px;transform:translate(0,-2px)}.gs-dev-tools .select-arrow-shape{stroke:rgba(255,255,255,.6);stroke-width:2px;fill:none}.gs-dev-tools .rewind{height:16px;width:19px;padding:10px 4px;min-width:24px}.gs-dev-tools .rewind-path{opacity:.6}.gs-dev-tools .play-pause{width:24px;height:24px;padding:6px 10px;min-width:24px}.gs-de
m=a,S("loop",m),m?(ra.play(),s.progress()>=ea/100&&(s.target===n&&s.target.seek(E+(H-E)*da/100),n._repeat&&!da&&100===ea?s.totalProgress(0,!0):s.progress(da/100,!0),ma())):ra.reverse()},ta=function(){sa(!m)},ua=R(".animation-list"),va=R(".animation-label"),wa=function(){var a,b,d=t(x&&c.globalSync===!1?x:D,!0),e=ua.children,f=0;for(x&&c.globalSync===!1?d.unshift(x):c.hideGlobalTimeline||d.unshift(D),b=0;b<d.length;b++)a=e[b]||q("option",ua),a.animation=d[b],f=b&&d[b].vars.id===d[b-1].vars.id?f+1:0,a.setAttribute("value",a.innerHTML=d[b].vars.id+(f?" ["+f+"]":d[b+1]&&d[b+1].vars.id===d[b].vars.id?" [0]":""));for(;b<e.length;b++)ua.removeChild(e[b])},xa=function(d){var e,f,g=parseFloat(Aa.options[Aa.selectedIndex].value)||1;if(!arguments.length)return n;if("string"==typeof d&&(d=v(d)),d instanceof b||console.log("GSDevTools error: invalid animation."),d!==n){if(n&&(n._inProgress=da,n._outProgress=ea),n=d,s&&(g=s.timeScale(),s.target===x&&(x.resume(),s.kill())),da=n._inProgress||0,ea=n._outProgress||100,aa.style.left=da+"%",ba.style.left=ea+"%",K&&(S("animation",n.vars.id),S("in",da),S("out",ea)),E=0,f=Math.min(1e3,c.maxDuration||1e3,u(n)),n===D||c.globalSync!==!1){if(G(),s=F,h&&h!==P&&console.log("Error: GSDevTools can only have one instance that's globally synchronized."),h=P,n!==D)for(e=n,H=e.totalDuration(),H>99999999&&(H=e.duration());e.timeline.timeline;)E=E/e._timeScale+e._startTime,H=H/e._timeScale+e._startTime,e=e.timeline;else H=D.duration();H-E>f&&(H=E+f),D.pause(E),F.vars.time=H,F.invalidate(),F.duration(H-E).timeScale(g),la?F.progress(1).pause(0):a.delayedCall(.01,function(){F.resume().progress(da/100),la&&ma()})}else{if(h===P&&(h=null),n!==x&&x){for(e=n,H=e.totalDuration(),H>99999999&&(H=e.duration());e.timeline.timeline&&e!==x;)E=E/e._timeScale+e._startTime,H=H/e._timeScale+e._startTime,e=e.timeline;H-E>f&&(H=E+f),x.pause(E),s=a.to(x,H-E,{time:H,ease:Linear.easeNone,data:"root"})}else s=n,!m&&s._repeat&&sa(!0);s.timeScale(g),F.pause(),D.resume(),s.seek(0)}Y.innerHTML=s.duration().toFixed(2),B(ua,n.vars.id,va)}},ya=function(){var a,b,c;n===D&&(a=D._time,D.progress(1,!0).time(a,!0),a=(F._timeline._time-F._startTime)*F._timeScale,c=Math.min(1e3,D.duration()),1e3===c&&(c=Math.min(1e3,u(D))),b=F.duration()/c,1!==b&&c&&(da*=b,100>ea&&(ea*=b),F.seek(0),F.vars.time=c,F.invalidate(),F.duration(c),F.time(a),Y.innerHTML=c.toFixed(2),ha(!0)))},za=function(a){xa(ua.options[ua.selectedIndex].animation),a.target&&a.target.blur&&a.target.blur(),la&&ma()},Aa=R(".time-scale select"),Ba=R(".time-scale-label"),Ca=function(b){var c=parseFloat(Aa.options[Aa.selectedIndex].value)||1;s.timeScale(c),S("timeScale",c),la||(s.progress()>=ea/100?(s.target===n&&s.target.seek(E+(H-E)*da/100),s.progress(da/100,!0).pause()):s.pause(),a.delayedCall(.01,function(){s.resume()})),Ba.innerHTML=c+"x",Aa.blur&&Aa.blur()},Da=a.to([R(".gs-bottom"),R(".gs-top")],.3,{autoAlpha:0,y:50,ease:Power2.easeIn,data:"root",paused:!0}),Ea=!1,Fa=function(a){e.hitTest(a,Q)||_.isDragging||fa.isDragging||ga.isDragging||Ja.restart(!0)},Ga=function(){Ea||(Da.play(),Ja.pause(),Ea=!0)},Ha=function(){Ja.pause(),Ea&&(Da.reverse(),Ea=!1)},Ia=function(){Ea?Ha():Ga()},Ja=a.delayedCall(1.3,Ga).pause(),Ka=function(a){M&&!O&&(O=D._startTime),K=!a,x=v(c.animation),x&&!x.vars.id&&(x.vars.id="[no id]"),wa();var b=v(T("animation"));b&&(b._inProgress=T("in")||0,b._outProgress=T("out")||100),c.paused&&na(),n=null,xa(x||b||D);var d=c.timeScale||T("timeScale"),e=b===n;d&&(B(Aa,d,Ba,d+"x"),s.timeScale(d)),da=("inTime"in c?w(c.inTime,n,0,0):e?b._inProgress:0)||0,100===da&&!c.animation&&b&&(xa(D),da=w(c.inTime,n,0,0)||0),da&&(aa.style.left=da+"%",aa.style.display=ba.style.display="block"),ea=("outTime"in c?w(c.outTime,n,100,da):e?b._outProgress:0)||100,da>ea&&(ea=100),100!==ea&&(ba.style.left=ea+"%",aa.style.display=ba.style.display="block"),m="loop"in c?c.loop:T("loop"),m&&sa(!0),c.paused&&s.progress(da/100,!0).pause(),M&&n===D&&O&&c.globalSync!==!1&&!la&&s.time(-O,!0),ha(!0)};z(ua,"change",za),z(ua,"mousedown",wa),z(ja,"mousedown",oa),z(R(".seek-bar"),"mousedown",ia),z(R(".rewind"),"mo
* VERSION: 0.17.0
* DATE: 2019-02-07
* UPDATES AND DOCS AT: http://greensock.com
*
* 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/).
*
* @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
* This work is subject to the terms at http://greensock.com/standard-license or for
* Club GreenSock members, the software agreement that was issued with your membership.
*
* @author: Jack Doyle, jack@greensock.com
*/
var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("utils.Draggable",["events.EventDispatcher","TweenLite","plugins.CSSPlugin"],function(a,b,c){var d,e,f,g,h,i,j,k,l,m={css:{},data:"_draggable"},n={css:{},data:"_draggable"},o={css:{},data:"_draggable"},p={css:{}},q=_gsScope._gsDefine.globals,r={},s=function(){return!1},t={style:{},appendChild:s,removeChild:s},u=_gsScope.document||{createElement:function(){return t}},v=u.documentElement||{},w=function(a){return u.createElementNS?u.createElementNS("http://www.w3.org/1999/xhtml",a):u.createElement(a)},x=w("div"),y=[],z=180/Math.PI,A=999999999999999,B=Date.now||function(){return(new Date).getTime()},C=!(u.addEventListener||!u.all),D=u.createElement("div"),E=[],F={},G=0,H=/^(?:a|input|textarea|button|select)$/i,I=0,J=_gsScope.navigator&&-1!==_gsScope.navigator.userAgent.toLowerCase().indexOf("android"),K=0,L={},M={},N=function(a){if("string"==typeof a&&(a=b.selector(a)),!a||a.nodeType)return[a];var c,d=[],e=a.length;for(c=0;c!==e;d.push(a[c++]));return d},O=function(a,b){var c,d={};if(b)for(c in a)d[c]=a[c]*b;else for(c in a)d[c]=a[c];return d},P=function(){for(var a=E.length;--a>-1;)E[a]()},Q=function(a){E.push(a),1===E.length&&b.ticker.addEventListener("tick",P,this,!1,1)},R=function(a){for(var c=E.length;--c>-1;)E[c]===a&&E.splice(c,1);b.to(S,0,{overwrite:"all",delay:15,onComplete:S,data:"_draggable"})},S=function(){E.length||b.ticker.removeEventListener("tick",P)},T=function(a,b){var c;for(c in b)void 0===a[c]&&(a[c]=b[c]);return a},U=function(){return null!=window.pageYOffset?window.pageYOffset:null!=u.scrollTop?u.scrollTop:v.scrollTop||u.body.scrollTop||0},V=function(){return null!=window.pageXOffset?window.pageXOffset:null!=u.scrollLeft?u.scrollLeft:v.scrollLeft||u.body.scrollLeft||0},W=function(a,b){Ka(a,"scroll",b),Y(a.parentNode)||W(a.parentNode,b)},X=function(a,b){La(a,"scroll",b),Y(a.parentNode)||X(a.parentNode,b)},Y=function(a){return!(a&&a!==v&&a!==u&&a!==u.body&&a!==window&&a.nodeType&&a.parentNode)},Z=function(a,b){var c="x"===b?"Width":"Height",d="scroll"+c,e="client"+c,f=u.body;return Math.max(0,Y(a)?Math.max(v[d],f[d])-(window["inner"+c]||v[e]||f[e]):a[d]-a[e])},$=function(a){var b=Y(a),c=Z(a,"x"),d=Z(a,"y");b?a=M:$(a.parentNode),a._gsMaxScrollX=c,a._gsMaxScrollY=d,a._gsScrollX=a.scrollLeft||0,a._gsScrollY=a.scrollTop||0},_=function(a,b){return a=a||window.event,r.pageX=a.clientX+u.body.scrollLeft+v.scrollLeft,r.pageY=a.clientY+u.body.scrollTop+v.scrollTop,b&&(a.returnValue=!1),r},aa=function(a){return a?("string"==typeof a&&(a=b.selector(a)),a.length&&a!==window&&a[0]&&a[0].style&&!a.nodeType&&(a=a[0]),a===window||a.nodeType&&a.style?a:null):a},ba=function(a,b){var c,e,f,g=a.style;if(void 0===g[b]){for(f=["O","Moz","ms","Ms","Webkit"],e=5,c=b.charAt(0).toUpperCase()+b.substr(1);--e>-1&&void 0===g[f[e]+c];);if(0>e)return"";d=3===e?"ms":f[e],b=d+c}return b},ca=function(a,b,c){var d=a.style;d&&(void 0===d[b]&&(b=ba(a,b)),null==c?d.removeProperty?d.removeProperty(b.replace(/([A-Z])/g,"-$1").toLowerCase()):d.removeAttribute(b):void 0!==d[b]&&(d[b]=c))},da="undefined"!=typeof window?window:u.defaultView||{getComputedStyle:function(){}},ea=function(a,b){return da.getComputedStyle(a instanceof Element?a:a.host||(a.parentNode||{}).host||a,b)},fa=/(?:Left|Right|Width)/i,ga=/(?:\d|\-|\+|=|#|\.)*/g,ha=function(a,b,c,d,e){if("px"===d||!d)return c;if("auto"===d||!c)return 0;var f,g=fa.test(b),h=a,i=x.style,j=0>c;return j&&(c=-c),"%"===d&&-1!==b.indexOf("border")?f=c/100*(g?a.clientWidth:a.clientHeight):(i.cssText="border:0 solid red;position:"+ja(a,"position",!0)+";line-height:0;","%"!==d&&h.appendChild?i[g?"borderLeftWidth":"borderTopWidth"]=c+d:(h=a.parentNode||u.body,i[g?"width":"height"]=c+d),h.appendChild(x),f=parseFloat(x[g?"offsetWidth":"offsetHeight"]),h.removeChild(x),0!==f||e||(f=ha(a,b,c,d,!0))),j?-f:f},ia=function(a,b){if("absolute"!==ja(a,"position",!0))return 0;var c="left"===b?"Left":"Top",d=ja(a,"margin"+c,!0);
return f&&(e||d&&Ha.vars.suppressClickOnDrag!==!1)&&a.stopImmediatePropagation(),!c||Ha.pointerEvent&&Ha.pointerEvent.defaultPrevented||e&&i===h?void((Ha.isPressed||d||c)&&(f?i&&a.detail&&c&&!g||(a.preventDefault(),a.preventManipulation&&a.preventManipulation()):a.returnValue=!1)):(i&&e&&(wa=bb),void(va=bb))},vb=function(a){return ma?{x:a.x*ma[0]+a.y*ma[2]+ma[4],y:a.x*ma[1]+a.y*ma[3]+ma[5]}:{x:a.x,y:a.y}};da=Ua.get(this.target),da&&da.kill(),this.startDrag=function(a,b){var c,e,f,g;pb(a||Ha.pointerEvent,!0),b&&!Ha.hitTest(a||Ha.pointerEvent)&&(c=Ya(a||Ha.pointerEvent),e=Ya(d),f=vb({x:c.left+c.width/2,y:c.top+c.height/2}),g=vb({x:e.left+e.width/2,y:e.top+e.height/2}),j-=f.x-g.x,k-=f.y-g.y),Ha.isDragging||(Ha.isDragging=!0,ka(Ha,"dragstart","onDragStart"))},this.drag=qb,this.endDrag=function(a){sb(a||Ha.pointerEvent,!0)},this.timeSinceDrag=function(){return Ha.isDragging?0:(B()-Va)/1e3},this.timeSinceClick=function(){return(B()-bb)/1e3},this.hitTest=function(a,b){return Ua.hitTest(Ha.target,a,b)},this.getDirection=function(a,b){var c,d,e,f,h,i,j="velocity"===a&&g?a:"object"!=typeof a||za?"start":"element";return"element"===j&&(h=Ya(Ha.target),i=Ya(a)),c="start"===j?Ha.x-l:"velocity"===j?g.getVelocity(this.target,Aa):h.left+h.width/2-(i.left+i.width/2),za?0>c?"counter-clockwise":"clockwise":(b=b||2,d="start"===j?Ha.y-r:"velocity"===j?g.getVelocity(this.target,Ba):h.top+h.height/2-(i.top+i.height/2),e=Math.abs(c/d),f=1/b>e?"":0>c?"left":"right",b>e&&(""!==f&&(f+="-"),f+=0>d?"up":"down"),f)},this.applyBounds=function(a){var b,c,e,g,h,i;if(a&&f.bounds!==a)return f.bounds=a,Ha.update(!0);if(eb(!0),fb(),s){if(b=Ha.x,c=Ha.y,b>w?b=w:x>b&&(b=x),c>E?c=E:H>c&&(c=H),(Ha.x!==b||Ha.y!==c)&&(e=!0,Ha.x=Ha.endX=b,za?Ha.endRotation=b:Ha.y=Ha.endY=c,ba=!0,db(!0),Ha.autoScroll&&!Ha.isDragging))for($(d.parentNode),g=d,M.scrollTop=null!=window.pageYOffset?window.pageYOffset:null!=v.scrollTop?v.scrollTop:u.body.scrollTop,M.scrollLeft=null!=window.pageXOffset?window.pageXOffset:null!=v.scrollLeft?v.scrollLeft:u.body.scrollLeft;g&&!i;)i=Y(g.parentNode),h=i?M:g.parentNode,Fa&&h.scrollTop>h._gsMaxScrollY&&(h.scrollTop=h._gsMaxScrollY),Ea&&h.scrollLeft>h._gsMaxScrollX&&(h.scrollLeft=h._gsMaxScrollX),g=h;Ha.isThrowing&&(e||Ha.endX>w||Ha.endX<x||Ha.endY>E||Ha.endY<H)&&ib(f.throwProps,e)}return Ha},this.update=function(a,b,c){var e=Ha.x,f=Ha.y;return jb(!b),a?Ha.applyBounds():(ba&&c&&db(!0),eb(!0)),b&&(rb(Ha.pointerX,Ha.pointerY),ba&&db(!0)),Ha.isPressed&&!b&&(Ea&&Math.abs(e-Ha.x)>.01||Fa&&Math.abs(f-Ha.y)>.01&&!za)&&kb(),Ha.autoScroll&&($(d.parentNode),Wa=Ha.isDragging,db(!0)),Ha.autoScroll&&(X(d,tb),W(d,tb)),Ha},this.enable=function(a){var e,j,k;if("soft"!==a){for(j=Na.length;--j>-1;)k=Na[j],Ka(k,"mousedown",pb),Ka(k,"touchstart",pb),Ka(k,"click",ub,!0),za||f.cursor===!1||ca(k,"cursor",f.cursor||"move"),ca(k,"touchCallout","none"),ca(k,"touchAction",Ea===Fa?"none":Ea?"pan-y":"pan-x"),ua(k)&&ca(k.ownerSVGElement||k,"touchAction",Ea===Fa?"none":Ea?"pan-y":"pan-x"),this.vars.allowContextMenu||Ka(k,"contextmenu",cb);Ra(Na,!1)}return W(d,tb),h=!0,g&&"soft"!==a&&g.track(i||d,ya?"x,y":za?"rotation":"top,left"),i&&i.enable(),d._gsDragID=e="d"+G++,F[e]=this,i&&(i.element._gsDragID=e),b.set(d,{x:"+=0",overwrite:!1,data:"_draggable"}),qa={t:d,data:C?S:d._gsTransform,tween:{},setRatio:C?function(){b.set(d,P)}:c._internals.setTransformRatio||c._internals.set3DTransformRatio},kb(),Ha.update(!0),Ha},this.disable=function(a){var b,c,e=Ha.isDragging;if(!za)for(b=Na.length;--b>-1;)ca(Na[b],"cursor",null);if("soft"!==a){for(b=Na.length;--b>-1;)c=Na[b],ca(c,"touchCallout",null),ca(c,"touchAction",null),La(c,"mousedown",pb),La(c,"touchstart",pb),La(c,"click",ub),La(c,"contextmenu",cb);Ra(Na,!0),ia&&(La(ia,"touchcancel",sb),La(ia,"touchend",sb),La(ia,"touchmove",qb)),La(u,"mouseup",sb),La(u,"mousemove",qb)}return X(d,tb),h=!1,g&&"soft"!==a&&g.untrack(i||d,ya?"x,y":za?"rotation":"top,left"),i&&i.disable(),R(db),Ha.isDragging=Ha.isPressed=ha=!1,e&&ka(Ha,"dragend","onDragEnd"),Ha},this.enabled=function(a,b){return arguments.length?a?Ha.enable(b):Ha.disable(b):h},this.kill=fu