CSS Spinner Diamond animation effect

CSS Spinner Diamond animation

Spin an HTML element clockwise in a diamond pattern by applying the CSS transform function transform#translate.

<style> .spinner-diamond { /* Uncomment as needed. */ /* width: 100px; */ /* height: 100px; */ /* background-color: deeppink; */ animation-name: spinner-diamond; animation-duration: 2s; animation-iteration-count: infinite; animation-timing-function: linear; } @keyframes spinner-diamond{ 0% { transform: translate(0, 0); } 0.5% { transform: translate(0, -20px); } 25% { transform: translate(30px, 0px); } 50% { transform: translate(0px, 20px); } 75% { transform: translate(-30px, 0px); } 100% { transform: translate(0px, -20px); } } </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