<p>A two-color gradient with a size animation</p>
<span class="type" style="--n:22;">I am a multi-line text</span>
<p>We make the first color transparent</p>
<span class="type transparent" style="--n:22;">I am a multi-line text</span>
<p>We add the position animation</p>
<span class="type transparent move" style="--n:22;">I am a multi-line text</span>
<p>We make both animations discrete</p>
<span class="type transparent move step" style="--n:22;">I am a multi-line text</span>
body {
background:#005F6B;
color:#fff;
max-width:300px;
}
p {
margin:5px 0;
}
.type {
outline:2px solid red;
font-family: monospace;
color:#0005;
font-weight: 700;
font-size:35px;
background:linear-gradient(-90deg, #00DFFC 5px, var(--c,red) 0) 10px 0;
background-size:calc(var(--n)*1ch) 200%;
background-repeat:no-repeat;
animation:t calc(var(--n)*.3s) linear infinite alternate;
}
@keyframes t{
from {background-size:0 200%}
}
@keyframes b{
50% {background-position:0 -100%}
}
.transparent {
--c:#0000;
}
.move {
animation:
b .7s infinite linear,
t calc(var(--n)*.3s) linear infinite alternate;
}
.step {
animation-timing-function:steps(1), steps(var(--n))
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.