# How to Build Disaster Simulations on a Real Map: Animated Canvas Layers and Collapsing 3D Buildings with Mapbox GL JS and Three.js

DevFeed: [How to Build Disaster Simulations on a Real Map: Animated Canvas Layers and Collapsing 3D Buildings with Mapbox GL JS and Three.js](<https://devfeed.tech/articles/how-to-build-disaster-simulations-on-a-real-map-animated-canvas-layers-and-collapsing-3d-buildings-with-mapbox-gl-js-and-three-js-87554.md>)

Original publisher: [Read original article](<https://www.freecodecamp.org/news/disaster-simulation-real-map-mapbox-three-js/>)

Author: Alex Oliinyk

Published: 2026-10-15T04:40:21Z

Content type: tutorial

Language: en

Sources: [Free Code Camp](<https://devfeed.tech/sources/freecodecamp-programming-tutorials-python-javascript-git-more.md>)

Topics: [interactive web graphics](<https://devfeed.tech/topics/interactive-web-graphics.md>), [Three.js](<https://devfeed.tech/topics/threejs.md>), [Google Maps](<https://devfeed.tech/topics/google-maps.md>), [GPU instancing](<https://devfeed.tech/topics/gpu-instancing.md>), [signed distance functions](<https://devfeed.tech/topics/signed-distance-functions.md>)

Tags: [3d](<https://devfeed.tech/tags/3d.md>), [absolute](<https://devfeed.tech/tags/absolute.md>), [breadth-first-search](<https://devfeed.tech/tags/breadth-first-search.md>), [canvas](<https://devfeed.tech/tags/canvas.md>), [disaster](<https://devfeed.tech/tags/disaster.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [js](<https://devfeed.tech/tags/js.md>), [mapbox](<https://devfeed.tech/tags/mapbox.md>), [simulations](<https://devfeed.tech/tags/simulations.md>), [three-js](<https://devfeed.tech/tags/three-js.md>), [web-development](<https://devfeed.tech/tags/web-development.md>)

## AI overview

A tutorial explains how to build browser-based disaster simulations on real maps. It covers aligning a simulation grid to map tiles, loading elevation data, rendering animated floods as map-draped canvas sources, and using terrain-aware breadth-first search. For earthquakes, it combines Mapbox building extrusions with a Three.js scene for collapsing structures, debris, and dust, with techniques for animation, camera movement, and performance.

## Source excerpt

At some point, a map project needs more than markers and polygons. You want something to happen on the map: water moving up a street, smoke drifting with the wind, or a shockwave spreading out from a