JSFiddle - React, Tailwind, and code Playground

HTML

<div id=parent>
    <div id=child>
    </div>
</div>

CSS

#parent{
    width: 200px;
    height: 200px;
    background: blue;
    position: relative;
    overflow: visible;
}
#child{
    width:100px;
    height: 10px;
    background: red;
    position: absolute;
    right: -50px;
    top: 100px;
}

JavaScript

//First you will notice that the red bar is fully visible
setTimeout(function(){
    //when the animation starts, the red bar is half visible
       $("#parent").animate({width: '300'}, 2000);
}, 2000);
//when the animation ends, the red bar appears again.