JSFiddle - React, Tailwind, and code Playground
HTML
<div class="prop">
<div class="width"></div>
</div>
CSS
.prop{
position: relative;
background-color:red;
border:solid black 8px;
width: 200px;
box-sizing: border-box;
border-radius: 200px;
}
.prop:after{
padding-top: 100%; /* relative to width! */
content: "";
display: block;
}
.width{
position: absolute;
left: 50%;
margin-left: -15px;
margin-top: -5px;
top: 50%;
}
JavaScript
var prop = $(".prop")[0];
function animate()
{
// Меняю только ширину
prop.style.width =
50 + Math.abs(Math.sin(new Date().getTime() / 1000)) * Math.PI * 50 + "px";
prop.children[0].innerHTML = parseInt(prop.style.width) + " px";
}
setInterval(animate, 1000/30);