Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="info">
	<h1>Radar <not-anymore>Google maps</not-anymore> MapBox</h1>
	<p>Below this CSS rotating PNG is a <not-anymore>Google maps</not-anymore> MapBox map. <br />Between them are some SVG which <em>masks out</em> the radar image, and some lines and circles to make it look more like a radar.</p>
	<p>You may drag the map and zoom in and out. Events and dragging of anything but the map has been disabled using CSS <code>pointer-events: none;
	user-select: none;</code></p>
	
</div>
<svg width="1600" height="1600" viewbox="0 0 600 600" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" id="grid">

<path d="M 110 30 l 0 30 M 115 30 l 0 30"  fill="none"  />
<path d="M 110 165 l 0 30 M 115 165 l 0 30"  fill="none"  />
<path d="M 60 115 l -30 0 M 60 110 l -30 0"  fill="none"  />
<path d="M 195 115 l -30 0 M 195 110 l -30 0"  fill="none"  />
	<circle cx="112" cy="112" r="72" />
	<circle cx="112" cy="112" r="45" />
	<circle cx="112" cy="112" r="22" />
	<circle cx="112" cy="112" r="20" />
	<circle cx="112" cy="112" r="10" />
</svg>
<img id="radar" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/9729/circle.png" alt="" />
<svg width="3200" height="3200" viewbox="0 0 1200 1200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
	  <mask id="mask2" x="0" y="0" width="80" height="80" >
  <path d="M 0 0 L 2600 0 2600 2600 0 2600 0 0 M 185 185 m -150, 0 a 150,150 0 1,0 300,0 a 150,150 0 1,0 -300,0" fill="white" style="transform: scale(.6);" />
    </mask>
	
	  <rect x="0" y="0" width="600" height="600" fill="black" style="mask: url(#mask2);"/>
	  <rect x="300" y="0" width="2600" height="2600" fill="black" style="mask: url(#mask2);"/>
	  
</svg>

<!-- <iframe1 width="600" height="420" src="http://maps.stamen.com/toner/embed#12/37.7848/-122.2909"></iframe> -->

<div id="map"></div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Inconsolata:400,700|Open+Sans:400,800);

html, body {
	background: black;
	font-family: 'Inconsolata', monospace ;
font-family: 'Open Sans', sans-serif;
	height: 100%;
	width: 100%;
	padding: 0;
	margin: 0;
	overflow: hidden;
}
img#radar {
	left: 0px;
	top: 0px;
	position: absolute;
	pointer-events: none;
	user-select: none;
animation: rotate 5s infinite;
  transform-origin: 300px 300px;
  animation-timing-function: linear;
	opacity: 1;
	z-index: 10;
	
}
@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(359deg);
  }
}

svg {
	position: absolute;
	top: 0;
	left: 0;
	pointer-events: none;
	user-select: none;
	z-index: 11;
}


#map {
	position: absolute;
	top: 0;
	left: 0;
                width: 100%;
                height: 100%;
	z-index: 1;
            }

#grid {
	z-index: 42;
}

#grid  {
	stroke: rgba(230,255,0,.24);
	stroke-width: .5px;
	fill: none;
}

.info {
	pointer-events: none;
	user-select: none;
	width: 250px;
	position: absolute;
	z-index: 30;
	left: 600px;
	color: yellow;
	top: 80px;
}

a {
	color: white;
	pointer-events: all;
	
}

not-anymore {
	text-decoration: line-through;
	text-decoration-color: black;
}
              
            
!

JS

              
                
	var lat = 56.713;
	var lng = 21.1644;

	function showMap() {
		try {
			mapboxgl.accessToken = 'pk.eyJ1IjoibmV0c2kxOTY0IiwiYSI6IjZoWnczSG8ifQ.byXRLP6pzJHH770wOA5wTw';
			var map = new mapboxgl.Map({
				container: "map",
				style: "mapbox://styles/mapbox/light-v10",
				center: [lng, lat], // starting position [lng, lat]
				zoom: 3, // starting zoom
				pitch: 0
			});
		} catch (e) {
			alert("Error trying to add map:\n" + e.message);
		}
	}

	fetch("https://ipinfo.io")
		.then(json => {
			var loc = json.loc.split(",");
			lat = loc[0];
			lng = loc[1];
		})
		.catch(err => {
			alert("Error fetching lat long:\n" + error.message);
		})
		.finally(() => showMap());


              
            
!
999px

Console