前几天https://bahaasamir.me,我看到了这个网站,我想知道如何复制此文字效果?我的意思是在重叠图像(CSS或JS)时将黑色更改为白色。我尝试使用混合模式,但结果却没有那么好。如何获得这种效果的任何见解或方向?
您有几种选择。您可以选择自己编写脚本和CSS动画,也可以使用库
另一个选择是使用CSS动画
.element {
height: 250px;
width: 250px;
margin: 0 auto;
background-color: red;
animation-name: stretch;
animation-duration: 1.5s;
animation-timing-function: ease-out;
animation-delay: 0;
animation-direction: alternate;
animation-iteration-count: infinite;
animation-fill-mode: none;
animation-play-state: running;
}
@keyframes stretch {
0% {
transform: scale(.3);
background-color: red;
border-radius: 100%;
}
50% {
background-color: orange;
}
100% {
transform: scale(1.5);
background-color: yellow;
}
}
body,
html {
height: 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
}
<div class="element"></div>
只需检查CSS文本动画
@import "compass/css3";
@import url(https://fonts.googleapis.com/css?family=Finger+Paint);
body {
background: black;
overflow: hidden;
font: 5vw/100vh "Finger Paint";
text-align: center;
color: transparent;
backface-visibility: hidden;
}
span {
display: inline-block;
text-shadow: 0 0 0 whitesmoke;
animation: smoky 5s 3s both;
}
span:nth-child(even){
animation-name: smoky-mirror;
}
@keyframes smoky {
60% {
text-shadow: 0 0 40px whitesmoke;
}
to {
transform:
translate3d(15rem,-8rem,0)
rotate(-40deg)
skewX(70deg)
scale(1.5);
text-shadow: 0 0 20px whitesmoke;
opacity: 0;
}
}
@keyframes smoky-mirror {
60% {
text-shadow: 0 0 40px whitesmoke; }
to {
transform:
translate3d(18rem,-8rem,0)
rotate(-40deg)
skewX(-70deg)
scale(2);
text-shadow: 0 0 20px whitesmoke;
opacity: 0;
}
}
@for $item from 1 through 21 {
span:nth-of-type(#{$item}){
animation-delay: #{(3 + ($item/10))}s;
}
}
<span>C</span><span>S</span><span>S</span><span> </span><span>S</span><span>m</span><span>o</span><span>k</span><span>y</span><span> </span><span>T</span><span>e</span><span>x</span><span>t</span><span> </span><span>E</span><span>f</span><span>f</span><span>e</span><span>c</span><span>t</span>
https://css-tricks.com/methods-contrasting-text-backgrounds/
再次阅读您的问题后,我发现这与图像背景上的文字形成对比...
有几支笔,因此当您在剪切路径上设置动画时,可以更改颜色