JSFiddle - React, Tailwind, and code Playground

by luka kupunia

HTML

<div class="layer-1"></div>
<div class="layer-2">
    <img src="https://picsum.photos/400/280" alt="">
</div>

CSS

.layer-1 {
    position: absolute;
    width: 100%;
    height: 100%;
    background: blue;
}
.layer-2 {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.3;
}
.layer-2:after {
    content: '';
    width: 400px;
    height: 280px;
    background: blue;
    position: absolute;
    left: 0;
    top: 0;
    transform: scaleX(0);
    transition: 1s;
}