Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS - Animated moving object won't stay where it stopped

Tags:

html

css

So I'm fiddling with animations, and I've stumpled upon a problem, after I've moved my object it return to it's initial position. Is there a way to keep it at its final position?

Some of the CSS I've got:

.spinner-word span {
    font-size: 4vw;
    text-transform: uppercase;
    font-weight: bold;
    position: relative;
    animation: move .5s linear;
    animation-delay: 1.5s;
}

@keyframes move {
    0% {
        left: -8vw;
    }
    100% {
        left: 0px;
    }
}

My fiddle

like image 378
Michael Tot Korsgaard Avatar asked Nov 28 '25 08:11

Michael Tot Korsgaard


1 Answers

You need to add animation-fill-mode: forwards;

MDN Reference

The target will retain the computed values set by the last keyframe encountered during execution. The last keyframe encountered depends on the value of animation-direction and animation-iteration-count

like image 170
Paulie_D Avatar answered Nov 29 '25 20:11

Paulie_D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!