Skip to content

Instantly share code, notes, and snippets.

@phongjalvn
Created July 6, 2012 18:05
Show Gist options
  • Save phongjalvn/3061698 to your computer and use it in GitHub Desktop.
Save phongjalvn/3061698 to your computer and use it in GitHub Desktop.
ui animation
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Avengers UI Interface CSS animation &middot; CodePen</title>
<style>
html, body, body div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, hgroup, menu, nav, section, time, mark, audio, video {
margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent;
}
article, aside, figure, footer, header, hgroup, nav, section {
display: block
}
.outer_circle {
width: 104px; height: 104px; background: 0; border-radius: 100%; border: 6px solid #fff; position: absolute; top: 50%; left: 50%; margin: -58px 0 0 -58px;
}
.activation_zone {
width: 115px; height: 115px; position: absolute; top: 50%; left: 50%; margin: -58px 0 0 -58px; z-index: 500;
}
@-webkit-keyframes one_rotate_inner_circle {
0%, 100% {
-webkit-transform: rotate(0deg)
}
30% {
-webkit-transform: rotate(-110deg)
}
70% {
-webkit-transform: rotate(70deg)
}
}
@-webkit-keyframes one_shrink_outer_border {
0%, 100% {
-webkit-transform: rotate(0deg)
}
50% {
border-width: 1px; height: 50px; width: 50px; top: 68%; left: 68%; opacity: .0;
}
}
@-webkit-keyframes two_rotate_inner_gear {
0%, 100% {
-webkit-transform: rotate(0deg)
}
30% {
-webkit-transform: rotate(40deg)
}
50% {
-webkit-transform: rotate(110deg)
}
75% {
-webkit-transform: rotate(-30deg)
}
}
@-webkit-keyframes two_rotate_middle_circle {
0%, 100% {
-webkit-transform: rotate(0deg)
}
50% {
-webkit-transform: rotate(-40deg)
}
70% {
-webkit-transform: rotate(-110deg)
}
90% {
-webkit-transform: rotate(30deg)
}
}
body {
background: #fff; padding: 20px;
}
.box {
background: #333; width: 200px; height: 200px; box-sizing: border-box; float: left; margin: 0 20px 0 0; position: relative;
}
.one.active .inner_circle {
-webkit-transition: .5s ease; border-color: #ee582b;
}
.one.active .middle_circle {
-webkit-animation: one_rotate_inner_circle .9s ease
}
.one.active .outer_circle {
-webkit-animation: one_shrink_outer_border 1.5s ease
}
.one .middle_circle {
width: 44px; height: 44px; border: 18px solid #fff; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -40px 0 0 -40px;
}
.one .middle_circle .cutout {
border-bottom: 11px solid #333; border-left: 9px solid transparent; border-right: 9px solid transparent; height: 0; width: 15px; position: absolute;
}
.one .middle_circle .one {
top: -15px; left: -11px; z-index: 200; -webkit-transform: rotate(150deg);
}
.one .middle_circle .two {
top: 18px; right: -31px; z-index: 200; -webkit-transform: rotate(-87deg);
}
.one .inner_circle {
width: 24px; height: 24px; border: 2px solid #999; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -14px 0 0 -14px; -webkit-transition: border-color .4s ease;
}
.two.active .inner_circle {
border-color: #ee582b
}
.two.active .middle_circle {
-webkit-animation: two_rotate_inner_gear 3s ease
}
.two.active .middle_circle_big_add {
-webkit-animation: two_rotate_middle_circle 3s ease
}
.two .middle_circle {
width: 44px; height: 44px; border: 8px solid #a3a3a3; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -30px 0 0 -30px; z-index: 200;
}
.two .middle_circle .cutout {
border-bottom: 7px solid #333; border-left: 3px solid transparent; border-right: 3px solid transparent; height: 0; width: 6px; position: absolute;
}
.two .middle_circle .one {
top: 0; left: 3px; z-index: 200; -webkit-transform: rotate(142deg);
}
.two .middle_circle .two {
top: -2px; right: 6px; z-index: 200; -webkit-transform: rotate(209deg);
}
.two .middle_circle .three {
top: 20px; right: -7px; z-index: 200; -webkit-transform: rotate(-91deg);
}
.two .middle_circle .four {
bottom: -1px; right: 4px; z-index: 200; -webkit-transform: rotate(-41deg);
}
.two .middle_circle .five {
bottom: -2px; left: 7px; z-index: 200; -webkit-transform: rotate(29deg);
}
.two .middle_circle .six {
top: 19px; left: -6px; z-index: 200; -webkit-transform: rotate(88deg);
}
.two .middle_circle_big {
width: 72px; height: 72px; border: 2px solid #fff; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -38px 0 0 -38px; background-color: #333; z-index: 20;
}
.two .middle_circle_big_add {
position: absolute; top: 50%; left: 50%; width: 90px; height: 90px; margin: -45px 0 0 -45px;
}
.two .middle_circle_big_add .one {
width: 50px; height: 25px; background: #fff; -webkit-transform: rotate(-45deg); border-radius: 100%; position: absolute; left: -3px; top: 8px;
}
.two .middle_circle_big_add .one_cutout_right {
width: 15px; height: 20px; background: #333; -webkit-transform: rotate(-27deg); position: absolute; left: 35px; top: -4px;
}
.two .middle_circle_big_add .one_cutout_left {
width: 15px; height: 20px; background: #333; -webkit-transform: rotate(-55deg); position: absolute; left: -1px; top: 29px;
}
.two .middle_circle_big_add .two {
width: 40px; height: 15px; background: #fff; -webkit-transform: rotate(-68deg); border-radius: 100%; position: absolute; left: -7px; top: 23px;
}
.two .middle_circle_big_add .two_cutout_left {
width: 15px; height: 18px; background: #333; -webkit-transform: rotate(-75deg); position: absolute; left: -1px; top: 45px;
}
.two .middle_circle_big_add .three {
width: 40px; height: 15px; background: #fff; -webkit-transform: rotate(-95deg); border-radius: 100%; position: absolute; left: -7px; top: 40px;
}
.two .middle_circle_big_add .three_cutout_left {
width: 7px; height: 10px; background: #333; -webkit-transform: rotate(-110deg); position: absolute; left: 8px; top: 60px;
}
.two .middle_circle_big_add .four {
width: 40px; height: 15px; background: #fff; -webkit-transform: rotate(0deg); border-radius: 100%; position: absolute; left: 50%; bottom: 5px; margin-left: -20px;
}
.two .middle_circle_big_add .four_cutout_left {
width: 8px; height: 10px; background: #333; -webkit-transform: rotate(-76deg); position: absolute; left: 23px; bottom: 5px;
}
.two .middle_circle_big_add .four_cutout_right {
width: 8px; height: 10px; background: #333; -webkit-transform: rotate(76deg); position: absolute; right: 23px; bottom: 5px;
}
.two .middle_circle_big_add .five {
width: 50px; height: 25px; background: #fff; -webkit-transform: rotate(100deg); border-radius: 100%; position: absolute; right: -11px; bottom: 28px;
}
.two .middle_circle_big_add .five_cutout_right {
width: 15px; height: 10px; background: #333; -webkit-transform: rotate(-7deg); position: absolute; top: 23px; right: -1px;
}
.two .middle_circle_big_add .five_cutout_left {
width: 12px; height: 15px; background: #333; -webkit-transform: rotate(-60deg); position: absolute; bottom: 8px; right: 13px;
}
.two .middle_circle_big_add .six {
width: 30px; height: 15px; background: #fff; -webkit-transform: rotate(-117deg); border-radius: 100%; position: absolute; right: 1px; top: 22px; margin-left: -20px;
}
.two .middle_circle_big_add .six_cutout_right {
width: 10px; height: 14px; background: #333; -webkit-transform: rotate(-31deg); position: absolute; right: 12px; top: 8px;
}
.two .inner_circle {
width: 24px; height: 24px; border: 2px solid #ee582b; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -14px 0 0 -14px; -webkit-transition: border-color .4s ease; z-index: 200;
}
.two .inner_inner_circle {
width: 6px; height: 6px; border: 2px solid #999; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -5px 0 0 -5px; -webkit-transition: border-color .4s ease; z-index: 200;
}
</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>
<div class="container">
<div class="box one">
<div class="activation_zone one"></div>
<div class="outer_circle"></div>
<div class="middle_circle">
<div class="cutout one"></div>
<div class="cutout two"></div>
</div>
<div class="inner_circle"></div>
</div><!-- .box one -->
<div class="box two">
<div class="outer_circle"></div>
<div class="middle_circle_big"></div>
<div class="middle_circle_big_add">
<div class="one"></div>
<div class="one_cutout_left"></div>
<div class="one_cutout_right"></div>
<div class="two"></div>
<div class="two_cutout_left"></div>
<div class="three"></div>
<div class="three_cutout_left"></div>
<div class="four"></div>
<div class="four_cutout_left"></div>
<div class="four_cutout_right"></div>
<div class="five"></div>
<div class="five_cutout_left"></div>
<div class="five_cutout_right"></div>
<div class="six"></div>
<div class="six_cutout_right"></div>
</div>
<div class="middle_circle">
<div class="cutout one"></div>
<div class="cutout two"></div>
<div class="cutout three"></div>
<div class="cutout four"></div>
<div class="cutout five"></div>
<div class="cutout six"></div>
</div>
<div class="inner_circle"></div>
<div class="inner_inner_circle"></div>
</div><!-- .box two -->
</div><!-- .container -->
<button href="#" id="activate">Activate</button>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
(function() {
$(document).ready(function() {
$(".activation_zone.one").hover(function() {
$(".one").toggleClass("active");
});
$("#activate").click(function() {
$(".one").toggleClass("active");
$(".two").toggleClass("active");
});
});
})();
</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="/mxlje/pen/avengers-ui-css/8">Edit this Pen</a>
</div>
</body>
</html>
$(document).ready(function() {
$(".activation_zone.one").hover(function() {
$(".one").toggleClass("active");
});
$("#activate").click(function() {
$(".one").toggleClass("active");
$(".two").toggleClass("active");
});
});
<div class="container">
<div class="box one">
<div class="activation_zone one"></div>
<div class="outer_circle"></div>
<div class="middle_circle">
<div class="cutout one"></div>
<div class="cutout two"></div>
</div>
<div class="inner_circle"></div>
</div><!-- .box one -->
<div class="box two">
<div class="outer_circle"></div>
<div class="middle_circle_big"></div>
<div class="middle_circle_big_add">
<div class="one"></div>
<div class="one_cutout_left"></div>
<div class="one_cutout_right"></div>
<div class="two"></div>
<div class="two_cutout_left"></div>
<div class="three"></div>
<div class="three_cutout_left"></div>
<div class="four"></div>
<div class="four_cutout_left"></div>
<div class="four_cutout_right"></div>
<div class="five"></div>
<div class="five_cutout_left"></div>
<div class="five_cutout_right"></div>
<div class="six"></div>
<div class="six_cutout_right"></div>
</div>
<div class="middle_circle">
<div class="cutout one"></div>
<div class="cutout two"></div>
<div class="cutout three"></div>
<div class="cutout four"></div>
<div class="cutout five"></div>
<div class="cutout six"></div>
</div>
<div class="inner_circle"></div>
<div class="inner_inner_circle"></div>
</div><!-- .box two -->
</div><!-- .container -->
<button href="#" id="activate">Activate</button>
html, body, body div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, hgroup, menu, nav, section, time, mark, audio, video {
margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent;
}
article, aside, figure, footer, header, hgroup, nav, section {
display: block
}
.outer_circle {
width: 104px; height: 104px; background: 0; border-radius: 100%; border: 6px solid #fff; position: absolute; top: 50%; left: 50%; margin: -58px 0 0 -58px;
}
.activation_zone {
width: 115px; height: 115px; position: absolute; top: 50%; left: 50%; margin: -58px 0 0 -58px; z-index: 500;
}
@-webkit-keyframes one_rotate_inner_circle {
0%, 100% {
-webkit-transform: rotate(0deg)
}
30% {
-webkit-transform: rotate(-110deg)
}
70% {
-webkit-transform: rotate(70deg)
}
}
@-webkit-keyframes one_shrink_outer_border {
0%, 100% {
-webkit-transform: rotate(0deg)
}
50% {
border-width: 1px; height: 50px; width: 50px; top: 68%; left: 68%; opacity: .0;
}
}
@-webkit-keyframes two_rotate_inner_gear {
0%, 100% {
-webkit-transform: rotate(0deg)
}
30% {
-webkit-transform: rotate(40deg)
}
50% {
-webkit-transform: rotate(110deg)
}
75% {
-webkit-transform: rotate(-30deg)
}
}
@-webkit-keyframes two_rotate_middle_circle {
0%, 100% {
-webkit-transform: rotate(0deg)
}
50% {
-webkit-transform: rotate(-40deg)
}
70% {
-webkit-transform: rotate(-110deg)
}
90% {
-webkit-transform: rotate(30deg)
}
}
body {
background: #fff; padding: 20px;
}
.box {
background: #333; width: 200px; height: 200px; box-sizing: border-box; float: left; margin: 0 20px 0 0; position: relative;
}
.one.active .inner_circle {
-webkit-transition: .5s ease; border-color: #ee582b;
}
.one.active .middle_circle {
-webkit-animation: one_rotate_inner_circle .9s ease
}
.one.active .outer_circle {
-webkit-animation: one_shrink_outer_border 1.5s ease
}
.one .middle_circle {
width: 44px; height: 44px; border: 18px solid #fff; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -40px 0 0 -40px;
}
.one .middle_circle .cutout {
border-bottom: 11px solid #333; border-left: 9px solid transparent; border-right: 9px solid transparent; height: 0; width: 15px; position: absolute;
}
.one .middle_circle .one {
top: -15px; left: -11px; z-index: 200; -webkit-transform: rotate(150deg);
}
.one .middle_circle .two {
top: 18px; right: -31px; z-index: 200; -webkit-transform: rotate(-87deg);
}
.one .inner_circle {
width: 24px; height: 24px; border: 2px solid #999; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -14px 0 0 -14px; -webkit-transition: border-color .4s ease;
}
.two.active .inner_circle {
border-color: #ee582b
}
.two.active .middle_circle {
-webkit-animation: two_rotate_inner_gear 3s ease
}
.two.active .middle_circle_big_add {
-webkit-animation: two_rotate_middle_circle 3s ease
}
.two .middle_circle {
width: 44px; height: 44px; border: 8px solid #a3a3a3; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -30px 0 0 -30px; z-index: 200;
}
.two .middle_circle .cutout {
border-bottom: 7px solid #333; border-left: 3px solid transparent; border-right: 3px solid transparent; height: 0; width: 6px; position: absolute;
}
.two .middle_circle .one {
top: 0; left: 3px; z-index: 200; -webkit-transform: rotate(142deg);
}
.two .middle_circle .two {
top: -2px; right: 6px; z-index: 200; -webkit-transform: rotate(209deg);
}
.two .middle_circle .three {
top: 20px; right: -7px; z-index: 200; -webkit-transform: rotate(-91deg);
}
.two .middle_circle .four {
bottom: -1px; right: 4px; z-index: 200; -webkit-transform: rotate(-41deg);
}
.two .middle_circle .five {
bottom: -2px; left: 7px; z-index: 200; -webkit-transform: rotate(29deg);
}
.two .middle_circle .six {
top: 19px; left: -6px; z-index: 200; -webkit-transform: rotate(88deg);
}
.two .middle_circle_big {
width: 72px; height: 72px; border: 2px solid #fff; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -38px 0 0 -38px; background-color: #333; z-index: 20;
}
.two .middle_circle_big_add {
position: absolute; top: 50%; left: 50%; width: 90px; height: 90px; margin: -45px 0 0 -45px;
}
.two .middle_circle_big_add .one {
width: 50px; height: 25px; background: #fff; -webkit-transform: rotate(-45deg); border-radius: 100%; position: absolute; left: -3px; top: 8px;
}
.two .middle_circle_big_add .one_cutout_right {
width: 15px; height: 20px; background: #333; -webkit-transform: rotate(-27deg); position: absolute; left: 35px; top: -4px;
}
.two .middle_circle_big_add .one_cutout_left {
width: 15px; height: 20px; background: #333; -webkit-transform: rotate(-55deg); position: absolute; left: -1px; top: 29px;
}
.two .middle_circle_big_add .two {
width: 40px; height: 15px; background: #fff; -webkit-transform: rotate(-68deg); border-radius: 100%; position: absolute; left: -7px; top: 23px;
}
.two .middle_circle_big_add .two_cutout_left {
width: 15px; height: 18px; background: #333; -webkit-transform: rotate(-75deg); position: absolute; left: -1px; top: 45px;
}
.two .middle_circle_big_add .three {
width: 40px; height: 15px; background: #fff; -webkit-transform: rotate(-95deg); border-radius: 100%; position: absolute; left: -7px; top: 40px;
}
.two .middle_circle_big_add .three_cutout_left {
width: 7px; height: 10px; background: #333; -webkit-transform: rotate(-110deg); position: absolute; left: 8px; top: 60px;
}
.two .middle_circle_big_add .four {
width: 40px; height: 15px; background: #fff; -webkit-transform: rotate(0deg); border-radius: 100%; position: absolute; left: 50%; bottom: 5px; margin-left: -20px;
}
.two .middle_circle_big_add .four_cutout_left {
width: 8px; height: 10px; background: #333; -webkit-transform: rotate(-76deg); position: absolute; left: 23px; bottom: 5px;
}
.two .middle_circle_big_add .four_cutout_right {
width: 8px; height: 10px; background: #333; -webkit-transform: rotate(76deg); position: absolute; right: 23px; bottom: 5px;
}
.two .middle_circle_big_add .five {
width: 50px; height: 25px; background: #fff; -webkit-transform: rotate(100deg); border-radius: 100%; position: absolute; right: -11px; bottom: 28px;
}
.two .middle_circle_big_add .five_cutout_right {
width: 15px; height: 10px; background: #333; -webkit-transform: rotate(-7deg); position: absolute; top: 23px; right: -1px;
}
.two .middle_circle_big_add .five_cutout_left {
width: 12px; height: 15px; background: #333; -webkit-transform: rotate(-60deg); position: absolute; bottom: 8px; right: 13px;
}
.two .middle_circle_big_add .six {
width: 30px; height: 15px; background: #fff; -webkit-transform: rotate(-117deg); border-radius: 100%; position: absolute; right: 1px; top: 22px; margin-left: -20px;
}
.two .middle_circle_big_add .six_cutout_right {
width: 10px; height: 14px; background: #333; -webkit-transform: rotate(-31deg); position: absolute; right: 12px; top: 8px;
}
.two .inner_circle {
width: 24px; height: 24px; border: 2px solid #ee582b; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -14px 0 0 -14px; -webkit-transition: border-color .4s ease; z-index: 200;
}
.two .inner_inner_circle {
width: 6px; height: 6px; border: 2px solid #999; border-radius: 100%; position: absolute; top: 50%; left: 50%; margin: -5px 0 0 -5px; -webkit-transition: border-color .4s ease; z-index: 200;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment