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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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 id="sceneDiv">
</div>
<div id="blurDiv">
</div>
<div id="viewDiv">
  <div id="compass">
    <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="46.5pt" height="107.5pt" viewBox="0 0 93.000000 215.000000" preserveAspectRatio="xMidYMid meet">
<g transform="translate(0.000000,215.000000) scale(0.100000,-0.100000)"
fill="rgba(255,255,255,0.7)" stroke="none">
<path d="M880 2142 c0 -8 -68 -103 -189 -264 -27 -37 -46 -70 -42 -72 5 -3 53
3 107 13 55 11 100 18 101 17 2 -2 4 -491 3 -1212 l0 -321 -396 394 c-303 301
-402 393 -418 391 l-21 -3 -3 -543 -2 -542 30 0 30 0 0 489 0 489 90 -86 c50
-48 146 -141 213 -207 452 -446 476 -468 502 -461 l25 6 0 960 c0 847 -2 960
-15 960 -8 0 -15 -4 -15 -8z"/>
</g>
</svg>
  </div>
  <div id="john">
    <a href="https://www.esri.com/arcgis-blog/products/arcgis-pro/mapping/making-this-map-of-panama/" target="_blank">
      <img width="100px" height="100px" src="https://www.esri.com/arcgis-blog/wp-content/uploads/2018/04/Profile.jpg"/>
      <p>Inspired by John Nelson</p>
    </a>
  </div>
</div>
              
            
!

CSS

              
                html,
body {
  padding: 0;
  margin: 0;
  height: 100%;
  width: 100%;
  background: rgb(144, 163, 181);
  background: linear-gradient(
    180deg,
    rgba(144, 163, 181, 1) 2%,
    rgba(245, 246, 248, 1) 50%,
    rgba(214, 220, 226, 1) 90%
  );
  font-family: "Avenir Next W01", "Arial", sans-serif;
}

#viewDiv {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

#viewDiv canvas {
  filter: drop-shadow(0px 20px 15px #888) contrast(80%);
}

#sceneDiv {
  position: absolute;
  top: 0;
  right: 0;
  height: 50%;
  width: 50%;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 15%, rgba(0, 0, 0, 0) 45%);
  mask-image: radial-gradient(circle at 50% 50%, black 15%, rgba(0, 0, 0, 0) 45%);
}

#blurDiv {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

#blurDiv canvas {
  filter: blur(4px) grayscale(80%) opacity(40%);
}

#compass {
  padding: 1em;
  margin-left: 3em;
  cursor: pointer;
  box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px;
}

#compass > svg {
  -webkit-filter: drop-shadow(10px 10px 10px rgba(0, 0, 0, 0.9));
  filter: drop-shadow(10px 10px 10px rgba(0, 0, 0, 0.9));
}

/*
  John related
*/

#john {
  display: flex;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 1em;
  height: 100px;
  width: 200px;
  margin-left: 3em;
  cursor: pointer;
  box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px;
}

#john img {
  display: block;
  margin: 0 auto;
}

#john a {
  opacity: 0;
  color: #828282
}

#john a p {
  color: #828282;
}

#john:hover a {
  opacity: 1;
  -webkit-animation: fadein 2s;
  -moz-animation: fadein 2s;
  -ms-animation: fadein 2s;
  animation: fadein 2s;
}

/*fadein*/
@keyframes fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@-moz-keyframes fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@-webkit-keyframes fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

              
            
!

JS

              
                require([
  "esri/Map",
  "esri/views/MapView",
  "esri/views/SceneView",
  "esri/layers/FeatureLayer",
  "esri/layers/TileLayer",
  "esri/widgets/Compass/CompassViewModel"
], function(
  ArcGISMap,
  MapView,
  SceneView,
  FeatureLayer,
  TileLayer,
  CompassViewModel
) {
  // 9331485ecbc9400a9059ce15a88136ce
  const tileLayer = new TileLayer({
    portalItem: { id: "3d744e3eb6a64e9cade759917d50b83e" },
    opacity: 0.7,
    minScale: 0,
    maxScale: 0
  });

  const countriesLayer = new FeatureLayer({
    portalItem: { id: "f1a10a378c534940ba11d9ad8921ea01" },
    renderer: {
      type: "unique-value",
      field: "Name",
      defaultSymbol: {
        type: "simple-fill",
        color: "rgba(245,246,248,0.5)",
        outline: {
          width: 0.5,
          color: "rgba(144,163,181, 0.5)"
        }
      },
      uniqueValueInfos: [
        {
          value: "Panama",
          symbol: {
            type: "simple-fill",
            color: "#89a294",
            outline: {
              width: 2,
              color: "rgba(144,163,181, 0.7)"
            }
          }
        }
      ]
    }
  });
  
  const blurCountriesLayer = new FeatureLayer({
    portalItem: { id: "f1a10a378c534940ba11d9ad8921ea01" },
    definitionExpression: "Name <> 'Panama'",
    renderer: {
      type: "unique-value",
      field: "Name",
      defaultSymbol: {
        type: "simple-fill",
        color: "rgba(245,246,248,0.8)",
        outline: {
          width: 2,
          color: "rgba(144,163,181, 0.7)"
        }
      },
      uniqueValueInfos: [
        {
          value: "Panama",
          symbol: {
            type: "simple-fill",
            color: "rgba(144,163,181, 0)",
            outline: {
              width: 2,
              color: "rgba(144,163,181, 1)"
            }
          }
        }
      ]
    }
  });

  const grid = new FeatureLayer({
    portalItem: {
      id: "5ee596c843ba4b56971bae0ff017acb5"
    },
    renderer: {
      type: "simple",
      symbol: {
        type: "simple-line",
        color: [226, 255, 255, 0.8],
        width: "2px"
      }
    },
    opacity: 0.4
  });

  const map = new ArcGISMap({
    layers: [tileLayer]
  });
  
  const blurMap = new ArcGISMap({
    layers: [blurCountriesLayer]
  });

  const mapScene = new ArcGISMap({
    layers: [grid, countriesLayer],
    ground: {
      surfaceColor: [226, 240, 255, 0],
      opacity: 0
    }
  });

  const view = new MapView({
    container: "viewDiv",
    map: map,
    scale: 3300000,
    center: [-80.15, 8.72],
    rotation: 45,
    constraints: {
      snapToZoom: false
    },
    ui: {
      components: ["attribution"]
    },
    popup: null
  });
  
  const blurView = new MapView({
    container: "blurDiv",
    map: blurMap,
    scale: view.scale,
    center: view.center,
    rotation: 45,
    constraints: {
      snapToZoom: false
    },
    ui: {
      components: ["attribution"]
    },
    popup: null
  });

  const sceneView = new SceneView({
    container: "sceneDiv",
    map: mapScene,
    center: view.center,
    ui: {
      components: []
    },
    alphaCompositingEnabled: true,
    pixelRatio: window.devicePixelRatio,
    environment: {
      background: {
        type: "color",
        color: [255, 252, 255, 0]
      },
      starsEnabled: false,
      atmosphereEnabled: false
    }
  });
  
  view.watch("extent, center, rotation", (value, _, property) => {
    switch (property) {
      case "center":
        blurView.center = sceneView.center = value;
        break;
      case "rotation":
        blurView.rotation = value;
        break;
      default: // extent
        blurView.extent = value;
    }
  });

  // north arrow
  const transforms = [
    "webkitTransform",
    "mozTransform",
    "msTransform",
    "oTransform",
    "transform"
  ];
  const rotateCompass = (node, deg) => {
    transforms.forEach(transform => {
      node.style[transform] = `rotate(${deg}deg)`;
    });
  };
  const compassVM = new CompassViewModel({ view });
  const compass = document.getElementById("compass");
  rotateCompass(compass, 45);
  compassVM.watch("orientation", ({ z }) => {
    if (!z) return;
    rotateCompass(compass, z);
  });
  view.ui.add(compass, "bottom-left");
  compass.addEventListener("click", () => {
    view.rotation = 45;
  });
  
  view.ui.add("john", "bottom-right");
  
});

              
            
!
999px

Console