In my animation, I like to use transformation. This is also possible to make It with left/right property. But I like to use the transform. I need to move the freeze-loading-bar 100% to right and It should be an infinite loop.
How can I move the
loading-barto right 100%/ fully?
*,
*::before,
*::after {
box-sizing: border-box;
}
.app-view {
height: 200px;
max-width: 300px;
margin: 1rem auto;
background-color: #fff;
box-shadow: -2px 2px 4px 0 #e0e0e0ad, 1px -1px 9px 0 #dddddd2e;
padding: 2rem;
display: flex;
align-items: center;
justify-content: center;
}
.freeze-loading {
position: relative;
width: 100%;
height: 5px;
box-shadow: inset 1px 0px 4px 0 #ddd;
/** disual purpose **/
/** overflow: hidden; **/
}
.freeze-loading-bar {
position: absolute;
left: 0;
width: 80px;
height: 100%;
background-color: rgb(0, 132, 255);
animation: freeze-loading-bar 2s linear infinite;
}
@keyframes freeze-loading-bar {
from {
transform: translateX(-100px);
}
to {
transform: translateX(100%);
}
}
<div class="app-view">
<div class="freeze-loading">
<div class="freeze-loading-bar"></div>
</div>
</div>