I am try to make a running santa in my project.
How to loop transform: scaleX(1) and transform: scaleX(-1) when the animation start in 0% an 50%?
setTimeout(function(){
//Enter your stuff here
$('.animation').css("transform", "scaleX(1)")
}, 7500);
.animation img {
max-width: 100%;
}
.animation {
width: 50px;
position: absolute;
bottom: 0;
animation: example 15s infinite;
padding: 5px 9px 1px 0;
border-top-right-radius: 20px;
border-top-left-radius: 20px;
transform: scaleX(-1)
}
@keyframes example {
0%,
100% {
left: 0;
/* background: white; */
}
40% {
/* background: green; */
}
30% {
/* background: yellow; */
}
20% {
/* background: orange; */
}
50% {
left: 97%;
/* background: blue; */
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="animation">
<img src="https://lh3.googleusercontent.com/pw/AM-JKLX6lpuXIUQzWYC8J9vlnsS9Cb9irs-2kPKBM9XaugC4iDCag2-7w-zC7BSQls0Ea51YewUFFSJquODLZ8PfaAoqelAXOlCKmh0H7Cn9G5HcwX_u2XNT_tvr8ZD5as6He3dpMrrVH_-ZCaG1xctS_Tei=s512-no" alt="run santa run">
</div>
Codepen link: demo