risoritofa / insert-3d-objects-in-a-webpage-using-html-and-css-only Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
[Error] SyntaxError: Unexpected keyword 'export' model-viewer.min.js:841
*/(this,"load"),this[im]=!1)}[Ip](){return super[Ip]()||this[im]}[KA](){const t=self.location.toString(),e=new URL(t),n=new URL(this.src,t),i=new URLSearchParams(n.search);if(e.hash="#model-viewer-no-ar-fallback",i.set("mode","ar_preferred"),i.has("disable_occlusion")||i.set("disable_occlusion","true"),"fixed"===this.arScale&&i.set("resizable","false"),"wall"===this.arPlacement&&i.set("enable_vertical_placement","true"),i.has("sound")){const e=new URL(i.get("sound"),t);i.set("sound",e.toString())}if(i.has("link")){const e=new URL(i.get("link"),t);i.set("link",e.toString())}const r=`intent://arvr.google.com/scene-viewer/1.0?${i.toString()+"&file="+encodeURIComponent(n.toString())}#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e.toString())};end;`;self.addEventListener("hashchange",(()=>{"#model-viewer-no-ar-fallback"===self.location.hash&&(HA=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[lm]())}),{once:!0}),this[nm].setAttribute("href",r),console.log("Attempting to present in AR with Scene Viewer..."),this[nm].click()}async[ZA](){const t=!this.iosSrc;this[JA].classList.remove("enabled");const e=t?await this.prepareUSDZ():this.iosSrc,n=new URL(e,self.location.toString());"fixed"===this.arScale&&(n.hash&&(n.hash+="&"),n.hash+="allowsContentScaling=0");const i=this[nm];i.setAttribute("rel","ar");const r=document.createElement("img");i.appendChild(r),i.setAttribute("href",n.toString()),t&&i.setAttribute("download","model.usdz"),console.log("Attempting to present in AR with Quick Look..."),i.click(),i.removeChild(r),t&&URL.revokeObjectURL(e),this[JA].classList.add("enabled")}async prepareUSDZ(){const t=this[Ep].beginActivity();await this[cm]();const e=this[gp],n=e.shadow;let i=!1;null!=n&&(i=n.visible,n.visible=!1),t(.2);const r=new RA,s=await r.parse(e.modelContainer),a=new Blob([s],{type:"model/vnd.usdz+zip"}),o=URL.createObjectURL(a);return t(1),null!=n&&(n.visible=i),o}}return GA([F({type:Boolean,attribute:"ar"})],u.prototype,"ar",void 0),GA([F({type:String,attribute:"ar-scale"})],u.prototype,"arScale",void 0),GA([F({type:String,attribute:"ar-placement"})],u.prototype,"arPlacement",void 0),GA([F({type:String,attribute:"ar-modes"})],u.prototype,"arModes",void 0),GA([F({type:String,attribute:"ios-src"})],u.prototype,"iosSrc",void 0),GA([F({type:Boolean,attribute:"xr-environment"})],u.prototype,"xrEnvironment",void 0),u})((t=>{var e,n,i,r,s,a,o,l,c,h,u,d,p;class A extends t{constructor(...t){super(...t),this.poster=null,this.reveal=hf,this.loading=df,this[e]=!1,this[n]=!1,this[i]=0,this[r]=null,this[s]=this.shadowRoot.querySelector(".slot.poster"),this[a]=this.shadowRoot.querySelector("#default-poster"),this[o]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .mask"),this[c]=this[yf].getAttribute("aria-label"),this[h]=((t,e)=>{let n=null;const i=(...i)=>{null==n&&(t(...i),n=self.setTimeout((()=>n=null),e))};return i.flush=()=>{null!=n&&(self.clearTimeout(n),n=null)},i})((t=>{const e=this[gf].parentNode;requestAnimationFrame((()=>{this[ff].style.opacity=""+.2*(1-t),this[gf].style.transform=`scaleX(${t})`,0===t&&(e.removeChild(this[gf]),e.appendChild(this[gf])),1===t?this[gf].classList.add("hide"):this[gf].classList.remove("hide")}))}),100),this[u]=()=>{this.reveal!==uf&&this.dismissPoster()},this[d]=t=>{if(this.reveal!==uf)switch(t.keyCode){case 32:case 13:this.dismissPoster()}},this[p]=t=>{const e=t.detail.totalProgress;this[_f]=Math.max(e,this[_f]),1===e&&(this[bf].flush(),!this[Cp]()||null==this[xf]&&this.reveal!==hf||this[wf]()),this[bf](e),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:e}}))};const A=self.ModelViewerElement||{},m=A.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.3.6/";Hh.setDRACODecoderLocation(m);const g=A.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";Hh.setKTX2TranscoderLocation(g)}static set dracoDecoderLocation(t){Hh.setDRACODecoderLocation(t)}static get dracoDecoderLocation(){return Hh.getDRACODecoderLocation()}static set ktx2TranscoderLocation(t){Hh.setKTX2TranscoderLocation(t)}static get ktx2TranscoderLocation(){return Hh.getKTX2TranscoderLocation()}static mapURLs(t){Dd.singleton.loader[kh].manager.setURLModifier(t)}dismissPoster(){this[Cp]()?this[wf]():(this[xf]=Af,this[up]())}showPoster(){const t=this[vf],e=this[yf];e.removeAttribute("tabindex"),e.removeAttribute("aria-hidden"),t.classList.add("show");const n=this.modelIsVisible;this[Ef]=!1,this[lp](n),this[If]=!1}getDimensions(){return Sp(this[gp].size)}connectedCallback(){super.connectedCallback(),this[vf].addEventListener("click",this[Mf]),this[vf].addEventListener("keydown",this[Sf]),this[Ep].addEventListener("progress",this[Bf]),mf.registerInstance(this)}disconnectedCallback(){super.disconnectedCallback(),this[vf].removeEventListener("click",this[Mf]),this[vf].removeEventListener("keydown",this[Sf]),this[Ep].removeEventListener("progress",this[Bf]),mf.unregisterInstance(this)}async updated(t){super.updated(t),t.has("poster")&&null!=this.poster&&(this[yf].style.backgroundImage=`url(${this.poster})`),t.has("alt")&&this[yf].setAttribute("aria-label",`${this[cp]}. ${this[Cf]}`),(t.has("reveal")||t.has("loading"))&&this[up]()}[(e=Ef,n=If,i=_f,r=xf,s=vf,a=yf,o=gf,l=ff,c=Cf,h=bf,u=Mf,d=Sf,p=Bf,Ip)](){return!!this.src&&(null!=this[xf]||this.loading===pf||this.reveal===hf&&this[op])}[Cp](){const{src:t}=this;return!!t&&super[Cp]()&&1===this[_f]}[wf](){this[xf]=null;const t=this[vf],e=this[yf];if(t.classList.contains("show")){t.classList.remove("show");const n=this.modelIsVisible;this[Ef]=!0,this[lp](n),t.addEventListener("transitionend",(()=>{requestAnimationFrame((()=>{this[If]=!0;const t=this.getRootNode();t&&t.activeElement===this&&this[Ap].focus(),e.setAttribute("aria-hidden","true"),e.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}))}),{once:!0})}}[_p](){return super[_p]()&&this[Ef]}[Mp](){return super[Mp]()&&this[If]}async[up](){this[_f]=0,null!=this[gp].currentGLTF&&null!=this.src&&this[Ip]()||this.showPoster(),await super[up]()}}return cf([F({type:String})],A.prototype,"poster",void 0),cf([F({type:String})],A.prototype,"reveal",void 0),cf([F({type:String})],A.prototype,"loading",void 0),A})((t=>{var e;class n extends t{constructor(){super(...arguments),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[e]=!0}get availableAnimations(){return this.loaded?this[gp].animationNames:[]}get duration(){return this[gp].duration}get paused(){return this[Rp]}get currentTime(){return this[gp].animationTime}set currentTime(t){this[gp].animationTime=t,this[wp].threeRenderer.shadowMap.needsUpdate=!0,this[fp]()}pause(){this[Rp]||(this[Rp]=!0,this[wp].threeRenderer.shadowMap.autoUpdate=!1,this.dispatchEvent(new CustomEvent("pause")))}play(){this[Rp]&&this.availableAnimations.length>0&&(this[Rp]=!1,this[wp].threeRenderer.shadowMap.autoUpdate=!0,this[gp].hasActiveAnimation||this[Lp](),this.dispatchEvent(new CustomEvent("play")))}[(e=Rp,yp)](){super[yp](),this[Rp]=!0,this.autoplay&&(this[Lp](),this.play())}[vp](t,e){super[vp](t,e),this[Rp]||!this[Mp]()&&!this[wp].isPresenting||(this[gp].updateAnimation(e/1e3),this[fp]())}updated(t){super.updated(t),t.has("autoplay")&&this.autoplay&&this.play(),t.has("animationName")&&this[Lp]()}async[up](){return this[gp].stopAnimation(),super[up]()}[Lp](){this[gp].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3),this[Rp]&&(this[gp].updateAnimation(0),this[fp]())}}return Tp([F({type:Boolean})],n.prototype,"autoplay",void 0),Tp([F({type:String,attribute:"animation-name"})],n.prototype,"animationName",void 0),Tp([F({type:Number,attribute:"animation-crossfade-duration"})],n.prototype,"animationCrossfadeDuration",void 0),n})((t=>{var e;const n=Symbol("endPolyfillCoordination");return e=n,class extends t{constructor(){super(...arguments),this[e]=null}connectedCallback(){super.connectedCallback&&super.connectedCallback(),null==this[n]&&(this[n]=(t=>{if(null==t.shadowRoot||t.hasAttribute("data-js-focus-visible"))return()=>{};if(!self.applyFocusVisiblePolyfill){const e=()=>{self.applyFocusVisiblePolyfill(t.shadowRoot)};return self.addEventListener("focus-visible-polyfill-ready",e,{once:!0}),()=>{self.removeEventListener("focus-visible-polyfill-ready",e)}}return self.applyFocusVisiblePolyfill(t.shadowRoot),()=>{}})(this))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),null!=this[n]&&(this[n](),this[n]=null)}}})(Bp)))))))));customElements.define("model-viewer",py);export{py as ModelViewerElement};
//# sourceMappingURL=model-viewer.min.js.map
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.