$size: 80px; $space: 60px; body { background: #000; overflow: hidden; height: 100vh; } .container { width: 200px; height: 200px; margin: 0px auto; margin-top: 10%; } .ball { width: 0.6*$size; height: $size; border-radius: 3px; margin: 0px auto; background: yellow; -webkit-animation: CURL 50s infinite; animation: CURL 50s infinite; } @-webkit-keyframes CURL { 0%, 100% { transform: translate(0,2*$space) rotate(120deg) scale(1); } 10%, 60%, 80% { transform: translate(0,1.4*$space) rotate(90deg) scale(1); /* border-radius: 10px; */ } 20%, 50% { transform: translate(0,1.6*$space) rotate(72deg) scale(1); } 30%, 70% { transform: translate(2*$space, 2*$space) rotate(60deg) scale(1); } 40%, 90% { transform: translate(2*$space,2*$space) rotate(45deg); } } @keyframes CURL { 0%, 100% { transform: translate(0,2*$space) rotate(120deg) scale(1); } 10%, 60%, 80% { transform: translate(0,1.4*$space) rotate(90deg) scale(1); /* border-radius: 10px; */ } 20%, 50% { transform: translate(0,1.6*$space) rotate(72deg) scale(1); } 30%, 70% { transform: translate(2*$space, 2*$space) rotate(60deg) scale(1); } 40%, 90% { transform: translate(2*$space,2*$space) rotate(45deg); } }