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,216 |
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 |
Zeichensatz | 2,058 Kb |
Responsive Codepen Glitch | 2,838 Kb |
Codepen Inception | 1,384 Kb |
Hitman Loading Sequence pure css3 | 3,402 Kb |
... is watching you | 2,423 Kb |
A Pen by moklick | 33,698 Kb |
CSS Text-FX | 2,096 Kb |
Damn Particlez | 2,805 Kb |
CCTV Everywhere | 3,723 Kb |
Money Over Everything | 3,392 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 |
CSS3 Butterfly | Timohausmann | 3,430 Kb |
Gears | Synvox | 3,278 Kb |
Tic Tac Toe | Volv | 4,862 Kb |
Iron Man SVG Loading Animation | Andythayer | 3,069 Kb |
Getting Started | Viblast | 1,500 Kb |
Scroll using CSS | Casperovic | 2,159 Kb |
A form arranged using automatic placement. | Vikasford | 2,103 Kb |
SVG Basics | HipsterBrown | 1,852 Kb |
Animated SVG stroke-dasharray | Netsi1964 | 3,179 Kb |
Super Discount | Orrinward | 3,225 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!