mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 12:22:03 +08:00
20 lines
823 KiB
JavaScript
20 lines
823 KiB
JavaScript
|
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)?o(r):r);if(s)for(const e in s)t[e]=s[e]}return t}if(S(e))return e}const r=/;(?![^(]*\))/g,s=/:(.+)/;function o(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 a(e){let t="";if(w(e))t=e;else if(_(e))for(let n=0;n<e.length;n++)t+=a(e[n])+" ";else if(S(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()]}:!S(t)||_(t)||C(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,M=e=>"symbol"==typeof e,S=e=>null!==e&&"object"==typeof e,T=e=>S(e)&&b(e.then)&&b(e.catch),E=Object.prototype.toString,A=e=>E.call(e),C=e=>"[object Object]"===A(e),L=e("key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),R=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},P=/-(\w)/g,N=R(e=>e.replace(P,(e,t)=>t?t.toUpperCase():"")),D=/\B([A-Z])/g,O=R(e=>e.replace(D,"-$1").toLowerCase()),I=R(e=>e.charAt(0).toUpperCase()+e.slice(1)),z=(e,t)=>e!==t&&(e==e||t==t),U=(e,t)=>{for(let n=0;n<e.length;n++)e[n](t)},B=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},F=new WeakMap,G=[];let k;const H=Symbol(""),V=Symbol("");function j(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)){X(n);try{return Z.push(Y),Y=!0,G.push(n),k=n,e()}finally{G.pop(),K(),k=G[G.length-1]}}};return n.id=q++,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&&(X(e),e.options.onStop&&e.options.onStop(),e.active=!1)}let q=0;function X(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let Y=!0;const Z=[];function J(){Z.push(Y),Y=!1}function K(){const e=Z.pop();Y=void 0===e||e}function Q(e,t,n){if(!Y||void 0===k)return;let i=F.get(e);i||F.set(e,i=new Map);let r=i.get(n);r||i.set(n,r=new Set),r.has(k)||(r.add(k),k.deps.push(r))}function $(e,t,n,i,r,s){const o=F.get(e);if(!o)return;const a=new Set,l=e=>{e&&e.forEach(e=>{e!==k&&a.add(e)})};if("clear"===t)o.forEach(l);else if("length"===n&&_(e))o.forEach((e,t)=>{("length"===t||t>=i)&&l(e)});else{void 0!==n&&l(o.get(n));const i="add"===t||"delete"===t&&!_(e);(i||"set"===t&&e instanceof Map)&&l(o.get(_(e)?"length":H)),i&&e instanceof Map&&l(o.get(V))}a.forEach(e=>{e.options.scheduler?e.options.scheduler(e):e()})}const ee=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(M)),te=oe(),ne=oe(!1,!0),ie=oe(!0),re=oe(!0,!0),se={};function oe(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?Ie:Oe).get(n))return n;const s=_(n);if(s&&x(se,i))return Reflect.get(se,i,r);const o=Reflect.get(n,i,r),a=M(i);if(a?ee.has(i):"__proto__"===i||"__v_isRef"===i)return o;if(e||Q(n,0,i),t)return o;if(je(o)){return!s||a||""+parseInt(i,10)!==i?o.value:o}return S(o)?e?Be(o):Ue(o):o}}["includes","indexOf","lastIndexOf"].forEach(e=>{se[e]=function(...t){const n=Ve(this);for(let e=0,t=this.length;e<t;e++)Q(n,0,e+"");const i=n[e](...t);return-1===i||!1===i?n[e](...t.map(Ve)):i}});function ae(e=!1){return function(t,n,i
|
||
|
/*!
|
||
|
* 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
|
||
|
*/var nm,im,rm,sm,om,am,lm,cm,hm,um,dm,pm,fm,mm,gm,vm,ym,xm,_m,bm,wm,Mm,Sm,Tm,Em,Am,Cm,Lm={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Rm={duration:.5,overwrite:!1,delay:0},Pm=1e8,Nm=2*Math.PI,Dm=Nm/4,Om=0,Im=Math.sqrt,zm=Math.cos,Um=Math.sin,Bm=function(e){return"string"==typeof e},Fm=function(e){return"function"==typeof e},Gm=function(e){return"number"==typeof e},km=function(e){return void 0===e},Hm=function(e){return"object"==typeof e},Vm=function(e){return!1!==e},jm=function(){return"undefined"!=typeof window},Wm=function(e){return Fm(e)||Bm(e)},qm="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Xm=Array.isArray,Ym=/(?:-?\.?\d|\.)+/gi,Zm=/[-+=.]*\d+[.e\-+]*\d*[e\-\+]*\d*/g,Jm=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Km=/[-+=.]*\d+(?:\.|e-|e)*\d*/gi,Qm=/[+-]=-?[\.\d]+/,$m=/[#\-+.]*\b[a-z\d-=+%.]+/gi,eg={},tg={},ng=function(e){return(tg=Cg(e,eg))&&cy},ig=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},rg=function(e,t){return!t&&console.warn(e)},sg=function(e,t){return e&&(eg[e]=t)&&tg&&(tg[e]=t)||eg},og=function(){return 0},ag={},lg=[],cg={},hg={},ug={},dg=30,pg=[],fg="",mg=function(e){var t,n,i=e[0];if(Hm(i)||Fm(i)||(e=[e]),!(t=(i._gsap||{}).harness)){for(n=pg.length;n--&&!pg[n].targetTest(i););t=pg[n]}for(n=e.length;n--;)e[n]&&(e[n]._gsap||(e[n]._gsap=new Ov(e[n],t)))||e.splice(n,1);return e},gg=function(e){return e._gsap||mg(ev(e))[0]._gsap},vg=function(e,t,n){return(n=e[t])&&Fm(n)?e[t]():km(n)&&e.getAttribute&&e.getAttribute(t)||n},yg=function(e,t){return(e=e.split(",")).forEach(t)||e},xg=function(e){return Math.round(1e5*e)/1e5||0},_g=function(e,t){for(var n=t.length,i=0;e.indexOf(t[i])<0&&++i<n;);return i<n},bg=function(e,t,n){var i,r=Gm(e[1]),s=(r?2:1)+(t<2?0:1),o=e[s];if(r&&(o.duration=e[1]),o.parent=n,t){for(i=o;n&&!("immediateRender"in i);)i=n.vars.defaults||{},n=Vm(n.vars.inherit)&&n.parent;o.immediateRender=Vm(i.immediateRender),t<2?o.runBackwards=1:o.startAt=e[s-1]}return o},wg=function(){var e,t,n=lg.length,i=lg.slice(0);for(cg={},lg.length=0,e=0;e<n;e++)(t=i[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},Mg=function(e,t,n,i){lg.length&&wg(),e.render(t,n,i),lg.length&&wg()},Sg=function(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match($m).length<2?t:Bm(e)?e.trim():e},Tg=function(e){return e},Eg=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},Ag=function(e,t){for(var n in t)n in e||"duration"===n||"ease"===n||(e[n]=t[n])},Cg=function(e,t){for(var n in t)e[n]=t[n];return e},Lg=function e(t,n){for(var i in n)t[i]=Hm(n[i])?e(t[i]||(t[i]={}),n[i]):n[i];return t},Rg=function(e,t){var n,i={};for(n in e)n in t||(i[n]=e[n]);return i},Pg=function(e){var t=e.parent||nm,n=e.keyframes?Ag:Eg;if(Vm(e.inherit))for(;t;)n(e,t.vars.defaults),t=t.parent||t._dp;return e},Ng=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},Dg=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove(e),e._act=0},Og=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},Ig=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},zg=function(e){return e._repeat?Ug(e._tTime,e=e.duration()+e._rDelay)*e:0},Ug=function(e,t){return(e/=t)&&~~e===e?~~e-1:~~e},Bg=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},Fg=function(e){return e._end=xg(e._start+(e._tDur/Math.abs(e._ts||e._rts||1e-8)||0))},Gg=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=xg(e._dp._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),Fg(e),n._dirty||Og(n,e)),e},kg=function(e,t){var n;if((t._time||t._initted&&!t._dur)&&(n=Bg(e.rawTime(),t),(!t._dur||Jg(0,t.totalDuration(),n)-t._tTime>1e-8)&&t.render(n,!0)),Og(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}
|
||
|
/*!
|
||
|
* 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
|
||
|
*/yg("padding,margin,Width,Radius",(function(e,t){var n="Top",i="Right",r="Bottom",s="Left",o=(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}));rx[t>1?"border"+e:e]=function(e,t,n,i,r){var s,a;if(arguments.length<4)return s=o.map((function(t){return ex(e,t,n)})),5===(a=s.join(" ")).split(s[0]).length?s[0]:a;s=(i+"").split(" "),a={},o.forEach((function(e,t){return a[e]=s[t]=s[t]||s[(t-1)/2|0]})),e.init(t,a,r)}}));var xx,_x,bx={name:"css",register:Wy,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,n,i,r){var s,o,a,l,c,h,u,d,p,f,m,g,v,y,x,_,b,w,M,S=this._props,T=e.style;for(u in py||Wy(),t)if("autoRound"!==u&&(o=t[u],!hg[u]||!Gv(u,t,n,i,e,r)))if(c=typeof o,h=rx[u],"function"===c&&(c=typeof(o=o.call(n,i,e,r))),"string"===c&&~o.indexOf("random(")&&(o=av(o)),h)h(this,e,u,o,n)&&(x=1);else if("--"===u.substr(0,2))this.add(T,"setProperty",getComputedStyle(e).getPropertyValue(u)+"",o+"",i,r,0,0,u);else if("undefined"!==c){if(s=ex(e,u),l=parseFloat(s),(f="string"===c&&"="===o.charAt(1)?+(o.charAt(0)+"1"):0)&&(o=o.substr(2)),a=parseFloat(o),u in Ey&&("autoAlpha"===u&&(1===l&&"hidden"===ex(e,"visibility")&&a&&(l=0),Ky(this,T,"visibility",l?"inherit":"hidden",a?"inherit":"hidden",!a)),"scale"!==u&&"transform"!==u&&~(u=Ey[u]).indexOf(",")&&(u=u.split(",")[0])),m=u in xy)if(g||((v=e._gsap).renderTransform||ux(e),y=!1!==t.smoothOrigin&&v.smooth,(g=this._pt=new sy(this._pt,T,Fy,0,1,v.renderTransform,v,0,-1)).dep=1),"scale"===u)this._pt=new sy(this._pt,v,"scaleY",v.scaleY,f?f*a:a-v.scaleY),S.push("scaleY",u),u+="X";else{if("transformOrigin"===u){b=void 0,w=void 0,M=void 0,b=(_=o).split(" "),w=b[0],M=b[1]||"50%","top"!==w&&"bottom"!==w&&"left"!==M&&"right"!==M||(_=w,w=M,M=_),b[0]=nx[w]||w,b[1]=nx[M]||M,o=b.join(" "),v.svg?hx(e,o,0,y,0,this):((p=parseFloat(o.split(" ")[2])||0)!==v.zOrigin&&Ky(this,v,"zOrigin",v.zOrigin,p),Ky(this,T,u,dx(s),dx(o)));continue}if("svgOrigin"===u){hx(e,o,1,y,0,this);continue}if(u in ox){vx(this,v,u,l,o,f);continue}if("smoothOrigin"===u){Ky(this,v,"smooth",v.smooth,o);continue}if("force3D"===u){v[u]=o;continue}if("transform"===u){yx(this,o,e);continue}}else u in T||(u=jy(u)||u);if(m||(a||0===a)&&(l||0===l)&&!Ty.test(o)&&u in T)a||(a=0),(d=(s+"").substr((l+"").length))!==(p=Kg(o)||(u in Lm.units?Lm.units[u]:d))&&(l=$y(e,u,s,p)),this._pt=new sy(this._pt,m?v:T,u,l,f?f*a:a-l,"px"!==p||!1===t.autoRound||m?Ay:Ry),this._pt.u=p||0,d!==p&&(this._pt.b=s,this._pt.r=Ly);else if(u in T)tx.call(this,e,u,s,o);else{if(!(u in e)){ig(u,o);continue}this.add(e,u,e[u],o,i,r)}S.push(u)}x&&ry(this)},get:ex,aliases:Ey,getSetter:function(e,t,n){var i=Ey[t];return i&&i.indexOf(",")<0&&(t=i),t in xy&&t!==Gy&&(e._gsap.x||ex(e,"x"))?n&&gy===n?"scale"===t?zy:Iy:(gy=n||{})&&("scale"===t?Uy:By):e.style&&!km(e.style[t])?Dy:~t.indexOf("-")?Oy:Jv(e,t)},core:{_removeProperty:Jy,_getMatrix:cx}};cy.utils.checkPrefix=jy,_x=yg("x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+(xx="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",(function(e){xy[e]=1})),yg(xx,(function(e){Lm.units[e]="deg",ox[e]=1})),Ey[_x[13]]="x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+xx,yg("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",(function(e){var t=e.split(":");Ey[t[1]]=_x[t[0]]})),yg("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",(function(e){Lm.units[e]="px"})),cy.registerPlugin(bx);var wx=cy.registerPlugin(bx)||cy;wx.core.Tween;class Mx{constructor(e){Object.entries(e).forEach(([e,t])=>{this[e]=t}),this.o3d=new Xr,this.uProgress={value:0},this.uvScale=new Bi,this.initMaterial(),this.initPlane()}initMaterial(){this.material=new xs({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
|