1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00
trois/docs/index.52f7a901.js

20 lines
954 KiB
JavaScript
Raw Normal View History

2020-10-08 05:52:53 +08:00
function e(e,t){const n=Object.create(null),i=e.split(",");for(let e=0;e<i.length;e++)n[i[e]]=!0;return t?e=>!!n[e.toLowerCase()]:e=>!!n[e]}const t=e("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl"),n=e("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function i(e){if(_(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=i(w(r)?a(r):r);if(s)for(const e in s)t[e]=s[e]}return t}if(M(e))return e}const r=/;(?![^(]*\))/g,s=/:(.+)/;function a(e){const t={};return e.split(r).forEach(e=>{if(e){const n=e.split(s);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function o(e){let t="";if(w(e))t=e;else if(_(e))for(let n=0;n<e.length;n++)t+=o(e[n])+" ";else if(M(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const l=(e,t)=>t instanceof Map?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n])=>(e[t+" =>"]=n,e),{})}:t instanceof Set?{[`Set(${t.size})`]:[...t.values()]}:!M(t)||_(t)||P(t)?t:String(t),c={},h=[],u=()=>{},d=()=>!1,p=/^on[^a-z]/,f=e=>p.test(e),m=e=>e.startsWith("onUpdate:"),g=Object.assign,v=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},y=Object.prototype.hasOwnProperty,x=(e,t)=>y.call(e,t),_=Array.isArray,b=e=>"function"==typeof e,w=e=>"string"==typeof e,S=e=>"symbol"==typeof e,M=e=>null!==e&&"object"==typeof e,T=e=>M(e)&&b(e.then)&&b(e.catch),A=Object.prototype.toString,E=e=>A.call(e),P=e=>"[object Object]"===E(e),L=e("key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),C=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},N=/-(\w)/g,R=C(e=>e.replace(N,(e,t)=>t?t.toUpperCase():"")),F=/\B([A-Z])/g,I=C(e=>e.replace(F,"-$1").toLowerCase()),O=C(e=>e.charAt(0).toUpperCase()+e.slice(1)),D=(e,t)=>e!==t&&(e==e||t==t),U=(e,t)=>{for(let n=0;n<e.length;n++)e[n](t)},z=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},B=new WeakMap,G=[];let H;const k=Symbol(""),j=Symbol("");function V(e,t=c){(function(e){return e&&!0===e._isEffect})(e)&&(e=e.raw);const n=function(e,t){const n=function(){if(!n.active)return t.scheduler?void 0:e();if(!G.includes(n)){Y(n);try{return Q.push(q),q=!0,G.push(n),H=n,e()}finally{G.pop(),J(),H=G[G.length-1]}}};return n.id=X++,n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}(e,t);return t.lazy||n(),n}function W(e){e.active&&(Y(e),e.options.onStop&&e.options.onStop(),e.active=!1)}let X=0;function Y(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let q=!0;const Q=[];function Z(){Q.push(q),q=!1}function J(){const e=Q.pop();q=void 0===e||e}function K(e,t,n){if(!q||void 0===H)return;let i=B.get(e);i||B.set(e,i=new Map);let r=i.get(n);r||i.set(n,r=new Set),r.has(H)||(r.add(H),H.deps.push(r))}function $(e,t,n,i,r,s){const a=B.get(e);if(!a)return;const o=new Set,l=e=>{e&&e.forEach(e=>{e!==H&&o.add(e)})};if("clear"===t)a.forEach(l);else if("length"===n&&_(e))a.forEach((e,t)=>{("length"===t||t>=i)&&l(e)});else{void 0!==n&&l(a.get(n));const i="add"===t||"delete"===t&&!_(e);(i||"set"===t&&e instanceof Map)&&l(a.get(_(e)?"length":k)),i&&e instanceof Map&&l(a.get(j))}o.forEach(e=>{e.options.scheduler?e.options.scheduler(e):e()})}const ee=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(S)),te=ae(),ne=ae(!1,!0),ie=ae(!0),re=ae(!0,!0),se={};function ae(e=!1,t=!1){return function(n,i,r){if("__v_isReactive"===i)return!e;if("__v_isReadonly"===i)return e;if("__v_raw"===i&&r===(e?Oe:Ie).get(n))return n;const s=_(n);if(s&&x(se,i))return Reflect.get(se,i,r);const a=Reflect.get(n,i,r),o=S(i);if(o?ee.has(i):"__proto__"===i||"__v_isRef"===i)return a;if(e||K(n,0,i),t)return a;if(Ve(a)){return!s||o||""+parseInt(i,10)!==i?a.value:a}return M(a)?e?ze(a):Ue(a):a}}["includes","indexOf","lastIndexOf"].forEach(e=>{se[e]=function(...t){const n=je(this);for(let e=0,t=this.length;e<t;e++)K(n,0,e+"");const i=n[e](...t);return-1===i||!1===i?n[e](...t.map(je)):i}});function oe(e=!1){return function(t,n,i
2020-10-04 04:13:59 +08:00
/*!
* GSAP 3.5.1
* https://greensock.com
*
* @license Copyright 2008-2020, GreenSock. All rights reserved.
* Subject to the terms at https://greensock.com/standard-license or for
* Club GreenSock members, the agreement issued with that membership.
* @author: Jack Doyle, jack@greensock.com
2020-10-08 05:52:53 +08:00
*/var Em,Pm,Lm,Cm,Nm,Rm,Fm,Im,Om,Dm,Um,zm,Bm,Gm,Hm,km,jm,Vm,Wm,Xm,Ym,qm,Qm,Zm,Jm,Km,$m,eg={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},tg={duration:.5,overwrite:!1,delay:0},ng=1e8,ig=2*Math.PI,rg=ig/4,sg=0,ag=Math.sqrt,og=Math.cos,lg=Math.sin,cg=function(e){return"string"==typeof e},hg=function(e){return"function"==typeof e},ug=function(e){return"number"==typeof e},dg=function(e){return void 0===e},pg=function(e){return"object"==typeof e},fg=function(e){return!1!==e},mg=function(){return"undefined"!=typeof window},gg=function(e){return hg(e)||cg(e)},vg="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},yg=Array.isArray,xg=/(?:-?\.?\d|\.)+/gi,_g=/[-+=.]*\d+[.e\-+]*\d*[e\-\+]*\d*/g,bg=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,wg=/[-+=.]*\d+(?:\.|e-|e)*\d*/gi,Sg=/[+-]=-?[\.\d]+/,Mg=/[#\-+.]*\b[a-z\d-=+%.]+/gi,Tg={},Ag={},Eg=function(e){return(Ag=$g(e,Tg))&&Iy},Pg=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Lg=function(e,t){return!t&&console.warn(e)},Cg=function(e,t){return e&&(Tg[e]=t)&&Ag&&(Ag[e]=t)||Tg},Ng=function(){return 0},Rg={},Fg=[],Ig={},Og={},Dg={},Ug=30,zg=[],Bg="",Gg=function(e){var t,n,i=e[0];if(pg(i)||hg(i)||(e=[e]),!(t=(i._gsap||{}).harness)){for(n=zg.length;n--&&!zg[n].targetTest(i););t=zg[n]}for(n=e.length;n--;)e[n]&&(e[n]._gsap||(e[n]._gsap=new sy(e[n],t)))||e.splice(n,1);return e},Hg=function(e){return e._gsap||Gg(Tv(e))[0]._gsap},kg=function(e,t,n){return(n=e[t])&&hg(n)?e[t]():dg(n)&&e.getAttribute&&e.getAttribute(t)||n},jg=function(e,t){return(e=e.split(",")).forEach(t)||e},Vg=function(e){return Math.round(1e5*e)/1e5||0},Wg=function(e,t){for(var n=t.length,i=0;e.indexOf(t[i])<0&&++i<n;);return i<n},Xg=function(e,t,n){var i,r=ug(e[1]),s=(r?2:1)+(t<2?0:1),a=e[s];if(r&&(a.duration=e[1]),a.parent=n,t){for(i=a;n&&!("immediateRender"in i);)i=n.vars.defaults||{},n=fg(n.vars.inherit)&&n.parent;a.immediateRender=fg(i.immediateRender),t<2?a.runBackwards=1:a.startAt=e[s-1]}return a},Yg=function(){var e,t,n=Fg.length,i=Fg.slice(0);for(Ig={},Fg.length=0,e=0;e<n;e++)(t=i[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},qg=function(e,t,n,i){Fg.length&&Yg(),e.render(t,n,i),Fg.length&&Yg()},Qg=function(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(Mg).length<2?t:cg(e)?e.trim():e},Zg=function(e){return e},Jg=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},Kg=function(e,t){for(var n in t)n in e||"duration"===n||"ease"===n||(e[n]=t[n])},$g=function(e,t){for(var n in t)e[n]=t[n];return e},ev=function e(t,n){for(var i in n)t[i]=pg(n[i])?e(t[i]||(t[i]={}),n[i]):n[i];return t},tv=function(e,t){var n,i={};for(n in e)n in t||(i[n]=e[n]);return i},nv=function(e){var t=e.parent||Em,n=e.keyframes?Kg:Jg;if(fg(e.inherit))for(;t;)n(e,t.vars.defaults),t=t.parent||t._dp;return e},iv=function(e,t,n,i){void 0===n&&(n="_first"),void 0===i&&(i="_last");var r=t._prev,s=t._next;r?r._next=s:e[n]===t&&(e[n]=s),s?s._prev=r:e[i]===t&&(e[i]=r),t._next=t._prev=t.parent=null},rv=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove(e),e._act=0},sv=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var n=e;n;)n._dirty=1,n=n.parent;return e},av=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},ov=function(e){return e._repeat?lv(e._tTime,e=e.duration()+e._rDelay)*e:0},lv=function(e,t){return(e/=t)&&~~e===e?~~e-1:~~e},cv=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},hv=function(e){return e._end=Vg(e._start+(e._tDur/Math.abs(e._ts||e._rts||1e-8)||0))},uv=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=Vg(e._dp._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),hv(e),n._dirty||sv(n,e)),e},dv=function(e,t){var n;if((t._time||t._initted&&!t._dur)&&(n=cv(e.rawTime(),t),(!t._dur||bv(0,t.totalDuration(),n)-t._tTime>1e-8)&&t.render(n,!0)),sv(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(n=e;n._dp;)n.rawTime()>=0&&n.totalTime(n._tTime),n=n._dp;e._zTime=-1e-8}
2020-10-04 04:13:59 +08:00
/*!
* CSSPlugin 3.5.1
* https://greensock.com
*
* Copyright 2008-2020, GreenSock. All rights reserved.
* Subject to the terms at https://greensock.com/standard-license or for
* Club GreenSock members, the agreement issued with that membership.
* @author: Jack Doyle, jack@greensock.com
2020-10-08 05:52:53 +08:00
*/jg("padding,margin,Width,Radius",(function(e,t){var n="Top",i="Right",r="Bottom",s="Left",a=(t<3?[n,i,r,s]:[n+s,n+i,r+i,r+s]).map((function(n){return t<2?e+n:"border"+n+e}));Lx[t>1?"border"+e:e]=function(e,t,n,i,r){var s,o;if(arguments.length<4)return s=a.map((function(t){return Tx(e,t,n)})),5===(o=s.join(" ")).split(s[0]).length?s[0]:o;s=(i+"").split(" "),o={},a.forEach((function(e,t){return o[e]=s[t]=s[t]||s[(t-1)/2|0]})),e.init(t,o,r)}}));var Vx,Wx,Xx={name:"css",register:gx,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,n,i,r){var s,a,o,l,c,h,u,d,p,f,m,g,v,y,x,_,b,w,S,M=this._props,T=e.style;for(u in zy||gx(),t)if("autoRound"!==u&&(a=t[u],!Og[u]||!uy(u,t,n,i,e,r)))if(c=typeof a,h=Lx[u],"function"===c&&(c=typeof(a=a.call(n,i,e,r))),"string"===c&&~a.indexOf("random(")&&(a=Rv(a)),h)h(this,e,u,a,n)&&(x=1);else if("--"===u.substr(0,2))this.add(T,"setProperty",getComputedStyle(e).getPropertyValue(u)+"",a+"",i,r,0,0,u);else if("undefined"!==c){if(s=Tx(e,u),l=parseFloat(s),(f="string"===c&&"="===a.charAt(1)?+(a.charAt(0)+"1"):0)&&(a=a.substr(2)),o=parseFloat(a),u in Jy&&("autoAlpha"===u&&(1===l&&"hidden"===Tx(e,"visibility")&&o&&(l=0),wx(this,T,"visibility",l?"inherit":"hidden",o?"inherit":"hidden",!o)),"scale"!==u&&"transform"!==u&&~(u=Jy[u]).indexOf(",")&&(u=u.split(",")[0])),m=u in Vy)if(g||((v=e._gsap).renderTransform||Dx(e),y=!1!==t.smoothOrigin&&v.smooth,(g=this._pt=new Cy(this._pt,T,hx,0,1,v.renderTransform,v,0,-1)).dep=1),"scale"===u)this._pt=new Cy(this._pt,v,"scaleY",v.scaleY,f?f*o:o-v.scaleY),M.push("scaleY",u),u+="X";else{if("transformOrigin"===u){b=void 0,w=void 0,S=void 0,b=(_=a).split(" "),w=b[0],S=b[1]||"50%","top"!==w&&"bottom"!==w&&"left"!==S&&"right"!==S||(_=w,w=S,S=_),b[0]=Ex[w]||w,b[1]=Ex[S]||S,a=b.join(" "),v.svg?Ox(e,a,0,y,0,this):((p=parseFloat(a.split(" ")[2])||0)!==v.zOrigin&&wx(this,v,"zOrigin",v.zOrigin,p),wx(this,T,u,Ux(s),Ux(a)));continue}if("svgOrigin"===u){Ox(e,a,1,y,0,this);continue}if(u in Nx){kx(this,v,u,l,a,f);continue}if("smoothOrigin"===u){wx(this,v,"smooth",v.smooth,a);continue}if("force3D"===u){v[u]=a;continue}if("transform"===u){jx(this,a,e);continue}}else u in T||(u=mx(u)||u);if(m||(o||0===o)&&(l||0===l)&&!Zy.test(a)&&u in T)o||(o=0),(d=(s+"").substr((l+"").length))!==(p=wv(a)||(u in eg.units?eg.units[u]:d))&&(l=Mx(e,u,s,p)),this._pt=new Cy(this._pt,m?v:T,u,l,f?f*o:o-l,"px"!==p||!1===t.autoRound||m?Ky:tx),this._pt.u=p||0,d!==p&&(this._pt.b=s,this._pt.r=ex);else if(u in T)Ax.call(this,e,u,s,a);else{if(!(u in e)){Pg(u,a);continue}this.add(e,u,e[u],a,i,r)}M.push(u)}x&&Ly(this)},get:Tx,aliases:Jy,getSetter:function(e,t,n){var i=Jy[t];return i&&i.indexOf(",")<0&&(t=i),t in Vy&&t!==ux&&(e._gsap.x||Tx(e,"x"))?n&&Hy===n?"scale"===t?ox:ax:(Hy=n||{})&&("scale"===t?lx:cx):e.style&&!dg(e.style[t])?rx:~t.indexOf("-")?sx:by(e,t)},core:{_removeProperty:bx,_getMatrix:Ix}};Iy.utils.checkPrefix=mx,Wx=jg("x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+(Vx="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",(function(e){Vy[e]=1})),jg(Vx,(function(e){eg.units[e]="deg",Nx[e]=1})),Jy[Wx[13]]="x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+Vx,jg("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",(function(e){var t=e.split(":");Jy[t[1]]=Wx[t[0]]})),jg("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",(function(e){eg.units[e]="px"})),Iy.registerPlugin(Xx);var Yx=Iy.registerPlugin(Xx)||Iy;Yx.core.Tween;class qx{constructor(e){Object.entries(e).forEach(([e,t])=>{this[e]=t}),this.o3d=new qr,this.uProgress={value:0},this.uvScale=new Bi,this.initMaterial(),this.initPlane()}initMaterial(){this.material=new _s({side:2,transparent:!0,map:this.texture,onBeforeCompile:e=>{e.uniforms.progress=this.uProgress,e.uniforms.uvScale={value:this.uvScale},e.vertexShader="\n uniform float progress;\n uniform vec2 uvScale;\n\n attribute vec3 offset;\n attribute vec3 rotation;\n attribute vec2 uvOffset;\n\n mat3 ro