D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
Hirosaji
Full window
Github gist
Mapbox GL JS - Movie on Map
Built with
blockbuilder.org
<!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <title>Add a video</title> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.48.0/mapbox-gl.js'></script> <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.48.0/mapbox-gl.css' rel='stylesheet' /> <style> body { margin:0; padding:0; } #map { position:absolute; top:0; bottom:0; width:100%; } </style> </head> <body> <div id='map'></div> <script> var videoStyle = { "version": 8, "sources": { "satellite": { "type": "raster", "url": "mapbox://mapbox.satellite", "tileSize": 256 }, "video": { "type": "video", "urls": ["./movie.mp4"], "coordinates": [ [141.40009394836426, 43.062391708549425], [141.40123120498657, 43.06061849366671], [141.40296391201019, 43.06138816766053], [141.40167645168304, 43.06310183312965] ] } }, "layers": [{ "id": "background", "type": "background", "paint": { "background-color": "rgb(4,7,14)" } }, { "id": "satellite", "type": "raster", "source": "satellite" }, { "id": "video", "type": "raster", "source": "video" }] }; mapboxgl.accessToken = 'pk.eyJ1IjoiaGlyb3NhamkiLCJhIjoiY2szOWljb210MDJxcjNjcXRwZGF6bmJnMiJ9.gin_FUY4wc61PoNKnUWL5Q'; var map = new mapboxgl.Map({ container: 'map', // container id minZoom: 14, zoom: 16, style: videoStyle, // stylesheet location center: [141.4015, 43.06175], // starting position [lng, lat] bearing: -96 }); </script> </body> </html>
https://api.tiles.mapbox.com/mapbox-gl-js/v0.48.0/mapbox-gl.js