3D Mapbox
How do I make an 3d mapbox?
Mapping satellite tiles to a css animated 3d box. Don't forget to check out the zoom!. What is a 3d mapbox? How do you make a 3d mapbox? This script and codes were developed by Moklick on 20 November 2022, Sunday.
3D Mapbox - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>3D Mapbox</title> <link rel='stylesheet prefetch' href='http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css'> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ *{padding:0;margin:0;}
html,body{ width:100%;height:100%;
}
body { font-family:sans-serif; background: #ededef; color:#333;
}
#map { width:768px; height: 512px; opacity:0; position: absolute; top:-2000px;
}
.terms{ position:absolute;bottom:0;right:0;background:#fff; font-size:10px; opacity:.7;
}
.zoom-control{ position:absolute; right:15px; top:10px;
}
.zoom-control div{ font-size:30px; line-height: 30px; padding:10px 15px; background:#555; margin-bottom:5px; cursor:pointer; user-select:none; opacity:.7; color:#eee;
}
.zoom-control div:hover{ opacity:1;
}
.wrap { perspective: 700px; perspective-origin: 50% 50px;
}
.cube { position: relative; width: 200px; margin: 0 auto; padding-top: 150px; transform-style: preserve-3d; animation: rotate 10s infinite linear;
}
.cube div { position: absolute; width: 300px; height: 300px; background: rgba(255,255,255,0.25); box-shadow: 2px 0px 10px rgba(0,0,0,0.75);
}
.cube img{ width:300px; height:300px;
}
.back { transform: translateZ(-150px) rotateY(180deg);
}
.right { transform: rotateY(-270deg) translateX(150px); transform-origin: top right;
}
.left { transform: rotateY(270deg) translateX(-150px); transform-origin: center left;
}
.top { transform: rotateX(-90deg) translateY(-150px); transform-origin: top center;
}
.bottom { transform: rotateX(90deg) translateY(150px); transform-origin: bottom center;
}
.front { transform: translateZ(150px);
}
@keyframes rotate { from { transform: rotateY(0); } to { transform: rotateY(360deg); }
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <!-- 3d cube code mostly from http://davidwalsh.name/css-cube
-->
<div class="global"> <div id="map"></div> <div class="wrap"> <div class="cube"> <div class="front"></div> <div class="back"></div> <div class="top"></div> <div class="bottom"></div> <div class="left"></div> <div class="right"></div> </div> </div> <div class="zoom-control"> <div class="zoom-btn" data-opt="in">+</div> <div class="zoom-btn" data-opt="out">–</div> </div> <div class="terms"><a href="https://www.mapbox.com/about/maps/" target="_blank">Terms & Services</a></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js'></script> <script src="js/index.js"></script>
</body>
</html>
3D Mapbox - Script Codes CSS Codes
*{padding:0;margin:0;}
html,body{ width:100%;height:100%;
}
body { font-family:sans-serif; background: #ededef; color:#333;
}
#map { width:768px; height: 512px; opacity:0; position: absolute; top:-2000px;
}
.terms{ position:absolute;bottom:0;right:0;background:#fff; font-size:10px; opacity:.7;
}
.zoom-control{ position:absolute; right:15px; top:10px;
}
.zoom-control div{ font-size:30px; line-height: 30px; padding:10px 15px; background:#555; margin-bottom:5px; cursor:pointer; user-select:none; opacity:.7; color:#eee;
}
.zoom-control div:hover{ opacity:1;
}
.wrap { perspective: 700px; perspective-origin: 50% 50px;
}
.cube { position: relative; width: 200px; margin: 0 auto; padding-top: 150px; transform-style: preserve-3d; animation: rotate 10s infinite linear;
}
.cube div { position: absolute; width: 300px; height: 300px; background: rgba(255,255,255,0.25); box-shadow: 2px 0px 10px rgba(0,0,0,0.75);
}
.cube img{ width:300px; height:300px;
}
.back { transform: translateZ(-150px) rotateY(180deg);
}
.right { transform: rotateY(-270deg) translateX(150px); transform-origin: top right;
}
.left { transform: rotateY(270deg) translateX(-150px); transform-origin: center left;
}
.top { transform: rotateX(-90deg) translateY(-150px); transform-origin: top center;
}
.bottom { transform: rotateX(90deg) translateY(150px); transform-origin: bottom center;
}
.front { transform: translateZ(150px);
}
@keyframes rotate { from { transform: rotateY(0); } to { transform: rotateY(360deg); }
}
3D Mapbox - Script Codes JS Codes
var map = new L.Map('map', { center: new L.LatLng(52.520, 13.385), zoom: 13
}), layer = new L.tileLayer('http://{s}.tiles.mapbox.com/v3/moklick.lh736gg3/{z}/{x}/{y}.png', { minZoom: 5, maxZoom: 18
});
map.addLayer(layer);
map.on('viewreset',updateCube);
$('.zoom-btn').on('click', function(){ $(this).attr('data-opt') === 'in' ? map.zoomIn() : map.zoomOut();
});
function updateCube(){ var tiles = $('.leaflet-tile-container').find('img'), cubeSides = $('.cube').find('div'); for(var i = 0; i < cubeSides.length; i++){ cubeSides.eq(i).html(tiles.eq(i).attr('style', '')); }
}
updateCube();

Developer | Moklick |
Username | moklick |
Uploaded | November 20, 2022 |
Rating | 3 |
Size | 3,508 Kb |
Views | 18,207 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Berlin Building Map | 2,477 Kb |
Money Over Everything | 3,392 Kb |
Damn Particlez | 2,805 Kb |
Fullscreen fun | 1,984 Kb |
Leaflet Transition Example | 33,818 Kb |
CSS Text-FX | 2,096 Kb |
... is watching you | 2,423 Kb |
CCTV Everywhere | 3,723 Kb |
Zeichensatz | 2,058 Kb |
Responsive Codepen Glitch | 2,838 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Retina canvas w. resize | Erikterwan | 1,882 Kb |
Sticky div | Kaslab | 2,225 Kb |
Get third wednesday | Wojtek1150 | 2,691 Kb |
To Do List with Delete | Mattlbrody | 2,068 Kb |
Mega Menu by Joni | Asakasinsky | 3,171 Kb |
Slider for stackoverflow | KKOKU | 3,222 Kb |
Animated rainbow wave on canvas | Icodeforlove | 2,777 Kb |
Heatmap Color Scales | Stevepepple | 2,331 Kb |
Alter bg opacity on hover... | Chrisboon27 | 2,054 Kb |
Simple Buttons | Haydenmills | 1,750 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!