JSFiddle - React, Tailwind, and code Playground
HTML
<body onLoad="getRule()">
<div id="fundo">
<div id="ball1"></div>
</div>
</body>
CSS
#fundo{
height: 100%;
width: 100%;
position: absolute;
}
#ball1{
position: absolute;
background-color: black;
height: 50px;
width: 50px;
border-radius: 100%;
animation-duration: 5s;
animation-delay: 1s;
animation-iteration-count: infinite;
animation-name: "voador";
}
@Keyframes ball1{
}
JavaScript
function getRule() {
var rule;
var ss = document.styleSheets;
for (var i in ss) {
// loop through all the rules!
for (var x in ss[i].cssRules) {
rule = ss[i].cssRules[x];
if (rule.name === "voador" && rule.type === CSSRule.KEYFRAMES_RULE) {
var k = 100;
for(var j=0; j<101; j++){
ss[i].cssRules[x]..appendRule(j+"% { margin-left: " + k + "%; }");
k--;
}
return;
}
}
}
}