I have a CSS animation that I want to play through once and then stop at the final keyframe. However, currently it keeps returning to the initial keyframe and stopping there instead of reaching the end. The animation involves a title heading that gradually fills up with color over time.
This code is being used within the Elementor plugin on my WordPress site.
Can anyone help me figure out what mistake I might be making?
<style>
:root{
--myText : 'HELLO';
--textColor: #EDC300;
--textStroke: 2px;
--anDuration: 8s;
}
selector{
-webkit-text-stroke: var(--textStroke) var(--textColor);
display: table;
width: -moz-fit-content;
width: -webkit-fit-content;
width: fit-content;
text-align: center;
margin: 0 auto
}
selector .elementor-heading-title::before{
content: var(--myText);
color: var(--textColor);
position: absolute;
top: 0;
width: 0%;
height: 100%;
text-align: left;
overflow: hidden;
white-space: nowrap;
border-right: var(--textStroke) solid var(--textColor);
-webkit-animation:animateX var(--anDuration) linear 1;
-webkit-animation-fill-mode: forwards;
animation:animateX var(--anDuration) linear 1;
animation-fill-mode: forwards;
}
@-webkit-keyframes animateX{
0%,10%,100%{
width:0%;
}
70%, 90%{
width: 100%;
}
}
@keyframes animateX{
0%,10%,100%{
width:0%;
}
70%, 90%{
width:100%;
}
}
</style>