UNPKG

@here/harp-examples

Version:
1 lines 3.1 kB
(()=>{"use strict";var e={2158:(e,t,n)=>{t.S=void 0;const o=n(8957),r=n(3074),a=n(4428),i=n(4038);!function(e){let t=0;const n=[{target:new o.GeoCoordinates(52.5308419,13.3850719),tilt:0,heading:0,distance:1e3},{target:new o.GeoCoordinates(52.5169285,13.4010829),tilt:45,heading:45,distance:300},{target:new o.GeoCoordinates(52.520836,13.409401,300),tilt:45,heading:180,distance:500}],l=document.createElement("div");function s(e,t){const n=e.camera.position.clone(),o=e.camera.quaternion.clone(),i=r.MapViewUtils.getCameraPositionFromTargetCoordinates(t.target,t.distance,t.heading,t.tilt,e.projection),l=r.MapViewUtils.getCameraRotationAtTarget(e.projection,t.target,t.heading,t.tilt),s=Date.now(),c=new a.CatmullRomCurve3([n,i]),p=()=>{let t=(Date.now()-s)/1e3;t>=1&&(t=1,e.endAnimation(),e.removeEventListener(r.MapViewEventNames.Render,p)),e.camera.position.copy(c.getPoint(t));const n=o.clone().slerp(l,t);e.camera.quaternion.copy(n),e.camera.updateMatrixWorld(!0)};e.addEventListener(r.MapViewEventNames.Render,p),e.beginAnimation()}l.innerHTML='Example showing camera animations using\n<a href="https://threejs.org">three.js</a>\n<br>\nTap our use left/right keys to change location',l.style.cssText="\n color: #000;\n width: 80%;\n left: 50%;\n position: relative;\n margin-left: -40%;\n font-size: 15px;\n ",document.body.appendChild(l),s(i.HelloWorldExample.mapView,n[0]),window.ontouchend=e=>{const o=n[t];t++,t>=n.length&&(t=0);const r=n[t];o!==r&&s(i.HelloWorldExample.mapView,r)},window.onkeydown=e=>{const o=n[t];switch(e.code){case"ArrowLeft":t--;break;case"ArrowRight":t++}t<0?t=n.length-1:t>=n.length&&(t=0);const r=n[t];o!==r&&s(i.HelloWorldExample.mapView,r)}}(t.S||(t.S={}))},4428:e=>{e.exports=THREE}},t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={exports:{}};return e[o].call(r.exports,r,r.exports,n),r.exports}n.m=e,n.x=e=>{},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.j=413,(()=>{var e={413:0,738:0},t=[[2158,592]],o=e=>{},r=(r,a)=>{for(var i,l,[s,c,p,d]=a,h=0,u=[];h<s.length;h++)l=s[h],n.o(e,l)&&e[l]&&u.push(e[l][0]),e[l]=0;for(i in c)n.o(c,i)&&(n.m[i]=c[i]);for(p&&p(n),r&&r(a);u.length;)u.shift()();return d&&t.push.apply(t,d),o()},a=self.webpackChunk_here_harp_examples=self.webpackChunk_here_harp_examples||[];function i(){for(var o,r=0;r<t.length;r++){for(var a=t[r],i=!0,l=1;l<a.length;l++){var s=a[l];0!==e[s]&&(i=!1)}i&&(t.splice(r--,1),o=n(n.s=a[0]))}return 0===t.length&&(n.x(),n.x=e=>{}),o}a.forEach(r.bind(null,0)),a.push=r.bind(null,a.push.bind(a));var l=n.x;n.x=()=>(n.x=l||(e=>{}),(o=i)())})(),n.x()})();