CSS Bounce animation effect
CSS Bounce animation
Bouncing animation of an HTML element written in pure CSS using the property transform#translate and CSS transform function transform#scale to achieve this effect.
<style>
.bounce {
/* Uncomment as needed. */
/* width: 100px; */
/* height: 100px; */
/* background-color: deeppink; */
animation-name: bounce;
animation-duration: .5s;
animation-iteration-count: infinite;
animation-timing-function: cubic-bezier(.5,1,1,1);
}
@keyframes bounce {
0% { transform: translate(0, -30%); }
50% { transform: translate(0px, 0px); }
51% { transform: translate(0px, -10%); }
100% { transform: scale(.99) translate(0, -30%); }
}
</style>
- If you cannot see your HTML element when using our code, you may need to set a width and or height, or background on your target HTML element using CSS. Just uncomment the CSS properties in our code as needed.
- Remove the HTML style tag as needed.
- Change values in the code such as animation-duration as needed.
Animation effects source code licenced under
MIT Licence