JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
    <div class="background">  
    </div>
    <input type="text" name="test" class="white" /> 
</div>

CSS

* {
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    
}
.container {
    width: 200px;
    height: 50px;
    overflow: hidden;
    position: relative;
}

.background {
    position: absolute;
    left: 100%;
    background: red;
    width: 100%;
    height: 100%;
    
    opacity: 0.5;
    -webkit-opacity: 0.5;
    z-index:0;
}
.background.view {
    left: 0;
}

.white {
    background-color: white;
}
.red {
    background-position: 0 0;
}
input {
    background-image: url(http://www.kinsmancreative.com/images/red.png);
    background-position: 200px 0;
    background-repeat: no-repeat;
    background-color: white;
    width: 100%;
    height: 100%;
    z-index: 100;
    -webkit-transition: background-position 300ms linear;
    transition: background-position 300ms linear;
    
}

JavaScript

$("input").focus(function(e){
    $(this).addClass("red");
});
$("input").focusout(function(e){
    $(this).removeClass("red");
});