Skip to content

Instantly share code, notes, and snippets.

@samarkandiy
Created July 7, 2012 05:45
Show Gist options
  • Save samarkandiy/3064961 to your computer and use it in GitHub Desktop.
Save samarkandiy/3064961 to your computer and use it in GitHub Desktop.
A web page created at CodePen.io
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Transparent 3D Sphere Web browser &middot; CodePen</title>
<style>
body{
background: #222;
}
#experiment {
-webkit-perspective: 800;
-webkit-perspective-origin: 50% 200px;
-moz-perspective: 800;
-moz-perspective-origin: 50% 200px;
-webkit-box-reflect: below 0
-webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.5, transparent), to(white));
}
#cube {
position: relative;
margin: 100px auto 0;
height: 400px;
width: 400px;
-webkit-transition: -webkit-transform 2s linear;
-webkit-transform-style: preserve-3d;
-moz-transition: -moz-transform 2s linear;
-moz-transform-style: preserve-3d;
}
.face {
position: absolute;
height: 360px;
width: 360px;
padding: 20px;
background-color: rgba(255, 255, 255, 0);
font-size: 27px;
line-height: 1em;
color: #fff;
border: 0px solid #555;
border-radius: 3px;
}
#cube .one {
-webkit-transform: rotateX(90deg) translateZ(200px);
-moz-transform: rotateX(90deg) translateZ(200px);
}
#cube .two {
-webkit-transform: translateZ(200px);
-moz-transform: translateZ(200px);
}
#cube .three {
-webkit-transform: rotateY(90deg) translateZ(200px);
-moz-transform: rotateY(90deg) translateZ(200px);
}
#cube .four {
-webkit-transform: rotateY(180deg) translateZ(200px);
-moz-transform: rotateY(180deg) translateZ(200px);
}
#cube .five {
-webkit-transform: rotateY(-90deg) translateZ(200px);
-moz-transform: rotateY(-90deg) translateZ(200px);
}
#cube .six {
-webkit-transform: rotateX(-90deg) rotate(180deg) translateZ(200px);
-moz-transform: rotateX(-90deg) rotate(180deg) translateZ(200px);
}
iframe{
border-radius: 175px;
}
p{ color: #fff;
text-align: center;
}
</style>
<style>
#codepen-footer, #codepen-footer * {
-webkit-box-sizing: border-box !important;
-moz-box-sizing: border-box !important;
box-sizing: border-box !important;
}
#codepen-footer {
display: block !important;
position: fixed !important;
bottom: 0 !important;
left: 0 !important;
width: 100% !important;
padding: 0 10px !important;
margin: 0 !important;
height: 30px !important;
line-height: 30px !important;
font-size: 12px !important;
color: #eeeeee !important;
background-color: #505050 !important;
text-align: left !important;
background: -webkit-linear-gradient(top, #505050, #383838) !important;
background: -moz-linear-gradient(top, #505050, #383838) !important;
background: -ms-linear-gradient(top, #505050, #383838) !important;
background: -o-linear-gradient(top, #505050, #383838) !important;
border-top: 1px solid black !important;
border-bottom: 1px solid black !important;
border-radius: 0 !important;
border-image: none !important;
box-shadow: inset 0 1px 0 #6e6e6e, 0 2px 2px rgba(0, 0, 0, 0.4) !important;
z-index: 300 !important;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, sans-serif !important;
letter-spacing: 0 !important;
word-spacing: 0 !important;
}
#codepen-footer a {
color: #a7a7a7 !important;
text-decoration: none !important;
}
#codepen-footer a:hover {
color: white !important;
}
</style>
<script>
// Kill alerts, confirmations and prompts
window.alert = function(){};
window.confirm = function(){};
window.prompt = function(){};
window.open = function(){};
window.print = function(){};
</script>
</head>
<body>
<p>Click arrow keys to move the browser</p>
<div id="experiment">
<div id="cube">
<div class="face one">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://cnet.com" ></iframe>
</div>
<div class="face two">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://css-tricks.com/" ></iframe>
</div>
<div class="face three">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://smashingmagazine.com" ></iframe>
</div>
<div class="face four">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://iweb.uz" ></iframe>
</div>
<div class="face five">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://mashable.com" ></iframe>
</div>
<div class="face six">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://quotesondesign.com/" ></iframe>
</div>
</div>
</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://codepen.io/javascripts/libs/modernizr.js"></script>
<script>
(function() {
var props = 'transform WebkitTransform MozTransform OTransform msTransform'.split(' '),
prop,
el = document.createElement('div');
for(var i = 0, l = props.length; i < l; i++) {
if(typeof el.style[props[i]] !== "undefined") {
prop = props[i];
break;
}
}
var xAngle = 0, yAngle = 0;
$('body').keydown(function(evt) {
switch(evt.keyCode) {
case 37: // left
yAngle -= 90;
break;
case 38: // up
xAngle += 90;
break;
case 39: // right
yAngle += 90;
break;
case 40: // down
xAngle -= 90;
break;
};
document.getElementById('cube').style[prop] = "rotateX("+xAngle+"deg) rotateY("+yAngle+"deg)";
});
})();
</script>
<div id="codepen-footer">
<a style="color: #f73535 !important;" href="https://codepen.wufoo.com/forms/m7x3r3/def/field14=" onclick="window.open(this.href, null, 'height=517, width=680, toolbar=0, location=0, status=1, scrollbars=1, resizable=1'); return false">Report Abuse</a>
&nbsp;
<a href="/html5web/pen/3dspherewebbrowser/4">Edit this Pen</a>
</div>
</body>
</html>
var props = 'transform WebkitTransform MozTransform OTransform msTransform'.split(' '),
prop,
el = document.createElement('div');
for(var i = 0, l = props.length; i < l; i++) {
if(typeof el.style[props[i]] !== "undefined") {
prop = props[i];
break;
}
}
var xAngle = 0, yAngle = 0;
$('body').keydown(function(evt) {
switch(evt.keyCode) {
case 37: // left
yAngle -= 90;
break;
case 38: // up
xAngle += 90;
break;
case 39: // right
yAngle += 90;
break;
case 40: // down
xAngle -= 90;
break;
};
document.getElementById('cube').style[prop] = "rotateX("+xAngle+"deg) rotateY("+yAngle+"deg)";
});
<p>Click arrow keys to move the browser</p>
<div id="experiment">
<div id="cube">
<div class="face one">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://cnet.com" ></iframe>
</div>
<div class="face two">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://css-tricks.com/" ></iframe>
</div>
<div class="face three">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://smashingmagazine.com" ></iframe>
</div>
<div class="face four">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://iweb.uz" ></iframe>
</div>
<div class="face five">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://mashable.com" ></iframe>
</div>
<div class="face six">
<iframe frameborder="0" scrolling="no" width="350" height="350" src="http://quotesondesign.com/" ></iframe>
</div>
</div>
</div>
body{
background: #222;
}
#experiment {
-webkit-perspective: 800;
-webkit-perspective-origin: 50% 200px;
-moz-perspective: 800;
-moz-perspective-origin: 50% 200px;
-webkit-box-reflect: below 0
-webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.5, transparent), to(white));
}
#cube {
position: relative;
margin: 100px auto 0;
height: 400px;
width: 400px;
-webkit-transition: -webkit-transform 2s linear;
-webkit-transform-style: preserve-3d;
-moz-transition: -moz-transform 2s linear;
-moz-transform-style: preserve-3d;
}
.face {
position: absolute;
height: 360px;
width: 360px;
padding: 20px;
background-color: rgba(255, 255, 255, 0);
font-size: 27px;
line-height: 1em;
color: #fff;
border: 0px solid #555;
border-radius: 3px;
}
#cube .one {
-webkit-transform: rotateX(90deg) translateZ(200px);
-moz-transform: rotateX(90deg) translateZ(200px);
}
#cube .two {
-webkit-transform: translateZ(200px);
-moz-transform: translateZ(200px);
}
#cube .three {
-webkit-transform: rotateY(90deg) translateZ(200px);
-moz-transform: rotateY(90deg) translateZ(200px);
}
#cube .four {
-webkit-transform: rotateY(180deg) translateZ(200px);
-moz-transform: rotateY(180deg) translateZ(200px);
}
#cube .five {
-webkit-transform: rotateY(-90deg) translateZ(200px);
-moz-transform: rotateY(-90deg) translateZ(200px);
}
#cube .six {
-webkit-transform: rotateX(-90deg) rotate(180deg) translateZ(200px);
-moz-transform: rotateX(-90deg) rotate(180deg) translateZ(200px);
}
iframe{
border-radius: 175px;
}
p{ color: #fff;
text-align: center;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment