Skip to content

Instantly share code, notes, and snippets.

@i2r
Created July 9, 2012 08:36
Show Gist options
  • Select an option

  • Save i2r/3075125 to your computer and use it in GitHub Desktop.

Select an option

Save i2r/3075125 to your computer and use it in GitHub Desktop.
Timer
/**
* Timer
*/
html, body {
min-height: 100%;
color: rgba(0,0,0, .5);
margin: 0;
padding: 0;
}
.timer {
position: absolute;
top: 50%;
left: 50%;
margin-left: -50px;
margin-top: -50px;
height: 100px;
width: 100px;
background: linear-gradient(45deg, orange, yellow, orange, yellow, orange);
}
.timer:before {
content:"";
display: block;
position: absolute;
top: 50%;
left: 50%;
margin-top: -28px;
margin-left: -28px;
width: 40px;
height: 40px;
border: solid 8px;
border-radius: 100%;
box-shadow: 0 1px 0 rgba(255,255,255, .7), inset 0 1px 0 rgba(255,255,255, .7);
color: rgba(0,0,0, .06);
}
.first-half,
.second-half {
position: relative;
display: inline-block;
overflow: hidden;
height: 100%;
width: 50%;
}
.first-half {}
.second-half {}
.first-half__i,
.second-half__i {
display: block;
position: absolute;
top: 50%;
margin-top: -28px;
height: 40px;
width: 40px;
border-radius: 100%;
border: solid 8px;
}
.first-half__i {
right: 0;
margin-right: -28px;
clip: rect(auto,28px,auto,auto);
}
.second-half__i {
left: 0;
margin-left: -28px;
clip: rect(auto,auto,auto,28px);
}
.first-half__i {
transform: rotate(-180deg);
animation: tictac 5s linear infinite;
}
.second-half__i {
animation: tictac2 5s linear infinite;
}
@keyframes tictac {
50% {
transform: rotate(-180deg);
}
to {
transform: rotate(0deg);
}
}
@keyframes tictac2 {
0% {
transform: rotate(-180deg);
}
50% {
transform: rotate(0deg);
}
}
<!-- content to be placed inside <body>…</body> -->
<div class="timer">
<div class="first-half">
<div class="first-half__i"></div>
</div><div class="second-half">
<div class="second-half__i"></div>
</div>
</div>
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment