CSS Boomerang animation effect

CSS Boomerang animation

Do boxes fly like a boomerang? - Ours do ;). You can use the CSS property transform with the transform functions transform#scale and transform#translate in your animation keyframes to achieve this effect.

<style> .boomerang { /* Uncomment as needed. */ /* width: 100px; */ /* height: 100px; */ /* background-color: deeppink; */ animation-name: boomerang; animation-duration: 5s; animation-iteration-count: infinite; animation-timing-function: linear; } @keyframes boomerang { 0% { transform: scale(0.08) translate(0, 0); } 5% { transform: scale(0.1) translate(50%, 10%); } 25% { transform: scale(0.25) translate(200%, -50%); } 50% { transform: scale(1) translate(0, 30%); } 75% { transform: scale(0.25) translate(-200%, -50%); } 95% { transform: scale(0.05) translate(-50%, 5%); } 100% { transform: scale(0.05) translate(0, 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