Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
  <title>
    Breath of the Arctic
  </title>
  <link rel="stylesheet" href="style/style.css" />

  <link rel="stylesheet" href="https://js.arcgis.com/4.30/esri/themes/dark/main.css" />
  <script src="https://js.arcgis.com/4.30/"></script>
  <script src="app/main.js"></script>
  <script type="module" src="https://js.arcgis.com/calcite-components/2.1.0/calcite.esm.js"></script>
    <style>
        .custom-example-theme {
            --calcite-color-brand: #96d4d4;
            --calcite-color-brand-hover: #6ca6a6;
            --calcite-color-brand-press: #408787;
        }
    </style>
</head>

<body class="calcite-mode-dark custom-example-theme" >
  <calcite-shell>
    <calcite-modal aria-labelledby="modal-title" id="modal">
      <div slot="header" id="modal-title">BREATH OF THE ARCTIC
      </div>
      <div slot="content">
        <div id="contener">
          <img id="mapthumbnail">
          <div id="desc">Cette application représente les variations d'étendue de l'Arctique, c'est-à-dire des parties de l'océan ayant gelé pour former une "mer de glace", de la fin de l'année 1978 à nos jours. La ligne discontinue blanche montre la superficie maximale enregistrée en mars 1979.<br>A l'image d'un cœur qui bat ou d'un poumon qui respire, l'Arctique se dilate et se rétracte au rythme des saisons, mais il est aussi clair que la superficie moyenne de celui-ci ne cesse de diminuer.<br>Retrouvez plus d'informations sur la création de cette application dans <a href="https://www.codethemap.fr/2024/11/30-day-map-challenge-space-and-time.html" target="_blank">cet article</a>.<br><i>Les données proviennent du <a href="https://nsidc.org/data/search#keywords=G02135" target="_blank">National Snow and Ice Data Center</a> et sont accessibles <a href="https://esrifrance.maps.arcgis.com/home/item.html?id=d1fb8225058e4a0d96ead7b9a574a652" target="_blank">depuis le Living Atlas d'ArcGIS</a>.</i> </div>
        </div>
      </div>
    </calcite-modal>
  </calcite-shell>

  <div id="full">

    <div class="titre">
      <h3>- BREATH OF THE ARCTIC -</h3>
    </div>

    <div id="dateDisplay">
      <h3>-/-</h3>
    </div>
    <div id="viewDiv"></div>
    <div class="mentions">
      <h4> <a href="https://30daymapchallenge.com/" target="_blank">#30DAYSMAPCHALLENGE </a> JOUR 12 : TIME & SPACE <br> RENDU INTERACTIF AVEC <a href="https://developers.arcgis.com/javascript/latest/" target="_blank">L'API JAVASCRIPT D'ARCGIS</a> <br>GITHUB : <a href="https://github.com/JapaLenos/JS-API" target="_blank">@JAPALENOS</a>
        <div id="about"><a href="#">EN SAVOIR +</a></div>
      </h4>
    </div>
  </div>
  <div id="loader">
    <calcite-loader label="Chargement de la page" scale="l"></calcite-loader>
  </div>

</body>

</html>
              
            
!

CSS

              
                html,
body,
#viewDiv {
  padding: 0;
  margin: 0;
  height: 100%;
  width: 100%;
  position: absolute;
  background-color: "#212526";
}
#loader {
  position: absolute;
  width: 100%;
  top: 50%;
  transform: translate(0%, -50%);
  display: flex;
  justify-content: center;
}

h3 {
  z-index: 200;
  padding-top: 1%;
  font-weight: normal;
  font-size: 170%;
  font-family: "Avenir Next", "Avenir", "Helvetica Neue", sans-serif;
  color: #dbcdcb;
  position: absolute;
  z-index: 9;
  text-align: center;
  width: 100%;
  height: 10%;
  margin: auto;
  user-select: none;
}
h4 {
  padding-top: 1%;
  font-weight: normal;
  font-size: 70%;
  font-family: "Avenir Next", "Avenir", "Helvetica Neue", sans-serif;
  color: #dbcdcb;
  position: absolute;
  z-index: 10;
  text-align: left;
  margin-left: 5%;
  bottom: 1%;
  user-select: none;
}

a {
  color: rgb(150, 212, 212);
  font-weight: bold;
  text-decoration: none;
}
a:hover {
  color: rgb(108, 166, 166);
  text-decoration: none;
}

#dateDisplay {
  z-index: 150;
  font-weight: normal;
  position: absolute;
  font-size: 120%;
  font-family: "Avenir Next", "Avenir", "Helvetica Neue", sans-serif;
  position: absolute;
  user-select: none;
  padding-top: 1.6%;
}
@media screen and (min-width: 500px) {
  #dateDisplay {
    right: 1%;
  }
}
@media screen and (max-width: 500px) {
  #dateDisplay {
    width: 100%;
    text-align: center;
    top: 5%;
  }
}

#contener {
  display: flex;
}

#desc {
  padding-left: 3%;
}

#credits {
  padding-top: 2%;
}

              
            
!

JS

              
                require([
  "esri/WebMap",
  "esri/views/MapView",
  "esri/layers/FeatureLayer",
  "esri/layers/GraphicsLayer",
  "esri/Graphic"
], function (WebMap, MapView, FeatureLayer, GraphicsLayer, Graphic) {
  
  const map = new WebMap({
    portalItem: {
      id: "360827c4ab4f4aad85b771bd453a7254"
    }
  });

  const view = new MapView({
    container: "viewDiv",
    map: map,
    center: [2277430.5171051705, 2076536.5900727776],
    zoom: 4,
    constraints: {
      maxZoom: 4,
      minZoom: 4
    }
  });
  view.ui.remove(["zoom"]);

  map.when(() => {
    const arcticExtentLayer = map.layers.items[2];
    arcticExtentLayer.visible = false;
    const graphicsLayer = new GraphicsLayer();
    map.add(graphicsLayer);

    arcticExtentLayer.queryFeatures().then((results) => {
      const features = results.features.map((feature) => {
        return new Graphic({
          geometry: feature.geometry,
          attributes: feature.attributes,
          symbol: {
            type: "simple-fill",
            color: [203, 242, 242, 0.3],
            outline: { color: [133, 242, 242], width: 1 }
          }
        });
      });

      let index = 0;
      let previousYear = null;
      function displayFeature() {
        graphicsLayer.removeAll();
        const currentFeature = features[index];
        graphicsLayer.add(currentFeature);

        // Récupérez les informations de date et mettez à jour l'affichage
        const month = currentFeature.attributes["Rec_Month"];
        const year = currentFeature.attributes["Rec_Year"];
        dateDisplay.innerHTML = `${month}/${year}`;
        if (year % 2 === 0) {
          dateDisplay.style.color = "rgb(108, 166, 166)"; // Années paires en bleu foncé
        } else {
          dateDisplay.style.color = "rgb(150, 212, 212)"; // Années impaires en bleu clair
        }

        index = (index + 1) % features.length;
      }

      setInterval(displayFeature, 100); // Mise à jour toutes les 100 ms
    });
    view.watch("updating", function () {
      loader.style.display = "none";
    });
    const modal = document.getElementById("modal");
    about?.addEventListener("click", function () {
      modal.open = true;
    });
  });
});

              
            
!
999px

Console