I would like to create a effect to reveal to text like my codesandbox. Instead of using animation mask-image, do I have any other option?
.animation-text-wipe {
-webkit-mask-image: linear-gradient(
to left,
rgba(255, 255, 255, 0) 75%,
#000 75%
);
-webkit-mask-size: 500%;
}
.animation-text-wipe.animate-in {
animation-name: text-wipe;
animation-duration: 5s;
animation-timing-function: linear;
animation-delay: 0.1s;
animation-iteration-count: infinite;
animation-fill-mode: forwards;
}
@keyframes text-wipe {
0% {
opacity: 1;
-webkit-mask-position: 100%;
}
100% {
opacity: 1;
-webkit-mask-position: 0%;
}
}
.text {
width: 60%;
color: #000;
background-color: #ffff;
}
.app {
background-color: red;
}
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div class="App">
<div class="text-animations">
<div class="animate-in animation-text-wipe">
<div class="text">
<span> i am label </span>
<input />
<span> i am label </span>
<input />
<span> i am label </span>
<input />
<span> i am label </span>
<input />
<p>
real-world studies published Wednesday confirm that the immune
protection offered by two doses of Pfizer's Covid-19 vaccine drops
off after two months or so, although protection against severe
disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England
Journal of Medicine, support arguments that even fully vaccinated
people need to maintain precautions against infection. One study
from Israel covered 4,800 health care workers and showed antibody
levels wane rapidly after two doses of vaccine "especially among
men, among persons 65 years of age or older, and among persons
with immunosuppression." Vaccines may have prevented a
quarter-million Covid-19 cases and 39,000 deaths among seniors
Vaccines may have prevented a quarter-million Covid-19 cases and
39,000 deaths among seniors "We conducted this prospective
longitudinal cohort study involving health care workers at Sheba
Medical Center, a large tertiary medical center in Israel,"
Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The
researchers noted that levels of so-called neutralizing antibodies
-- the immune system's first line of defense against infection --
correlate with protection against infection, but for this study
they studied only antibody levels.
</p>
</div>
</div>
</div>
</div>
</body>
</html>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>
codesandbox
CodePudding user response:
Here you go...
body {
margin: 0;
padding: 0;
}
body:not(.App) {
background-color: red;
}
.App {
background-color: white;
}
.text::before {
content: '';
background: red;
position: absolute;
width: 60%;
height: 100%;
animation-name: reveal;
animation-duration: 5s;
animation-timing-function: linear;
animation-delay: 0.1s;
animation-iteration-count: infinite;
animation-fill-mode: forwards;
right: 0;
}
@keyframes reveal {
0% {
width: 100%;
}
/* First second. */
20% {
width: 88%;
}
/* Second second. */
40% {
width: 76%;
}
/* Third second. */
60% {
width: 64%;
}
/* Fourth second. */
80% {
width: 52%;
}
/* Fifth second. */
100% {
width: 40%;
}
}
.text {
width: 60%;
}
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Document</title>
</head>
<body>
<div class='App'>
<div class='text-animations'>
<div class='animate-in animation-text-wipe'>
<div class='text'>
<span> i am label </span>
<input />
<span> i am label </span>
<input />
<span> i am label </span>
<input />
<span> i am label </span>
<input />
<p>
real-world studies published Wednesday confirm that the immune protection offered by two doses of Pfizer's Covid-19 vaccine drops off after two months or so, although protection against severe disease, hospitalization and death remains strong. The studies,
from Israel and from Qatar and published in the New England Journal of Medicine, support arguments that even fully vaccinated people need to maintain precautions against infection. One study from Israel covered 4,800 health care workers and
showed antibody levels wane rapidly after two doses of vaccine 'especially among men, among persons 65 years of age or older, and among persons with immunosuppression.' Vaccines may have prevented a quarter-million Covid-19 cases and 39,000
deaths among seniors Vaccines may have prevented a quarter-million Covid-19 cases and 39,000 deaths among seniors 'We conducted this prospective longitudinal cohort study involving health care workers at Sheba Medical Center, a large tertiary
medical center in Israel,' Sheba's Dr. Gili Regev-Yochay and colleagues wrote. The researchers noted that levels of so-called neutralizing antibodies -- the immune system's first line of defense against infection -- correlate with protection
against infection, but for this study they studied only antibody levels.
</p>
</div>
</div>
</div>
</div>
</body>
</html>
<iframe name="sif2" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>