Skip to content

Instantly share code, notes, and snippets.

@peet
Forked from LeaVerou/dabblet.css
Created February 9, 2012 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peet/1775725 to your computer and use it in GitHub Desktop.
Save peet/1775725 to your computer and use it in GitHub Desktop.
Move in a circle or arc without wrapper elements
/**
* Move in a circle without wrapper elements
* Idea by Aryeh Gregor, simplified by Lea Verou
*/
@keyframes rot {
from {
transform: rotate(0deg)
translate(-150px)
rotate(0deg);
}
to {
transform: rotate(360deg)
translate(-150px)
rotate(-360deg);
}
}
.smile {
width: 40px;
height: 40px;
position: absolute;
top: 200px;
left: 50%;
margin: -20px;
font-size: 100px;
animation: 3s rot infinite linear;
}
/**
* Move in an arc without wrapper elements
* Idea by Aryeh Gregor, simplified by Lea Verou
*/
@keyframes arc {
from {
transform: rotate(360deg)
translate(150px)
rotate(-360deg);
}
to {
transform: rotate(180deg)
translate(150px)
rotate(-180deg);
}
}
.frown {
width: 40px;
height: 40px;
position: absolute;
top: 500px;
left: 50%;
margin: -20px;
font-size: 100px;
animation: 3s arc infinite linear;
}
<div class="smile">☺</div>
<div class="frown">☹</div>
{"view":"separate","prefixfree":"1","page":"result"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment