CSS Light Speed Z animation effect
CSS Light Speed Z animation
Propel an HTML element with light speed in Z-direction using a combination of the CSS tranform functions transform#translate and transform#scale, and the CSS property opacity. Check out our other light-speed effect.
<style>
.light-speed-z {
/* Uncomment as needed. */
/* width: 100px; */
/* height: 100px; */
/* background-color: deeppink; */
animation-name: light-speed-z;
animation-duration: 2s;
animation-iteration-count: infinite;
/*animation-timing-function: cubic-bezier(.5,1,1,1);*/
}
@keyframes light-speed-z {
/* Light speed jump. */
0% { transform: translate(0, 0); }
5% { transform: scale(1.5, 1.5) translate(0, 0); }
5% { transform: scale(.5, .5) translate(0, 0); }
5.5% { transform: scale(.1, .1) translate(0, 0); }
25% { transform: scale(0, 0) translate(0, -30px); }
/* Light speed slow down. */
60% { opacity: 0; transform: scale(0, 0) translate(0, 0);}
60.1% { opacity: .5; transform: scale(4, 4) translate(0, 0);}
60.4% { opacity: .5; }
60.5% { opacity: 1; transform: scale(4, 4) translate(0, 0);}
61.5% { opacity: 1; transform: scale(1.1, 1.1) translate(0, 0);}
100% { transform: scale(1, 1) translate(0px, 0); }
}
</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