Skip to content

Instantly share code, notes, and snippets.

@samarkandiy
Created August 7, 2012 13:47
Show Gist options
  • Save samarkandiy/3285459 to your computer and use it in GitHub Desktop.
Save samarkandiy/3285459 to your computer and use it in GitHub Desktop.
A web page created at CodePen.io.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- IF PEN IS PRIVATE -->
<!-- <meta name="robots" content="noindex"> -->
<!-- END -->
<title>Pure CSS - animated Bubble and Mac &middot; CodePen</title>
<!--
Copyright (c) 2012 Azik Samarkandiy, http://codepen.io/html5web
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<style>
html, body {
background: #222222;
width: 600px;
height: 100%;
margin: 0 auto;
}
.container {
background: linear-gradient(45deg, #1d0836, #cc50a3);
width: 670px;
height: 390px;
margin: -60px 0 0 -100px;
box-shadow: 0 0 5px black;
transform: scale(0.7);
z-index: 15;
}
.bubble {
background: rgba(255, 255, 255, 0.1);
width: 150px;
height: 150px;
border-radius: 50%;
position: absolute;
animation: play 7s infinite ease-in;
box-shadow: 0 0 25px purple inset;
}
.bubble:before {
background: rgba(255, 255, 255, 0.2);
content: "";
width: 60px;
height: 28px;
position: absolute;
margin: 10px 0 0 25px;
border-radius: 50%;
transform: rotate(-20deg);
}
@keyframes play {
0% {
transform: translateX(0) translateY(0px);
}
20% {
transform: translateX(300px) translateY(243px);
}
30% {
transform: translateX(524px) translateY(140px);
}
40% {
transform: translateX(300px) translateY(0);
}
50% {
transform: translateX(100px) translateY(243px);
}
60% {
transform: translateX(0) translateY(180px);
}
70% {
transform: translateX(200px) translateY(0);
}
80% {
transform: translateX(524px) translateY(170px);
}
90% {
transform: translateX(300px) translateY(243px);
}
}
.cont {
width: 600px;
margin: -120px 0 0 0;
-webkit-transform: scale(0.6);
}
.macdisplay {
background: #444444;
width: 470px;
height: 270px;
border: solid 20px black;
border-radius: 10px 10px 0 0;
margin: 94px 0 0 40px;
z-index: 1;
}
.macdisplay:before {
background: -webkit-linear-gradient(top left, rgba(255, 255, 255, 0) 60%, rgba(255, 255, 255, 0.03) 60%, rgba(255, 255, 255, 0) 100%);
content: "";
width: 500px;
height: 310px;
border-radius: 10px 10px 0 0;
margin: -20px 0 0 -10px;
position: absolute;
z-index: 16;
}
.macdisplay:after {
background: #dddddd;
background: linear-gradient(left, #dddddd 0%, #cccccc 24%, #eeeeee 46%, #dddddd 69%, #cccccc 100%);
content: "";
width: 510px;
height: 40px;
position: absolute;
margin: -41px 0 0 -20px;
border-radius: 0 0 10px 10px;
z-index: 3;
box-shadow: 0 1px 2px #444444;
}
.camera {
background: #222222;
width: 2px;
height: 2px;
position: absolute;
margin: -300px 0 0 293px;
border-radius: 3px;
box-shadow: 0 0 1px white;
}
.foot {
background: #bcbcbc;
background: linear-gradient(top, #bcbcbc 0%, #eaeaea 22%, #dddddd 40%, #959595 50%, #a0a0a0 62%, #cccccc 70%, #cccccc 100%);
width: 170px;
height: 60px;
position: absolute;
margin: 40px 0 0 220px;
border-radius: 0 0 4px 4px;
}
.foot:before {
background: #222222;
content: "";
width: 60px;
height: 62px;
position: absolute;
margin: 0 0 0 -35px;
border-radius: 0 0 50px 0;
}
.foot:after {
background: #222222;
content: "";
width: 60px;
height: 62px;
position: absolute;
margin: 0 0 0 145px;
border-radius: 0 0 0 50px;
}
.apple {
background: black;
width: 208px;
height: 198px;
position: absolute;
margin: 210px 0 0 145px;
border-radius: 36% 36% 41% 41%/42% 42% 75% 75%;
transform: scale(0.1);
z-index: 28;
}
.apple:before {
background: black;
content: "";
width: 55px;
height: 55px;
position: absolute;
margin: -60px 0 0 90px;
border-radius: 100px 0;
z-index: 29;
}
.apple:after {
background: #eeeeee;
content: "";
width: 90px;
height: 90px;
position: absolute;
margin: 28px 0 0 174px;
border-radius: 50%;
transform: rotate(-53deg);
z-index: 4;
box-shadow: 12px -158px 0 #eeeeee, -198px 3px 0 #eeeeee;
}
</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: normal !important;
word-spacing: 0 !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
-o-transform: none !important;
transform: none !important;
}
#codepen-footer a {
color: #a7a7a7 !important;
text-decoration: none !important;
text-shadow: none !important;
border: 0 !important;
}
#codepen-footer a:hover {
color: white !important;
}
</style>
<script>
// Kill alerts, confirmations and prompts
// window.alert = function(){}; we're going to allow alerts for now
window.confirm = function(){};
window.prompt = function(){};
window.open = function(){};
window.print = function(){};
</script>
<script src="http://codepen.io/javascripts/libs/prefixfree.min.js"></script>
</head>
<body>
<div class="cont">
<div class="macdisplay">
<div class="apple"></div>
<div class="container">
<div class="bubble"></div>
</div>
</div>
<div class="camera"></div>
<div class="foot"></div>
</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<div id="codepen-footer">
<a style="color: #f73535 !important;" href="https://codepen.wufoo.com/forms/m7x3r3/def/field14=" target="_blank">Report Abuse</a>
&nbsp;
<a href="/html5web/pen/apudr" target="_blank">Edit this Pen</a>
</div>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-30102653-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
.cont
.macdisplay
.apple
.container
.bubble
.camera
.foot
@import "compass"
html, body
background: #222
width: 600px
height: 100%
margin: 0 auto
.container
background: linear-gradient(45deg, #1d0836, #cc50a3)
width: 670px
height: 390px
margin: -60px 0 0 -100px
box-shadow: 0 0 5px #000
transform: scale(0.7)
z-index: 15
.bubble
background: rgba(255, 255, 255, 0.1)
width: 150px
height: 150px
border-radius: 50%
position: absolute
animation: play 7s infinite ease-in
box-shadow: 0 0 25px purple inset
&:before
background: rgba(255, 255, 255, 0.2)
content: ""
width: 60px
height: 28px
position: absolute
margin: 10px 0 0 25px
border-radius: 50%
transform: rotate(-20deg)
@keyframes play
0%
transform: translateX(0) translateY(0px)
20%
transform: translateX(300px) translateY(243px)
30%
transform: translateX(524px) translateY(140px)
40%
transform: translateX(300px) translateY(0)
50%
transform: translateX(100px) translateY(243px)
60%
transform: translateX(0) translateY(180px)
70%
transform: translateX(200px) translateY(0)
80%
transform: translateX(524px) translateY(170px)
90%
transform: translateX(300px) translateY(243px)
.cont
width: 600px
margin: -120px 0 0 0
-webkit-transform: scale(0.6)
.macdisplay
background: #444
width: 470px
height: 270px
border: solid 20px #000
border-radius: 10px 10px 0 0
margin: 94px 0 0 40px
z-index: 1
&:before
background: -webkit-linear-gradient(top left, rgba(255, 255, 255, 0) 60%, rgba(255, 255, 255, 0.03) 60%, rgba(255, 255, 255, 0) 100%)
content: ""
width: 500px
height: 310px
border-radius: 10px 10px 0 0
margin: -20px 0 0 -10px
position: absolute
z-index: 16
&:after
background: #dddddd
background: linear-gradient(left, #dddddd 0%, #cccccc 24%, #eeeeee 46%, #dddddd 69%, #cccccc 100%)
content: ""
width: 510px
height: 40px
position: absolute
margin: -41px 0 0 -20px
border-radius: 0 0 10px 10px
z-index: 3
box-shadow: 0 1px 2px #444
.camera
background: #222
width: 2px
height: 2px
position: absolute
margin: -300px 0 0 293px
border-radius: 3px
box-shadow: 0 0 1px #fff
.foot
background: #bcbcbc
background: linear-gradient(top, #bcbcbc 0%, #eaeaea 22%, #dddddd 40%, #959595 50%, #a0a0a0 62%, #cccccc 70%, #cccccc 100%)
width: 170px
height: 60px
position: absolute
margin: 40px 0 0 220px
border-radius: 0 0 4px 4px
&:before
background: #222
content: ""
width: 60px
height: 62px
position: absolute
margin: 0 0 0 -35px
border-radius: 0 0 50px 0
&:after
background: #222
content: ""
width: 60px
height: 62px
position: absolute
margin: 0 0 0 145px
border-radius: 0 0 0 50px
.apple
background: #000
width: 208px
height: 198px
position: absolute
margin: 210px 0 0 145px
border-radius: 36% 36% 41% 41% / 42% 42% 75% 75%
transform: scale(0.1)
z-index: 28
&:before
background: #000
content: ""
width: 55px
height: 55px
position: absolute
margin: -60px 0 0 90px
border-radius: 100px 0
z-index: 29
&:after
background: #eee
content: ""
width: 90px
height: 90px
position: absolute
margin: 28px 0 0 174px
border-radius: 50%
transform: rotate(-53deg)
z-index: 4
box-shadow: 12px -158px 0 #eeeeee, -198px 3px 0 #eeeeee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment