JSFiddle - React, Tailwind, and code Playground

HTML

<div id="caption"><span>Animation, No Mask</span></div>

CSS

body {background: #000; overflow: hidden}

div {
    
    display: inline-block; 
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -60px 0 0 -160px;
    color: white; 
    font: 36px Verdana;
    width: 400px;
    height: 100px;

}

span {
    display: inline-block; 
    width: 400px; 
    position: absolute; 
    top: 0; 
    left: 400px;
    white-space: nowrap;
    background: red;
    padding: 20px;
    transition: all 0.5s ease-out;
}

.animate-mask span {left: 0;}

JavaScript

setTimeout(function() {
    
    document.getElementById('caption').className = 'animate-mask';
    
}, 1000);