.button { width: 100%; height: 100rpx; position: absolute; background-color: red; } .sk-wandering-cubes .sk-cube { background-color: #67cf22; width: 20rpx; height: 20rpx; position: absolute; top: 0; left: 0; } .sk-wandering-cubes .sk-cube2 { -webkit-animation-delay: -0.9s; animation-delay: -0.9s; } @-webkit-keyframes sk-wanderingCube { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 25% { -webkit-transform: translateX(60rpx) rotate(-90deg) scale(0.5); transform: translateX(60rpx) rotate(-90deg) scale(0.5); } 50% { /* Hack to make FF rotate in the right direction */ -webkit-transform: translateX(60rpx) translateY(60rpx) rotate(-179deg); transform: translateX(60rpx) translateY(60rpx) rotate(-179deg); } 50.1% { -webkit-transform: translateX(60rpx) translateY(60rpx) rotate(-180deg); transform: translateX(60rpx) translateY(60rpx) rotate(-180deg); } 75% { -webkit-transform: translateX(0) translateY(60rpx) rotate(-270deg) scale(0.5); transform: translateX(0) translateY(60rpx) rotate(-270deg) scale(0.5); } 100% { -webkit-transform: rotate(-360deg); transform: rotate(-360deg); } } .play { -webkit-animation: sk-wanderingCube 1.8s ease-in-out -1.8s infinite both; animation: sk-wanderingCube 1.8s ease-in-out -1.8s infinite both; } .restart { animation: sk-wanderingCube 5s infinite ease; } .pause { animation-play-state: paused; }