Skip to content

Instantly share code, notes, and snippets.

@TimPietrusky
Created June 9, 2013 16:52
Show Gist options
  • Save TimPietrusky/5744246 to your computer and use it in GitHub Desktop.
Save TimPietrusky/5744246 to your computer and use it in GitHub Desktop.
A CodePen by Tim Pietrusky. I ♥ D'n'B
<!--
I ♥ D'n'B
Inspired by http://cssdeck.com/item/332/css3-only-heart
but I used pseudo-elements and a sicker heart beat.
2012 by Tim Pietrusky
timpietrusky.com
-->
<div id="chest">
<span role="before">I</span>
<div class="heart"></div>
<span role="after">D'n'B</span>
</div>
@import url(http://fonts.googleapis.com/css?family=Frijole);
body {
background:#000;
transform: scale(.7);
}
#chest {
position:relative;
width:500px;
height:450px;
margin:0 auto;
margin-top:-60px;
}
.heart {
position:absolute;
z-index:1337;
background: linear-gradient(-45deg, #c00 0%,#ff0000 40%);
animation: beat 1.2s ease-out 0s infinite;
width:210px;
height:210px;
bottom:100px;
left:-120px;
}
.heart:after,
.heart:before {
position:absolute;
content:'';
width:220px;
height:220px;
border-radius: 220px;
background: linear-gradient(-180deg, #900 0%,#ff0000 40%);
box-shadow:0 0 40px #ff0000;
}
.heart:before {
top:0;
left:110px;
}
.heart:after {
top:108px;
left:0;
}
@keyframes beat {
0%, 10%, 20%, 30% {
transform: scale(1) rotate(225deg);
box-shadow:0 0 40px #ff0000;
}
5%, 15%, 25%, 50% {
transform: scale(1.1) rotate(225deg);
box-shadow:0 0 70px #ff0000;
}
100% {
transform: scale(1) rotate(225deg);
box-shadow:0 0 40px #ff0000;
}
}
/**
* I D'n'B
*/
span[role="before"],
span[role="after"] {
position:absolute;
top:50px;
font: 220px 'Frijole', cursive;
text-shadow:0 0 10px rgba(255, 0, 0, .4);
animation: beat2 4.8s ease-out infinite;
}
span[role="before"] {
left:-340px;
}
span[role="after"] {
letter-spacing:-10px;
right:-370px;
}
@keyframes beat2 {
0% {
transform: scale(.5);
text-shadow:0 0 10px rgba(255, 0, 0, .4);
}
5%, 70% {
transform: scale(1.4);
text-shadow:0 0 40px rgba(255, 0, 0, .4);
}
100% {
transform: scale(.5); text-shadow:none;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment