I have a pen that is trying to imitate an object orbiting something. It works, but it is behind the scenes. During rotation, it stops around the left and right edges.
I thought this had something to do with animation-timing-function , but could not get the desired result using any of the built-in functions, such as ease-in-out or linear or a custom cubic-bezier function.
How to make animation smooth? If there are better ways, something similar can be done, feel free to let me know.
.overlay { background-image: -webkit-repeating-linear-gradient(0deg, transparent, transparent 1%, rgb(255, 255, 255) 2%, rgb(255, 255, 255) 2%); background-image: repeating-linear-gradient(90deg, transparent, transparent 1%, rgb(255, 255, 255) 2%, rgb(255, 255, 255) 2%); height: 200px; position: relative; width: 40%; margin: auto; } .circle { width: 100px; height: 100px; border-radius: 50%; background: #888; position: absolute; z-index: -1; left: 0; display: inline-block; } .move { -webkit-animation: moveAndGlow 2s infinite ease-in-out; animation: moveAndGlow 2s infinite ease-in-out; } @-webkit-keyframes moveAndGlow { 25% { background: #ccc; -webkit-transform: scale(.5); transform: scale(.5); margin-top: 25px; } 50% { left: 100%; margin-left: -100px; background: #888; -webkit-transform: scale(1); transform: scale(1); margin-top: 0; } 75% { background: #000; -webkit-transform: scale(1.5); transform: scale(1.5); margin-top: 25px; } } @keyframes moveAndGlow { 25% { background: #ccc; -webkit-transform: scale(.5); transform: scale(.5); margin-top: 25px; } 50% { left: 100%; margin-left: -100px; background: #888; -webkit-transform: scale(1); transform: scale(1); margin-top: 0; } 75% { background: #000; -webkit-transform: scale(1.5); transform: scale(1.5); margin-top: 25px; } }
<div class="overlay"> <span class="circle move"></span> </div>
css css3 rotation css-animations
Praveen puglia
source share