CSS Sling animation effect

CSS Sling animation

Slings an HTML element into Z-direction using a combination of the CSS transform functions transform#translate and transform#scale.

<style> .sling { /* Uncomment as needed. */ /* width: 100px; */ /* height: 100px; */ /* background-color: deeppink; */ animation-name: sling; animation-duration: 3s; animation-iteration-count: infinite; } @keyframes sling { 0% { transform: scale(1,1) translate(0%, 50%); } 5% { transform: scale(.75, .75) translate(50%, -25%); } 10% { transform: scale(.5, .5) translate(100%, -50%); } 15% { transform: scale(.4, .4) translate(0%, -50%); } 20% { transform: scale(.6, .6) translate(-50%, -50%); } 25% { transform: scale(.75, .75) translate(-100%, -25%); } 35% { transform: scale(.8, .8) translate(0%, 0%); } 35% { transform: scale(1, 1) translate(100%, 25%); } 40% { transform: scale(.1, .1) translate(370%, 0); } 100% { transform: scale(.0, .0) translate(500%, 0); } }</style>
    Hints:
  • 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