JSFiddle - React, Tailwind, and code Playground

by geekrose Lee

HTML

<button id="b1">Start Animation</button><button id="b2">Animation Done</button>

CSS

button {
min-width:0px;
height: 22px;
width: 200px;
}

#b2 {
width: 0px; display:none;
}

JavaScript

$("button").click(function(){
     $("#b1").animate({width:'0px',padding:'0px'}, 1000,function(){$('#b1').hide();});
     $("#b2").css('display','inline-block').animate({width:'200px'}, { duration: 1000, queue: false });
  });