three-earth-3d 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,7 @@ var uc = Object.defineProperty;
|
|
|
2
2
|
var fc = (n, A, t) => A in n ? uc(n, A, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[A] = t;
|
|
3
3
|
var L = (n, A, t) => fc(n, typeof A != "symbol" ? A + "" : A, t);
|
|
4
4
|
import * as mn from "three";
|
|
5
|
-
import { EventDispatcher as hc, Vector3 as X, MOUSE as je, TOUCH as $e, Spherical as Es, Quaternion as Gr, Vector2 as qA, LoadingManager as gc, TextureLoader as qa,
|
|
5
|
+
import { EventDispatcher as hc, Vector3 as X, MOUSE as je, TOUCH as $e, Spherical as Es, Quaternion as Gr, Vector2 as qA, LoadingManager as gc, TextureLoader as qa, PlaneGeometry as Ri, Mesh as ue, MeshBasicMaterial as Pe, DoubleSide as ja, Group as Lt, CatmullRomCurve3 as wc, TubeGeometry as Qc, BufferGeometry as Pi, ArcCurve as $a, LineBasicMaterial as dc, Line as Cc, BufferAttribute as Nr, Color as ft, PointsMaterial as Ai, Points as ei, SphereGeometry as At, ShaderMaterial as vs, SpriteMaterial as Hs, Sprite as ys, NormalBlending as Uc } from "three";
|
|
6
6
|
const Is = { type: "change" }, En = { type: "start" }, _s = { type: "end" };
|
|
7
7
|
class Fc extends hc {
|
|
8
8
|
constructor(A, t) {
|
|
@@ -7810,13 +7810,11 @@ class IQ {
|
|
|
7810
7810
|
new At(this.options.satellite.size, 32, 32),
|
|
7811
7811
|
new Pe({
|
|
7812
7812
|
color: "#e0b187"
|
|
7813
|
-
// 745F4D
|
|
7814
7813
|
})
|
|
7815
7814
|
), a = new ue(
|
|
7816
7815
|
new At(this.options.satellite.size, 32, 32),
|
|
7817
7816
|
new Pe({
|
|
7818
7817
|
color: "#628fbb"
|
|
7819
|
-
// 324A62
|
|
7820
7818
|
})
|
|
7821
7819
|
), o = new ue(
|
|
7822
7820
|
new At(this.options.satellite.size, 32, 32),
|
|
@@ -51,7 +51,7 @@ void main(void){
|
|
|
51
51
|
gl_FragColor = mix(gl_FragColor, vec4( glowColor, 1.0 ), a);
|
|
52
52
|
float b = 0.8;
|
|
53
53
|
gl_FragColor = gl_FragColor + texture2D( map, vUv );
|
|
54
|
-
}`;const ot=(n,A,t)=>{let e=A*Math.PI/180;const r=t*Math.PI/180;e=-e;const i=n*Math.cos(r)*Math.cos(e),s=n*Math.sin(r),a=n*Math.cos(r)*Math.sin(e);return new m.Vector3(i,s,a)},so=n=>{const A=new m.
|
|
54
|
+
}`;const ot=(n,A,t)=>{let e=A*Math.PI/180;const r=t*Math.PI/180;e=-e;const i=n*Math.cos(r)*Math.cos(e),s=n*Math.sin(r),a=n*Math.cos(r)*Math.sin(e);return new m.Vector3(i,s,a)},so=n=>{const A=new m.PlaneGeometry(1,1),t=n.textures.aperture,e=new m.MeshBasicMaterial({color:15310696,map:t,transparent:!0,opacity:1,depthWrite:!1}),r=new m.Mesh(A,e),i=ot(n.radius*1.001,n.lon,n.lat),s=n.radius*.12;r.scale.set(s,s,s),r.userData.size=s,r.userData.scale=Math.random()*1,r.position.set(i.x,i.y,i.z);const a=new m.Vector3(i.x,i.y,i.z).normalize(),o=new m.Vector3(0,0,1);return r.quaternion.setFromUnitVectors(o,a),r},ao=n=>{const A=n.radius*.3,t=new m.PlaneGeometry(n.radius*.05,A);t.rotateX(Math.PI/2),t.translate(0,0,A/2);const e=new m.MeshBasicMaterial({map:n.textures.light_column,color:n.index==0?n.punctuation.lightColumn.startColor:n.punctuation.lightColumn.endColor,transparent:!0,side:m.DoubleSide,depthWrite:!1}),r=new m.Mesh(t,e),i=new m.Group;i.add(r,r.clone().rotateZ(Math.PI/2));const s=ot(n.radius,n.lon,n.lat);i.position.set(s.x,s.y,s.z);const a=new m.Vector3(s.x,s.y,s.z).normalize(),o=new m.Vector3(0,0,1);return i.quaternion.setFromUnitVectors(o,a),i},oo=n=>{const A=new m.PlaneGeometry(1,1),t=new m.Mesh(A,n.material),e=ot(n.radius*1.001,n.lon,n.lat),r=n.radius*.05;t.scale.set(r,r,r),t.position.set(e.x,e.y,e.z);const i=new m.Vector3(e.x,e.y,e.z).normalize(),s=new m.Vector3(0,0,1);return t.quaternion.setFromUnitVectors(s,i),t},Ug=n=>{const A=[];for(let t=0;t<2*Math.PI-.1;t+=2*Math.PI/n.number)A.push([parseFloat((Math.cos(t)*(n.radius||10)).toFixed(2)),0,parseFloat((Math.sin(t)*(n.radius||10)).toFixed(2))]);return A.push(A[0]),A},Fg=n=>{const A=[];n.pointList.forEach(r=>A.push(new m.Vector3(r[0],r[1],r[2])));const t=new m.CatmullRomCurve3(A),e=new m.TubeGeometry(t,n.number||50,n.radius||1,n.radialSegments);return new m.Mesh(e,n.material)};function Be(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Bo(n,A){n.prototype=Object.create(A.prototype),n.prototype.constructor=n,n.__proto__=A}/*!
|
|
55
55
|
* GSAP 3.14.2
|
|
56
56
|
* https://gsap.com
|
|
57
57
|
*
|
|
@@ -67,6 +67,6 @@ void main(void){
|
|
|
67
67
|
* @author: Jack Doyle, jack@greensock.com
|
|
68
68
|
*/var iB,be,Qt,Ri,ke,sB,ki,Qw=function(){return typeof window<"u"},le={},Xe=180/Math.PI,dt=Math.PI/180,Ct=Math.atan2,aB=1e8,Xi=/([A-Z])/g,dw=/(left|right|width|margin|padding|x)/i,Cw=/[\s,\(]\S/,ne={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Yi=function(A,t){return t.set(t.t,t.p,Math.round((t.s+t.c*A)*1e4)/1e4+t.u,t)},Uw=function(A,t){return t.set(t.t,t.p,A===1?t.e:Math.round((t.s+t.c*A)*1e4)/1e4+t.u,t)},Fw=function(A,t){return t.set(t.t,t.p,A?Math.round((t.s+t.c*A)*1e4)/1e4+t.u:t.b,t)},pw=function(A,t){return t.set(t.t,t.p,A===1?t.e:A?Math.round((t.s+t.c*A)*1e4)/1e4+t.u:t.b,t)},mw=function(A,t){var e=t.s+t.c*A;t.set(t.t,t.p,~~(e+(e<0?-.5:.5))+t.u,t)},oB=function(A,t){return t.set(t.t,t.p,A?t.e:t.b,t)},BB=function(A,t){return t.set(t.t,t.p,A!==1?t.b:t.e,t)},vw=function(A,t,e){return A.style[t]=e},Ew=function(A,t,e){return A.style.setProperty(t,e)},yw=function(A,t,e){return A._gsap[t]=e},Hw=function(A,t,e){return A._gsap.scaleX=A._gsap.scaleY=e},Iw=function(A,t,e,r,i){var s=A._gsap;s.scaleX=s.scaleY=e,s.renderTransform(i,s)},_w=function(A,t,e,r,i){var s=A._gsap;s[t]=e,s.renderTransform(i,s)},j="transform",bA=j+"Origin",bw=function n(A,t){var e=this,r=this.target,i=r.style,s=r._gsap;if(A in le&&i){if(this.tfm=this.tfm||{},A!=="transform")A=ne[A]||A,~A.indexOf(",")?A.split(",").forEach(function(a){return e.tfm[a]=ue(r,a)}):this.tfm[A]=s.x?s[A]:ue(r,A),A===bA&&(this.tfm.zOrigin=s.zOrigin);else return ne.transform.split(",").forEach(function(a){return n.call(e,a,t)});if(this.props.indexOf(j)>=0)return;s.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push(bA,t,"")),A=j}(i||t)&&this.props.push(A,t,i[A])},cB=function(A){A.translate&&(A.removeProperty("translate"),A.removeProperty("scale"),A.removeProperty("rotate"))},xw=function(){var A=this.props,t=this.target,e=t.style,r=t._gsap,i,s;for(i=0;i<A.length;i+=3)A[i+1]?A[i+1]===2?t[A[i]](A[i+2]):t[A[i]]=A[i+2]:A[i+2]?e[A[i]]=A[i+2]:e.removeProperty(A[i].substr(0,2)==="--"?A[i]:A[i].replace(Xi,"-$1").toLowerCase());if(this.tfm){for(s in this.tfm)r[s]=this.tfm[s];r.svg&&(r.renderTransform(),t.setAttribute("data-svg-origin",this.svgo||"")),i=ki(),(!i||!i.isStart)&&!e[j]&&(cB(e),r.zOrigin&&e[bA]&&(e[bA]+=" "+r.zOrigin+"px",r.zOrigin=0,r.renderTransform()),r.uncache=1)}},lB=function(A,t){var e={target:A,props:[],revert:xw,save:bw};return A._gsap||_A.core.getCache(A),t&&A.style&&A.nodeType&&t.split(",").forEach(function(r){return e.save(r)}),e},uB,Ji=function(A,t){var e=be.createElementNS?be.createElementNS((t||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),A):be.createElement(A);return e&&e.style?e:be.createElement(A)},PA=function n(A,t,e){var r=getComputedStyle(A);return r[t]||r.getPropertyValue(t.replace(Xi,"-$1").toLowerCase())||r.getPropertyValue(t)||!e&&n(A,Ut(t)||t,1)||""},fB="O,Moz,ms,Ms,Webkit".split(","),Ut=function(A,t,e){var r=t||ke,i=r.style,s=5;if(A in i&&!e)return A;for(A=A.charAt(0).toUpperCase()+A.substr(1);s--&&!(fB[s]+A in i););return s<0?null:(s===3?"ms":s>=0?fB[s]:"")+A},Wi=function(){Qw()&&window.document&&(iB=window,be=iB.document,Qt=be.documentElement,ke=Ji("div")||{style:{}},Ji("div"),j=Ut(j),bA=j+"Origin",ke.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",uB=!!Ut("perspective"),ki=_A.core.reverting,Ri=1)},hB=function(A){var t=A.ownerSVGElement,e=Ji("svg",t&&t.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=A.cloneNode(!0),i;r.style.display="block",e.appendChild(r),Qt.appendChild(e);try{i=r.getBBox()}catch{}return e.removeChild(r),Qt.removeChild(e),i},gB=function(A,t){for(var e=t.length;e--;)if(A.hasAttribute(t[e]))return A.getAttribute(t[e])},wB=function(A){var t,e;try{t=A.getBBox()}catch{t=hB(A),e=1}return t&&(t.width||t.height)||e||(t=hB(A)),t&&!t.width&&!t.x&&!t.y?{x:+gB(A,["x","cx","x1"])||0,y:+gB(A,["y","cy","y1"])||0,width:0,height:0}:t},QB=function(A){return!!(A.getCTM&&(!A.parentNode||A.ownerSVGElement)&&wB(A))},xe=function(A,t){if(t){var e=A.style,r;t in le&&t!==bA&&(t=j),e.removeProperty?(r=t.substr(0,2),(r==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),e.removeProperty(r==="--"?t:t.replace(Xi,"-$1").toLowerCase())):e.removeAttribute(t)}},Le=function(A,t,e,r,i,s){var a=new IA(A._pt,t,e,0,1,s?BB:oB);return A._pt=a,a.b=r,a.e=i,A._props.push(e),a},dB={deg:1,rad:1,turn:1},Lw={grid:1,flex:1},Ke=function n(A,t,e,r){var i=parseFloat(e)||0,s=(e+"").trim().substr((i+"").length)||"px",a=ke.style,o=dw.test(t),B=A.tagName.toLowerCase()==="svg",c=(B?"client":"offset")+(o?"Width":"Height"),l=100,u=r==="px",h=r==="%",g,f,w,C;if(r===s||!i||dB[r]||dB[s])return i;if(s!=="px"&&!u&&(i=n(A,t,e,"px")),C=A.getCTM&&QB(A),(h||s==="%")&&(le[t]||~t.indexOf("adius")))return g=C?A.getBBox()[o?"width":"height"]:A[c],tA(h?i/g*l:i/100*g);if(a[o?"width":"height"]=l+(u?s:r),f=r!=="rem"&&~t.indexOf("adius")||r==="em"&&A.appendChild&&!B?A:A.parentNode,C&&(f=(A.ownerSVGElement||{}).parentNode),(!f||f===be||!f.appendChild)&&(f=be.body),w=f._gsap,w&&h&&w.width&&o&&w.time===GA.time&&!w.uncache)return tA(i/w.width*l);if(h&&(t==="height"||t==="width")){var d=A.style[t];A.style[t]=l+r,g=A[c],d?A.style[t]=d:xe(A,t)}else(h||s==="%")&&!Lw[PA(f,"display")]&&(a.position=PA(A,"position")),f===A&&(a.position="static"),f.appendChild(ke),g=ke[c],f.removeChild(ke),a.position="absolute";return o&&h&&(w=Ge(f),w.time=GA.time,w.width=f[c]),tA(u?g*i/l:g&&i?l/g*i:0)},ue=function(A,t,e,r){var i;return Ri||Wi(),t in ne&&t!=="transform"&&(t=ne[t],~t.indexOf(",")&&(t=t.split(",")[0])),le[t]&&t!=="transform"?(i=er(A,r),i=t!=="transformOrigin"?i[t]:i.svg?i.origin:cn(PA(A,bA))+" "+i.zOrigin+"px"):(i=A.style[t],(!i||i==="auto"||r||~(i+"").indexOf("calc("))&&(i=Bn[t]&&Bn[t](A,t,e)||PA(A,t)||Fo(A,t)||(t==="opacity"?1:0))),e&&!~(i+"").trim().indexOf(" ")?Ke(A,t,i,e)+e:i},Kw=function(A,t,e,r){if(!e||e==="none"){var i=Ut(t,A,1),s=i&&PA(A,i,1);s&&s!==e?(t=i,e=s):t==="borderColor"&&(e=PA(A,"borderTopColor"))}var a=new IA(this._pt,A.style,t,0,1,eB),o=0,B=0,c,l,u,h,g,f,w,C,d,E,v,Q;if(a.b=e,a.e=r,e+="",r+="",r.substring(0,6)==="var(--"&&(r=PA(A,r.substring(4,r.indexOf(")")))),r==="auto"&&(f=A.style[t],A.style[t]=r,r=PA(A,t)||r,f?A.style[t]=f:xe(A,t)),c=[e,r],Xo(c),e=c[0],r=c[1],u=e.match(ct)||[],Q=r.match(ct)||[],Q.length){for(;l=ct.exec(r);)w=l[0],d=r.substring(o,l.index),g?g=(g+1)%5:(d.substr(-5)==="rgba("||d.substr(-5)==="hsla(")&&(g=1),w!==(f=u[B++]||"")&&(h=parseFloat(f)||0,v=f.substr((h+"").length),w.charAt(1)==="="&&(w=lt(h,w)+v),C=parseFloat(w),E=w.substr((C+"").length),o=ct.lastIndex-E.length,E||(E=E||SA.units[t]||v,o===r.length&&(r+=E,a.e+=E)),v!==E&&(h=Ke(A,t,f,E)||0),a._pt={_next:a._pt,p:d||B===1?d:",",s:h,c:C-h,m:g&&g<4||t==="zIndex"?Math.round:0});a.c=o<r.length?r.substring(o,r.length):""}else a.r=t==="display"&&r==="none"?BB:oB;return ho.test(r)&&(a.e=0),this._pt=a,a},CB={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},Sw=function(A){var t=A.split(" "),e=t[0],r=t[1]||"50%";return(e==="top"||e==="bottom"||r==="left"||r==="right")&&(A=e,e=r,r=A),t[0]=CB[e]||e,t[1]=CB[r]||r,t.join(" ")},Dw=function(A,t){if(t.tween&&t.tween._time===t.tween._dur){var e=t.t,r=e.style,i=t.u,s=e._gsap,a,o,B;if(i==="all"||i===!0)r.cssText="",o=1;else for(i=i.split(","),B=i.length;--B>-1;)a=i[B],le[a]&&(o=1,a=a==="transformOrigin"?bA:j),xe(e,a);o&&(xe(e,j),s&&(s.svg&&e.removeAttribute("transform"),r.scale=r.rotate=r.translate="none",er(e,1),s.uncache=1,cB(r)))}},Bn={clearProps:function(A,t,e,r,i){if(i.data!=="isFromStart"){var s=A._pt=new IA(A._pt,t,e,0,0,Dw);return s.u=r,s.pr=-10,s.tween=i,A._props.push(e),1}}},Ar=[1,0,0,1,0,0],UB={},FB=function(A){return A==="matrix(1, 0, 0, 1, 0, 0)"||A==="none"||!A},pB=function(A){var t=PA(A,j);return FB(t)?Ar:t.substr(7).match(fo).map(tA)},Zi=function(A,t){var e=A._gsap||Ge(A),r=A.style,i=pB(A),s,a,o,B;return e.svg&&A.getAttribute("transform")?(o=A.transform.baseVal.consolidate().matrix,i=[o.a,o.b,o.c,o.d,o.e,o.f],i.join(",")==="1,0,0,1,0,0"?Ar:i):(i===Ar&&!A.offsetParent&&A!==Qt&&!e.svg&&(o=r.display,r.display="block",s=A.parentNode,(!s||!A.offsetParent&&!A.getBoundingClientRect().width)&&(B=1,a=A.nextElementSibling,Qt.appendChild(A)),i=pB(A),o?r.display=o:xe(A,"display"),B&&(a?s.insertBefore(A,a):s?s.appendChild(A):Qt.removeChild(A))),t&&i.length>6?[i[0],i[1],i[4],i[5],i[12],i[13]]:i)},zi=function(A,t,e,r,i,s){var a=A._gsap,o=i||Zi(A,!0),B=a.xOrigin||0,c=a.yOrigin||0,l=a.xOffset||0,u=a.yOffset||0,h=o[0],g=o[1],f=o[2],w=o[3],C=o[4],d=o[5],E=t.split(" "),v=parseFloat(E[0])||0,Q=parseFloat(E[1])||0,U,H,y,p;e?o!==Ar&&(H=h*w-g*f)&&(y=v*(w/H)+Q*(-f/H)+(f*d-w*C)/H,p=v*(-g/H)+Q*(h/H)-(h*d-g*C)/H,v=y,Q=p):(U=wB(A),v=U.x+(~E[0].indexOf("%")?v/100*U.width:v),Q=U.y+(~(E[1]||E[0]).indexOf("%")?Q/100*U.height:Q)),r||r!==!1&&a.smooth?(C=v-B,d=Q-c,a.xOffset=l+(C*h+d*f)-C,a.yOffset=u+(C*g+d*w)-d):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=Q,a.smooth=!!r,a.origin=t,a.originIsAbsolute=!!e,A.style[bA]="0px 0px",s&&(Le(s,a,"xOrigin",B,v),Le(s,a,"yOrigin",c,Q),Le(s,a,"xOffset",l,a.xOffset),Le(s,a,"yOffset",u,a.yOffset)),A.setAttribute("data-svg-origin",v+" "+Q)},er=function(A,t){var e=A._gsap||new Zo(A);if("x"in e&&!t&&!e.uncache)return e;var r=A.style,i=e.scaleX<0,s="px",a="deg",o=getComputedStyle(A),B=PA(A,bA)||"0",c,l,u,h,g,f,w,C,d,E,v,Q,U,H,y,p,x,D,S,b,T,N,M,P,$,hA,FA,vA,gA,xA,iA,sA;return c=l=u=f=w=C=d=E=v=0,h=g=1,e.svg=!!(A.getCTM&&QB(A)),o.translate&&((o.translate!=="none"||o.scale!=="none"||o.rotate!=="none")&&(r[j]=(o.translate!=="none"?"translate3d("+(o.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(o.rotate!=="none"?"rotate("+o.rotate+") ":"")+(o.scale!=="none"?"scale("+o.scale.split(" ").join(",")+") ":"")+(o[j]!=="none"?o[j]:"")),r.scale=r.rotate=r.translate="none"),H=Zi(A,e.svg),e.svg&&(e.uncache?($=A.getBBox(),B=e.xOrigin-$.x+"px "+(e.yOrigin-$.y)+"px",P=""):P=!t&&A.getAttribute("data-svg-origin"),zi(A,P||B,!!P||e.originIsAbsolute,e.smooth!==!1,H)),Q=e.xOrigin||0,U=e.yOrigin||0,H!==Ar&&(D=H[0],S=H[1],b=H[2],T=H[3],c=N=H[4],l=M=H[5],H.length===6?(h=Math.sqrt(D*D+S*S),g=Math.sqrt(T*T+b*b),f=D||S?Ct(S,D)*Xe:0,d=b||T?Ct(b,T)*Xe+f:0,d&&(g*=Math.abs(Math.cos(d*dt))),e.svg&&(c-=Q-(Q*D+U*b),l-=U-(Q*S+U*T))):(sA=H[6],xA=H[7],FA=H[8],vA=H[9],gA=H[10],iA=H[11],c=H[12],l=H[13],u=H[14],y=Ct(sA,gA),w=y*Xe,y&&(p=Math.cos(-y),x=Math.sin(-y),P=N*p+FA*x,$=M*p+vA*x,hA=sA*p+gA*x,FA=N*-x+FA*p,vA=M*-x+vA*p,gA=sA*-x+gA*p,iA=xA*-x+iA*p,N=P,M=$,sA=hA),y=Ct(-b,gA),C=y*Xe,y&&(p=Math.cos(-y),x=Math.sin(-y),P=D*p-FA*x,$=S*p-vA*x,hA=b*p-gA*x,iA=T*x+iA*p,D=P,S=$,b=hA),y=Ct(S,D),f=y*Xe,y&&(p=Math.cos(y),x=Math.sin(y),P=D*p+S*x,$=N*p+M*x,S=S*p-D*x,M=M*p-N*x,D=P,N=$),w&&Math.abs(w)+Math.abs(f)>359.9&&(w=f=0,C=180-C),h=tA(Math.sqrt(D*D+S*S+b*b)),g=tA(Math.sqrt(M*M+sA*sA)),y=Ct(N,M),d=Math.abs(y)>2e-4?y*Xe:0,v=iA?1/(iA<0?-iA:iA):0),e.svg&&(P=A.getAttribute("transform"),e.forceCSS=A.setAttribute("transform","")||!FB(PA(A,j)),P&&A.setAttribute("transform",P))),Math.abs(d)>90&&Math.abs(d)<270&&(i?(h*=-1,d+=f<=0?180:-180,f+=f<=0?180:-180):(g*=-1,d+=d<=0?180:-180)),t=t||e.uncache,e.x=c-((e.xPercent=c&&(!t&&e.xPercent||(Math.round(A.offsetWidth/2)===Math.round(-c)?-50:0)))?A.offsetWidth*e.xPercent/100:0)+s,e.y=l-((e.yPercent=l&&(!t&&e.yPercent||(Math.round(A.offsetHeight/2)===Math.round(-l)?-50:0)))?A.offsetHeight*e.yPercent/100:0)+s,e.z=u+s,e.scaleX=tA(h),e.scaleY=tA(g),e.rotation=tA(f)+a,e.rotationX=tA(w)+a,e.rotationY=tA(C)+a,e.skewX=d+a,e.skewY=E+a,e.transformPerspective=v+s,(e.zOrigin=parseFloat(B.split(" ")[2])||!t&&e.zOrigin||0)&&(r[bA]=cn(B)),e.xOffset=e.yOffset=0,e.force3D=SA.force3D,e.renderTransform=e.svg?Mw:uB?mB:Tw,e.uncache=0,e},cn=function(A){return(A=A.split(" "))[0]+" "+A[1]},ji=function(A,t,e){var r=UA(t);return tA(parseFloat(t)+parseFloat(Ke(A,"x",e+"px",r)))+r},Tw=function(A,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,mB(A,t)},Ye="0deg",tr="0px",Je=") ",mB=function(A,t){var e=t||this,r=e.xPercent,i=e.yPercent,s=e.x,a=e.y,o=e.z,B=e.rotation,c=e.rotationY,l=e.rotationX,u=e.skewX,h=e.skewY,g=e.scaleX,f=e.scaleY,w=e.transformPerspective,C=e.force3D,d=e.target,E=e.zOrigin,v="",Q=C==="auto"&&A&&A!==1||C===!0;if(E&&(l!==Ye||c!==Ye)){var U=parseFloat(c)*dt,H=Math.sin(U),y=Math.cos(U),p;U=parseFloat(l)*dt,p=Math.cos(U),s=ji(d,s,H*p*-E),a=ji(d,a,-Math.sin(U)*-E),o=ji(d,o,y*p*-E+E)}w!==tr&&(v+="perspective("+w+Je),(r||i)&&(v+="translate("+r+"%, "+i+"%) "),(Q||s!==tr||a!==tr||o!==tr)&&(v+=o!==tr||Q?"translate3d("+s+", "+a+", "+o+") ":"translate("+s+", "+a+Je),B!==Ye&&(v+="rotate("+B+Je),c!==Ye&&(v+="rotateY("+c+Je),l!==Ye&&(v+="rotateX("+l+Je),(u!==Ye||h!==Ye)&&(v+="skew("+u+", "+h+Je),(g!==1||f!==1)&&(v+="scale("+g+", "+f+Je),d.style[j]=v||"translate(0, 0)"},Mw=function(A,t){var e=t||this,r=e.xPercent,i=e.yPercent,s=e.x,a=e.y,o=e.rotation,B=e.skewX,c=e.skewY,l=e.scaleX,u=e.scaleY,h=e.target,g=e.xOrigin,f=e.yOrigin,w=e.xOffset,C=e.yOffset,d=e.forceCSS,E=parseFloat(s),v=parseFloat(a),Q,U,H,y,p;o=parseFloat(o),B=parseFloat(B),c=parseFloat(c),c&&(c=parseFloat(c),B+=c,o+=c),o||B?(o*=dt,B*=dt,Q=Math.cos(o)*l,U=Math.sin(o)*l,H=Math.sin(o-B)*-u,y=Math.cos(o-B)*u,B&&(c*=dt,p=Math.tan(B-c),p=Math.sqrt(1+p*p),H*=p,y*=p,c&&(p=Math.tan(c),p=Math.sqrt(1+p*p),Q*=p,U*=p)),Q=tA(Q),U=tA(U),H=tA(H),y=tA(y)):(Q=l,y=u,U=H=0),(E&&!~(s+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(E=Ke(h,"x",s,"px"),v=Ke(h,"y",a,"px")),(g||f||w||C)&&(E=tA(E+g-(g*Q+f*H)+w),v=tA(v+f-(g*U+f*y)+C)),(r||i)&&(p=h.getBBox(),E=tA(E+r/100*p.width),v=tA(v+i/100*p.height)),p="matrix("+Q+","+U+","+H+","+y+","+E+","+v+")",h.setAttribute("transform",p),d&&(h.style[j]=p)},Ow=function(A,t,e,r,i){var s=360,a=BA(i),o=parseFloat(i)*(a&&~i.indexOf("rad")?Xe:1),B=o-r,c=r+B+"deg",l,u;return a&&(l=i.split("_")[1],l==="short"&&(B%=s,B!==B%(s/2)&&(B+=B<0?s:-s)),l==="cw"&&B<0?B=(B+s*aB)%s-~~(B/s)*s:l==="ccw"&&B>0&&(B=(B-s*aB)%s-~~(B/s)*s)),A._pt=u=new IA(A._pt,t,e,r,B,Uw),u.e=c,u.u="deg",A._props.push(e),u},vB=function(A,t){for(var e in t)A[e]=t[e];return A},Gw=function(A,t,e){var r=vB({},e._gsap),i="perspective,force3D,transformOrigin,svgOrigin",s=e.style,a,o,B,c,l,u,h,g;r.svg?(B=e.getAttribute("transform"),e.setAttribute("transform",""),s[j]=t,a=er(e,1),xe(e,j),e.setAttribute("transform",B)):(B=getComputedStyle(e)[j],s[j]=t,a=er(e,1),s[j]=B);for(o in le)B=r[o],c=a[o],B!==c&&i.indexOf(o)<0&&(h=UA(B),g=UA(c),l=h!==g?Ke(e,o,B,g):parseFloat(B),u=parseFloat(c),A._pt=new IA(A._pt,a,o,l,u-l,Yi),A._pt.u=g||0,A._props.push(o));vB(a,r)};HA("padding,margin,Width,Radius",function(n,A){var t="Top",e="Right",r="Bottom",i="Left",s=(A<3?[t,e,r,i]:[t+i,t+e,r+e,r+i]).map(function(a){return A<2?n+a:"border"+a+n});Bn[A>1?"border"+n:n]=function(a,o,B,c,l){var u,h;if(arguments.length<4)return u=s.map(function(g){return ue(a,g,B)}),h=u.join(" "),h.split(u[0]).length===5?u[0]:h;u=(c+"").split(" "),h={},s.forEach(function(g,f){return h[g]=u[f]=u[f]||u[(f-1)/2|0]}),a.init(o,h,l)}});var EB={name:"css",register:Wi,targetTest:function(A){return A.style&&A.nodeType},init:function(A,t,e,r,i){var s=this._props,a=A.style,o=e.vars.startAt,B,c,l,u,h,g,f,w,C,d,E,v,Q,U,H,y,p;Ri||Wi(),this.styles=this.styles||lB(A),y=this.styles.props,this.tween=e;for(f in t)if(f!=="autoRound"&&(c=t[f],!(TA[f]&&zo(f,t,e,r,A,i)))){if(h=typeof c,g=Bn[f],h==="function"&&(c=c.call(e,r,A,i),h=typeof c),h==="string"&&~c.indexOf("random(")&&(c=Wt(c)),g)g(this,A,f,c,e)&&(H=1);else if(f.substr(0,2)==="--")B=(getComputedStyle(A).getPropertyValue(f)+"").trim(),c+="",Ie.lastIndex=0,Ie.test(B)||(w=UA(B),C=UA(c),C?w!==C&&(B=Ke(A,f,B,C)+C):w&&(c+=w)),this.add(a,"setProperty",B,c,r,i,0,0,f),s.push(f),y.push(f,0,a[f]);else if(h!=="undefined"){if(o&&f in o?(B=typeof o[f]=="function"?o[f].call(e,r,A,i):o[f],BA(B)&&~B.indexOf("random(")&&(B=Wt(B)),UA(B+"")||B==="auto"||(B+=SA.units[f]||UA(ue(A,f))||""),(B+"").charAt(1)==="="&&(B=ue(A,f))):B=ue(A,f),u=parseFloat(B),d=h==="string"&&c.charAt(1)==="="&&c.substr(0,2),d&&(c=c.substr(2)),l=parseFloat(c),f in ne&&(f==="autoAlpha"&&(u===1&&ue(A,"visibility")==="hidden"&&l&&(u=0),y.push("visibility",0,a.visibility),Le(this,a,"visibility",u?"inherit":"hidden",l?"inherit":"hidden",!l)),f!=="scale"&&f!=="transform"&&(f=ne[f],~f.indexOf(",")&&(f=f.split(",")[0]))),E=f in le,E){if(this.styles.save(f),p=c,h==="string"&&c.substring(0,6)==="var(--"){if(c=PA(A,c.substring(4,c.indexOf(")"))),c.substring(0,5)==="calc("){var x=A.style.perspective;A.style.perspective=c,c=PA(A,"perspective"),x?A.style.perspective=x:xe(A,"perspective")}l=parseFloat(c)}if(v||(Q=A._gsap,Q.renderTransform&&!t.parseTransform||er(A,t.parseTransform),U=t.smoothOrigin!==!1&&Q.smooth,v=this._pt=new IA(this._pt,a,j,0,1,Q.renderTransform,Q,0,-1),v.dep=1),f==="scale")this._pt=new IA(this._pt,Q,"scaleY",Q.scaleY,(d?lt(Q.scaleY,d+l):l)-Q.scaleY||0,Yi),this._pt.u=0,s.push("scaleY",f),f+="X";else if(f==="transformOrigin"){y.push(bA,0,a[bA]),c=Sw(c),Q.svg?zi(A,c,0,U,0,this):(C=parseFloat(c.split(" ")[2])||0,C!==Q.zOrigin&&Le(this,Q,"zOrigin",Q.zOrigin,C),Le(this,a,f,cn(B),cn(c)));continue}else if(f==="svgOrigin"){zi(A,c,1,U,0,this);continue}else if(f in UB){Ow(this,Q,f,u,d?lt(u,d+c):c);continue}else if(f==="smoothOrigin"){Le(this,Q,"smooth",Q.smooth,c);continue}else if(f==="force3D"){Q[f]=c;continue}else if(f==="transform"){Gw(this,c,A);continue}}else f in a||(f=Ut(f)||f);if(E||(l||l===0)&&(u||u===0)&&!Cw.test(c)&&f in a)w=(B+"").substr((u+"").length),l||(l=0),C=UA(c)||(f in SA.units?SA.units[f]:w),w!==C&&(u=Ke(A,f,B,C)),this._pt=new IA(this._pt,E?Q:a,f,u,(d?lt(u,d+l):l)-u,!E&&(C==="px"||f==="zIndex")&&t.autoRound!==!1?mw:Yi),this._pt.u=C||0,E&&p!==c?(this._pt.b=B,this._pt.e=p,this._pt.r=pw):w!==C&&C!=="%"&&(this._pt.b=B,this._pt.r=Fw);else if(f in a)Kw.call(this,A,f,B,d?d+c:c);else if(f in A)this.add(A,f,B||A[f],d?d+c:c,r,i);else if(f!=="parseTransform"){Ci(f,c);continue}E||(f in a?y.push(f,0,a[f]):typeof A[f]=="function"?y.push(f,2,A[f]()):y.push(f,1,B||A[f])),s.push(f)}}H&&tB(this)},render:function(A,t){if(t.tween._time||!ki())for(var e=t._pt;e;)e.r(A,e.d),e=e._next;else t.styles.revert()},get:ue,aliases:ne,getSetter:function(A,t,e){var r=ne[t];return r&&r.indexOf(",")<0&&(t=r),t in le&&t!==bA&&(A._gsap.x||ue(A,"x"))?e&&sB===e?t==="scale"?Hw:yw:(sB=e||{})&&(t==="scale"?Iw:_w):A.style&&!hi(A.style[t])?vw:~t.indexOf("-")?Ew:Oi(A,t)},core:{_removeProperty:xe,_getMatrix:Zi}};_A.utils.checkPrefix=Ut,_A.core.getStyleSaver=lB,function(n,A,t,e){var r=HA(n+","+A+","+t,function(i){le[i]=1});HA(A,function(i){SA.units[i]="deg",UB[i]=1}),ne[r[13]]=n+","+A,HA(e,function(i){var s=i.split(":");ne[s[1]]=r[s[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),HA("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){SA.units[n]="px"}),_A.registerPlugin(EB);var yB=_A.registerPlugin(EB)||_A;yB.core.Tween;function Pw(n,A,t,e){const r=new m.BufferGeometry,s=new m.ArcCurve(0,0,n,A,t,!1).getSpacedPoints(100);r.setFromPoints(s);const a=[];for(let h=0;h<s.length;h++)a.push(h/s.length);const o=new m.BufferAttribute(new Float32Array(a),1);r.attributes.percent=o;const B=[];for(let h=0;h<s.length;h++){const g=new m.Color(15503171),f=new m.Color(15969910),w=g.lerp(f,h/s.length);B.push(w.r,w.g,w.b)}r.attributes.color=new m.BufferAttribute(new Float32Array(B),3);const c=1.3,l=new m.PointsMaterial({size:c,transparent:!0,depthWrite:!1});l.onBeforeCompile=function(h){h.vertexShader=h.vertexShader.replace("void main() {",["attribute float percent;","void main() {"].join(`
|
|
69
69
|
`)),h.vertexShader=h.vertexShader.replace("gl_PointSize = size;",["gl_PointSize = percent * size;"].join(`
|
|
70
|
-
`))};const u=new m.Points(r,l);return l.color=new m.Color(e),u.name="飞行线",u}function Vw(n,A,t,e,r,i){const s=ot(n,A,t),a=new m.Vector3(s.x,s.y,s.z),o=ot(n,e,r),B=new m.Vector3(o.x,o.y,o.z),c=Nw(a,B),l=Rw(n,c.startPoint,c.endPoint,i);return l.quaternion.multiply(c.quaternion),l}function Nw(n,A){const t=new m.Vector3(0,0,0),e=n.clone().sub(t),r=A.clone().sub(t),i=e.clone().cross(r).normalize(),s=new m.Vector3(0,0,1),a=new m.Quaternion().setFromUnitVectors(i,s),o=n.clone().applyQuaternion(a),B=A.clone().applyQuaternion(a),l=o.clone().add(B).multiplyScalar(.5).clone().sub(t).normalize(),u=new m.Vector3(0,1,0),h=new m.Quaternion().setFromUnitVectors(l,u),g=o.clone().applyQuaternion(h),f=B.clone().applyQuaternion(h);return{quaternion:a.clone().invert().multiply(h.clone().invert()),startPoint:g,endPoint:f}}function Rw(n,A,t,e){const i=new m.Vector3().addVectors(A,t).multiplyScalar(.5).clone().normalize(),s=HB(A,t,new m.Vector3(0,0,0)),a=i.multiplyScalar(n+s*n*.2),o=Xw(A,t,a),B=Math.abs(o.y-a.y),c=HB(A,new m.Vector3(0,-1,0),o),l=-Math.PI/2+c,u=Math.PI-l,h=kw(o.x,o.y,B,l,u,e.color);h.center=o,h.topCoord=a;const g=(u-l)/7,f=Pw(B,l,l+g,e.flyLineColor);return f.position.y=o.y,h.add(f),f.flyEndAngle=u-l-g,f.startAngle=l,f.AngleZ=h.flyEndAngle*Math.random(),h.userData.flyLine=f,h}function HB(n,A,t){const e=n.clone().sub(t).normalize(),r=A.clone().sub(t).normalize(),i=e.clone().dot(r);return Math.acos(i)}function kw(n,A,t,e,r,i){const s=new m.BufferGeometry,o=new m.ArcCurve(n,A,t,e,r,!1).getSpacedPoints(80);s.setFromPoints(o);const B=new m.LineBasicMaterial({color:i||13731143});return new m.Line(s,B)}function Xw(n,A,t){const e=n.lengthSq(),r=A.lengthSq(),i=t.lengthSq(),s=n.x,a=n.y,o=A.x,B=A.y,c=t.x,l=t.y,u=s*B+o*l+c*a-s*l-o*a-c*B,h=(r*l+e*B+i*a-r*a-i*B-e*l)/u/2,g=(i*o+r*s+e*c-e*o-r*c-i*s)/u/2;return new m.Vector3(h,g,0)}class Yw{constructor(A){K(this,"group");K(this,"earthGroup");K(this,"around");K(this,"aroundPoints");K(this,"options");K(this,"uniforms");K(this,"timeValue");K(this,"earth");K(this,"punctuationMaterial");K(this,"markupPoint");K(this,"waveMeshArr");K(this,"circleLineList");K(this,"circleList");K(this,"x");K(this,"n");K(this,"isRotation");K(this,"flyLineArcGroup");this.options=A,this.group=new m.Group,this.group.name="group",this.group.scale.set(0,0,0),this.earthGroup=new m.Group,this.group.add(this.earthGroup),this.earthGroup.name="EarthGroup",this.markupPoint=new m.Group,this.markupPoint.name="markupPoint",this.waveMeshArr=[],this.circleLineList=[],this.circleList=[],this.x=0,this.n=0,this.isRotation=this.options.earth.isRotation,this.timeValue=100,this.uniforms={glowColor:{value:new m.Color(840171)},scale:{type:"f",value:-1},bias:{type:"f",value:1},power:{type:"f",value:3.3},time:{type:"f",value:this.timeValue},isHover:{value:!1},map:{value:null}}}async init(){return new Promise(async A=>{this.createEarth(),this.createStars(),this.createEarthGlow(),this.createEarthAperture(),await this.createMarkupPoint(),await this.createSpriteLabel(),this.createAnimateCircle(),this.createFlyLine(),this.show(),A()})}createEarth(){const A=new m.
|
|
70
|
+
`))};const u=new m.Points(r,l);return l.color=new m.Color(e),u.name="飞行线",u}function Vw(n,A,t,e,r,i){const s=ot(n,A,t),a=new m.Vector3(s.x,s.y,s.z),o=ot(n,e,r),B=new m.Vector3(o.x,o.y,o.z),c=Nw(a,B),l=Rw(n,c.startPoint,c.endPoint,i);return l.quaternion.multiply(c.quaternion),l}function Nw(n,A){const t=new m.Vector3(0,0,0),e=n.clone().sub(t),r=A.clone().sub(t),i=e.clone().cross(r).normalize(),s=new m.Vector3(0,0,1),a=new m.Quaternion().setFromUnitVectors(i,s),o=n.clone().applyQuaternion(a),B=A.clone().applyQuaternion(a),l=o.clone().add(B).multiplyScalar(.5).clone().sub(t).normalize(),u=new m.Vector3(0,1,0),h=new m.Quaternion().setFromUnitVectors(l,u),g=o.clone().applyQuaternion(h),f=B.clone().applyQuaternion(h);return{quaternion:a.clone().invert().multiply(h.clone().invert()),startPoint:g,endPoint:f}}function Rw(n,A,t,e){const i=new m.Vector3().addVectors(A,t).multiplyScalar(.5).clone().normalize(),s=HB(A,t,new m.Vector3(0,0,0)),a=i.multiplyScalar(n+s*n*.2),o=Xw(A,t,a),B=Math.abs(o.y-a.y),c=HB(A,new m.Vector3(0,-1,0),o),l=-Math.PI/2+c,u=Math.PI-l,h=kw(o.x,o.y,B,l,u,e.color);h.center=o,h.topCoord=a;const g=(u-l)/7,f=Pw(B,l,l+g,e.flyLineColor);return f.position.y=o.y,h.add(f),f.flyEndAngle=u-l-g,f.startAngle=l,f.AngleZ=h.flyEndAngle*Math.random(),h.userData.flyLine=f,h}function HB(n,A,t){const e=n.clone().sub(t).normalize(),r=A.clone().sub(t).normalize(),i=e.clone().dot(r);return Math.acos(i)}function kw(n,A,t,e,r,i){const s=new m.BufferGeometry,o=new m.ArcCurve(n,A,t,e,r,!1).getSpacedPoints(80);s.setFromPoints(o);const B=new m.LineBasicMaterial({color:i||13731143});return new m.Line(s,B)}function Xw(n,A,t){const e=n.lengthSq(),r=A.lengthSq(),i=t.lengthSq(),s=n.x,a=n.y,o=A.x,B=A.y,c=t.x,l=t.y,u=s*B+o*l+c*a-s*l-o*a-c*B,h=(r*l+e*B+i*a-r*a-i*B-e*l)/u/2,g=(i*o+r*s+e*c-e*o-r*c-i*s)/u/2;return new m.Vector3(h,g,0)}class Yw{constructor(A){K(this,"group");K(this,"earthGroup");K(this,"around");K(this,"aroundPoints");K(this,"options");K(this,"uniforms");K(this,"timeValue");K(this,"earth");K(this,"punctuationMaterial");K(this,"markupPoint");K(this,"waveMeshArr");K(this,"circleLineList");K(this,"circleList");K(this,"x");K(this,"n");K(this,"isRotation");K(this,"flyLineArcGroup");this.options=A,this.group=new m.Group,this.group.name="group",this.group.scale.set(0,0,0),this.earthGroup=new m.Group,this.group.add(this.earthGroup),this.earthGroup.name="EarthGroup",this.markupPoint=new m.Group,this.markupPoint.name="markupPoint",this.waveMeshArr=[],this.circleLineList=[],this.circleList=[],this.x=0,this.n=0,this.isRotation=this.options.earth.isRotation,this.timeValue=100,this.uniforms={glowColor:{value:new m.Color(840171)},scale:{type:"f",value:-1},bias:{type:"f",value:1},power:{type:"f",value:3.3},time:{type:"f",value:this.timeValue},isHover:{value:!1},map:{value:null}}}async init(){return new Promise(async A=>{this.createEarth(),this.createStars(),this.createEarthGlow(),this.createEarthAperture(),await this.createMarkupPoint(),await this.createSpriteLabel(),this.createAnimateCircle(),this.createFlyLine(),this.show(),A()})}createEarth(){const A=new m.SphereGeometry(this.options.earth.radius,50,50),t=new m.SphereGeometry(this.options.earth.radius+10,60,60),e=new m.PointsMaterial({color:8519679,transparent:!0,sizeAttenuation:!0,opacity:.1,vertexColors:!1,size:.01}),r=new m.Points(t,e);this.earthGroup.add(r),this.uniforms.map.value=this.options.textures.earth;const i=new m.ShaderMaterial({uniforms:this.uniforms,vertexShader:dg,fragmentShader:Cg});i.needsUpdate=!0,this.earth=new m.Mesh(A,i),this.earth.name="earth",this.earthGroup.add(this.earth)}createStars(){const A=[],t=[];for(let r=0;r<500;r++){const i=new m.Vector3;i.x=800*Math.random()-300,i.y=800*Math.random()-300,i.z=800*Math.random()-300,A.push(i.x,i.y,i.z),t.push(new m.Color(1,1,1))}this.around=new m.BufferGeometry,this.around.setAttribute("position",new m.BufferAttribute(new Float32Array(A),3)),this.around.setAttribute("color",new m.BufferAttribute(new Float32Array(t),3));const e=new m.PointsMaterial({size:2,sizeAttenuation:!0,color:5076687,transparent:!0,opacity:1,map:this.options.textures.gradient});this.aroundPoints=new m.Points(this.around,e),this.aroundPoints.name="星空",this.aroundPoints.scale.set(1,1,1),this.group.add(this.aroundPoints)}createEarthGlow(){const A=this.options.earth.radius,t=this.options.textures.glow,e=new m.SpriteMaterial({map:t,color:4427985,transparent:!0,opacity:.7,depthWrite:!1}),r=new m.Sprite(e);r.scale.set(A*3,A*3,1),this.earthGroup.add(r)}createEarthAperture(){const A=["varying vec3 vVertexWorldPosition;","varying vec3 vVertexNormal;","varying vec4 vFragColor;","void main(){"," vVertexNormal = normalize(normalMatrix * normal);"," vVertexWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;"," // set gl_Position"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join(`
|
|
71
71
|
`),t={uniforms:{coeficient:{type:"f",value:1},power:{type:"f",value:3},glowColor:{type:"c",value:new m.Color(4427985)}},vertexShader:A,fragmentShader:["uniform vec3 glowColor;","uniform float coeficient;","uniform float power;","varying vec3 vVertexNormal;","varying vec3 vVertexWorldPosition;","varying vec4 vFragColor;","void main(){"," vec3 worldCameraToVertex = vVertexWorldPosition - cameraPosition;"," vec3 viewCameraToVertex = (viewMatrix * vec4(worldCameraToVertex, 0.0)).xyz;"," viewCameraToVertex= normalize(viewCameraToVertex);"," float intensity = pow(coeficient + dot(vVertexNormal, viewCameraToVertex), power);"," gl_FragColor = vec4(glowColor, intensity);","}"].join(`
|
|
72
|
-
`)},e=new m.ShaderMaterial({uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,blending:m.NormalBlending,transparent:!0,depthWrite:!1}),r=new m.
|
|
72
|
+
`)},e=new m.ShaderMaterial({uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,blending:m.NormalBlending,transparent:!0,depthWrite:!1}),r=new m.SphereGeometry(this.options.earth.radius+0,50,50),i=new m.Mesh(r,e);this.earthGroup.add(i)}async createMarkupPoint(){await Promise.all(this.options.data.map(async A=>{const t=this.options.earth.radius,e=A.startArray.E,r=A.startArray.N;this.punctuationMaterial=new m.MeshBasicMaterial({color:this.options.punctuation.circleColor,map:this.options.textures.label,transparent:!0,depthWrite:!1});const i=oo({radius:t,lon:e,lat:r,material:this.punctuationMaterial});this.markupPoint.add(i);const s=ao({radius:this.options.earth.radius,lon:e,lat:r,index:0,textures:this.options.textures,punctuation:this.options.punctuation});this.markupPoint.add(s);const a=so({radius:t,lon:e,lat:r,textures:this.options.textures});this.markupPoint.add(a),this.waveMeshArr.push(a),await Promise.all(A.endArray.map(o=>{const B=o.E,c=o.N,l=oo({radius:t,lon:B,lat:c,material:this.punctuationMaterial});this.markupPoint.add(l);const u=ao({radius:this.options.earth.radius,lon:B,lat:c,index:1,textures:this.options.textures,punctuation:this.options.punctuation});this.markupPoint.add(u);const h=so({radius:t,lon:B,lat:c,textures:this.options.textures});this.markupPoint.add(h),this.waveMeshArr.push(h)})),this.earthGroup.add(this.markupPoint)}))}async createSpriteLabel(){await Promise.all(this.options.data.map(async A=>{let t=[];t.push(A.startArray),t=t.concat(...A.endArray),await Promise.all(t.map(async e=>{const r=ot(this.options.earth.radius*1.001,e.E,e.N),i=`<div class="fire-div">${e.name}</div>`,s=document.getElementById("three-earth-html2canvas");s.innerHTML=i;const a={backgroundColor:null,scale:6},B=(await gg(document.getElementById("three-earth-html2canvas"),a)).toDataURL("image/png"),c=new m.TextureLoader().load(B),l=new m.SpriteMaterial({map:c,transparent:!0}),u=new m.Sprite(l),h=5+(e.name.length-2)*2;u.scale.set(h,3,1),u.position.set(r.x*1.1,r.y*1.1,r.z*1.1),this.earth.add(u)}))}))}createAnimateCircle(){const A=Ug({radius:this.options.earth.radius+15,number:150}),t=new m.MeshBasicMaterial({color:"#0c3172",transparent:!0,opacity:.4,side:m.DoubleSide}),e=Fg({pointList:A,material:t,number:100,radius:.1});this.earthGroup.add(e);const r=e.clone();r.scale.set(1.2,1.2,1.2),r.rotateZ(Math.PI/6),this.earthGroup.add(r);const i=e.clone();i.scale.set(.8,.8,.8),i.rotateZ(-Math.PI/6),this.earthGroup.add(i);const s=new m.Mesh(new m.SphereGeometry(this.options.satellite.size,32,32),new m.MeshBasicMaterial({color:"#e0b187"})),a=new m.Mesh(new m.SphereGeometry(this.options.satellite.size,32,32),new m.MeshBasicMaterial({color:"#628fbb"})),o=new m.Mesh(new m.SphereGeometry(this.options.satellite.size,32,32),new m.MeshBasicMaterial({color:"#806bdf"}));this.circleLineList.push(e,r,i),s.name=a.name=o.name="卫星";for(let B=0;B<this.options.satellite.number;B++){const c=s.clone(),l=Math.floor(A.length/this.options.satellite.number);c.position.set(A[l*(B+1)][0]*1,A[l*(B+1)][1]*1,A[l*(B+1)][2]*1),e.add(c);const u=a.clone(),h=Math.floor(A.length/this.options.satellite.number);u.position.set(A[h*(B+1)][0]*1,A[h*(B+1)][1]*1,A[h*(B+1)][2]*1),r.add(u);const g=a.clone(),f=Math.floor(A.length/this.options.satellite.number);g.position.set(A[f*(B+1)][0]*1,A[f*(B+1)][1]*1,A[f*(B+1)][2]*1),i.add(g)}}createFlyLine(){this.flyLineArcGroup=new m.Group,this.flyLineArcGroup.userData.flyLineArray=[],this.earthGroup.add(this.flyLineArcGroup),this.options.data.forEach(A=>{A.endArray.forEach(t=>{const e=Vw(this.options.earth.radius,A.startArray.E,A.startArray.N,t.E,t.N,this.options.flyLine);this.flyLineArcGroup.add(e),this.flyLineArcGroup.userData.flyLineArray.push(e.userData.flyLine)})})}show(){yB.to(this.group.scale,{x:1,y:1,z:1,duration:2,ease:"Quadratic"})}render(){var A,t;(t=(A=this.flyLineArcGroup)==null?void 0:A.userData.flyLineArray)==null||t.forEach(e=>{e.rotation.z+=this.options.flyLine.speed,e.rotation.z>=e.flyEndAngle&&(e.rotation.z=0)}),this.isRotation&&(this.earthGroup.rotation.y+=this.options.earth.rotateSpeed),this.circleLineList.forEach(e=>{e.rotateY(this.options.satellite.rotateSpeed)}),this.uniforms.time.value=this.uniforms.time.value<-this.timeValue?this.timeValue:this.uniforms.time.value-1,this.waveMeshArr.length&&this.waveMeshArr.forEach(e=>{e.userData.scale+=.007,e.scale.set(e.userData.size*e.userData.scale,e.userData.size*e.userData.scale,e.userData.size*e.userData.scale),e.userData.scale<=1.5?e.material.opacity=(e.userData.scale-1)*2:e.userData.scale>1.5&&e.userData.scale<=2?e.material.opacity=1-(e.userData.scale-1.5)*2:e.userData.scale=1})}}const Jw=[{startArray:{name:"杭州",N:30.246026,E:120.210792},endArray:[{name:"曼谷",N:22,E:100.49074172973633},{name:"澳大利亚",N:-23.68477416688374,E:133.857421875},{name:"新疆维吾尔自治区",N:41.748,E:84.9023},{name:"德黑兰",N:35,E:51},{name:"德黑兰",N:35,E:51},{name:"美国",N:34.125447565116126,E:241.7431640625},{name:"英国",N:51.508742458803326,E:359.82421875},{name:"巴西",N:-9.96885060854611,E:668.1445312499999}]},{startArray:{name:"北京",N:39.89491,E:116.322056},endArray:[{name:"西藏",N:29.660361,E:91.132212},{name:"广西",N:22.830824,E:108.30616},{name:"江西",N:28.676493,E:115.892151},{name:"贵阳",N:26.647661,E:106.630153}]}],VA={earth:{radius:50,rotateSpeed:.002,isRotation:!0},satellite:{show:!0,rotateSpeed:-.01,size:1,number:2},punctuation:{circleColor:3707647,lightColumn:{startColor:16777215,endColor:16711680}},flyLine:{color:13731143,speed:.004,flyLineColor:16742164}};class Ww{constructor(A){K(this,"basic");K(this,"scene");K(this,"camera");K(this,"renderer");K(this,"controls");K(this,"sizes");K(this,"material");K(this,"resources");K(this,"option");K(this,"earth");K(this,"_html2canvasEl",null);K(this,"_animFrameId",null);this.option=A,this._createHtml2CanvasEl(),this.basic=new PB(A.dom),this.scene=this.basic.scene,this.renderer=this.basic.renderer,this.controls=this.basic.controls,this.camera=this.basic.camera,this.sizes=new NB({dom:A.dom}),this.sizes.$on("resize",()=>{const t=Number(this.sizes.viewport.width),e=Number(this.sizes.viewport.height);this.renderer.setSize(t,e),this.camera.aspect=t/e,this.camera.updateProjectionMatrix()}),this.resources=new XB(async()=>{await this.createEarth(),this.render()},A.baseUrl??"")}_createHtml2CanvasEl(){const A=document.getElementById("three-earth-html2canvas");if(A){this._html2canvasEl=A;return}const t=document.createElement("div");t.id="three-earth-html2canvas",t.className="css3d-wapper",t.style.cssText="position:fixed;z-index:-9999;left:0;top:0;pointer-events:none;background:rgba(0,0,0,0);",t.innerHTML='<div class="fire-div"></div>',document.body.appendChild(t),this._html2canvasEl=t}async createEarth(){var e,r,i,s,a,o,B,c,l,u,h,g,f,w,C,d,E;const A=this.option,t={radius:((e=A.earth)==null?void 0:e.radius)??VA.earth.radius,rotateSpeed:((r=A.earth)==null?void 0:r.rotateSpeed)??VA.earth.rotateSpeed,isRotation:((i=A.earth)==null?void 0:i.isRotation)??VA.earth.isRotation};this.earth=new Yw({data:A.data??Jw,dom:A.dom,textures:this.resources.textures,earth:t,satellite:{show:((s=A.satellite)==null?void 0:s.show)??VA.satellite.show,rotateSpeed:((a=A.satellite)==null?void 0:a.rotateSpeed)??VA.satellite.rotateSpeed,size:((o=A.satellite)==null?void 0:o.size)??VA.satellite.size,number:((B=A.satellite)==null?void 0:B.number)??VA.satellite.number},punctuation:{circleColor:((c=A.punctuation)==null?void 0:c.circleColor)??VA.punctuation.circleColor,lightColumn:{startColor:((u=(l=A.punctuation)==null?void 0:l.lightColumn)==null?void 0:u.startColor)??VA.punctuation.lightColumn.startColor,endColor:((g=(h=A.punctuation)==null?void 0:h.lightColumn)==null?void 0:g.endColor)??VA.punctuation.lightColumn.endColor}},flyLine:{color:((f=A.flyLine)==null?void 0:f.color)??VA.flyLine.color,speed:((w=A.flyLine)==null?void 0:w.speed)??VA.flyLine.speed,flyLineColor:((C=A.flyLine)==null?void 0:C.flyLineColor)??VA.flyLine.flyLineColor}}),await this.earth.init(),this.scene.add(this.earth.group),(E=(d=this.option).onReady)==null||E.call(d)}render(){const A=()=>{var t;this._animFrameId=requestAnimationFrame(A),(t=this.earth)==null||t.render(),this.controls.update(),this.renderer.render(this.scene,this.camera)};A()}dispose(){var A,t;this._animFrameId!==null&&(cancelAnimationFrame(this._animFrameId),this._animFrameId=null),this.renderer.dispose(),this.renderer.domElement.parentElement===this.option.dom&&this.option.dom.removeChild(this.renderer.domElement),(t=(A=this._html2canvasEl)==null?void 0:A.parentElement)==null||t.removeChild(this._html2canvasEl),this._html2canvasEl=null}}LA.World=Ww,Object.defineProperty(LA,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Group, Mesh, MeshBasicMaterial,
|
|
1
|
+
import { Group, Mesh, MeshBasicMaterial, PlaneGeometry, Texture, TubeGeometry, Vector3 } from "three";
|
|
2
2
|
import { punctuation } from "../world/Earth";
|
|
3
3
|
/**
|
|
4
4
|
* 经纬度坐标转球面坐标
|
|
@@ -12,7 +12,7 @@ export declare const createWaveMesh: (options: {
|
|
|
12
12
|
lon;
|
|
13
13
|
lat;
|
|
14
14
|
textures;
|
|
15
|
-
}) => Mesh<
|
|
15
|
+
}) => Mesh<PlaneGeometry, MeshBasicMaterial>;
|
|
16
16
|
export declare const createLightPillar: (options: {
|
|
17
17
|
radius: number;
|
|
18
18
|
lon: number;
|
|
@@ -26,7 +26,7 @@ export declare const createPointMesh: (options: {
|
|
|
26
26
|
lon: number;
|
|
27
27
|
lat: number;
|
|
28
28
|
material: MeshBasicMaterial;
|
|
29
|
-
}) => Mesh<
|
|
29
|
+
}) => Mesh<PlaneGeometry, MeshBasicMaterial>;
|
|
30
30
|
export declare const getCirclePoints: (option: any) => any[];
|
|
31
31
|
/**
|
|
32
32
|
* 创建动态的线
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BufferGeometry, Color, Group, Mesh, MeshBasicMaterial, Object3D, Points, PointsMaterial, ShaderMaterial,
|
|
1
|
+
import { BufferGeometry, Color, Group, Mesh, MeshBasicMaterial, Object3D, Points, PointsMaterial, ShaderMaterial, SphereGeometry, Texture } from "three";
|
|
2
2
|
export type punctuation = {
|
|
3
3
|
circleColor: number;
|
|
4
4
|
lightColumn: {
|
|
@@ -74,7 +74,7 @@ export default class earth {
|
|
|
74
74
|
options: options;
|
|
75
75
|
uniforms: uniforms;
|
|
76
76
|
timeValue: number;
|
|
77
|
-
earth: Mesh<
|
|
77
|
+
earth: Mesh<SphereGeometry, ShaderMaterial>;
|
|
78
78
|
punctuationMaterial: MeshBasicMaterial;
|
|
79
79
|
markupPoint: Group;
|
|
80
80
|
waveMeshArr: Object3D[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "three-earth-3d",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "3D Earth visualization component built with Three.js — mount to any DOM element",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"threejs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"preview": "vite build --config vite.demo.config.ts && vite preview --config vite.demo.config.ts"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"three": ">=0.
|
|
41
|
+
"three": ">=0.125.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@rollup/pluginutils": "^5.3.0",
|