【发布时间】:2021-11-29 03:59:55
【问题描述】:
我想创建一个效果来显示文本,例如我的代码框。除了使用动画蒙版图像,我还有其他选择吗?
.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>
【问题讨论】:
-
你的目标是什么效果?你目前的方法有问题吗?
-
寻求代码帮助的问题必须包括在问题本身中重现它所需的最短代码,最好是在堆栈片段中。尽管您提供了一个链接,但如果它变得无效,那么您的问题对于未来遇到同样问题的其他 SO 用户将毫无价值。见Something in my website/example doesn't work can I just paste a link。
-
我寻找像我的代码框一样显示文本效果。但是想知道是否有更好的解决方案而不是使用面具
-
@Paulie_D 我在描述中包含了我的代码框
-
@Paulie_D 明白。更新问题
标签: javascript css animation css-animations