Skip to content

Instantly share code, notes, and snippets.

@anandprabhakar0507
Created March 14, 2019 21:54
Show Gist options
  • Save anandprabhakar0507/7b387650af15af17c0b837c3b4518a69 to your computer and use it in GitHub Desktop.
Save anandprabhakar0507/7b387650af15af17c0b837c3b4518a69 to your computer and use it in GitHub Desktop.
Shorthand Animations
<div class="stage">
<figure class="ball"></figure>
</div>
@keyframes slide {
0% {
left: 0;
top: 0;
}
50% {
left: 244px;
top: 100px;
}
100% {
left: 488px;
top: 0;
}
}
.stage {
background: #eaeaed;
border-radius: 6px;
height: 150px;
position: relative;
min-width: 538px;
}
.stage:hover .ball {
animation: slide 2s ease-in-out .5s infinite alternate;
}
.stage:active .ball {
animation-play-state: paused;
}
.ball {
background: #2db34a;
border-radius: 50%;
height: 50px;
position: absolute;
width: 50px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment