<h1> Bounce Effect </h1>
<div class="avatar">
<a href="https://twitter.com/simonbusborg" target="_blank">
<img src="https://images.unsplash.com/photo-1610960945969-9d48e5e25a2e?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwzfHx8ZW58MHx8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" class="user"/>
</a>
<p>Simple border/shadow/scale animation done with css animations (Way ol' project)</p>
</div>
$bounce-color: #777;
$image-size: 200px;
@import url(https://fonts.googleapis.com/css?family=Ubuntu);
body,
html {
background: #1d1d1d;
font-family: 'Helvetica', sans-serif;
color: white;
text-align: center;
padding: 0;
margin: 0;
-webkit-font-smoothing: antialiased;
font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: geometricPrecision;
text-rendering: optimizeLegibility;
}
h1 {
position: absolute;
white-space: nowrap;
left: 50%;
top: 15%;
transform: translate(-50%, -50%);
opacity: .035;
font-size: 16vw;
font-weight: bold;
}
p {
font-size: 120%;
font-family: 'Apple Symbols';
line-height: 1.28;
transform: translateY(30px);
letter-spacing: .5px;
opacity: .3;
max-width: 340px;
}
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
}
.avatar {
margin: 25px auto;
}
img.user {
height: $image-size;
width: $image-size;
background-color: $bounce-color;
box-shadow: 0 0 0 5px $bounce-color;
border-radius: 50%;
object-fit: cover;
will-change: transform;
&:hover {
cursor: pointer;
animation: bounceOut 0.4s linear;
}
}
@keyframes bounceOut {
0% {
box-shadow: 0 0 0 4px $bounce-color;
opacity: 1;
transform: scale(1);
}
25% {
box-shadow: 0 0 0 1px $bounce-color;
opacity: 1;
transform: scale(0.97);
}
50% {
box-shadow: 0 0 0 7px $bounce-color;
opacity: 1;
transform: scale(1.01);
}
75% {
box-shadow: 0 0 0 4px $bounce-color;
opacity: 1;
transform: scale(1);
}
100% {
box-shadow: 0 0 0 5px $bounce-color;
opacity: 1;
}
}
View Compiled
// Updated pen from 2010
This Pen doesn't use any external CSS resources.