代码如下 :
.text{
width: 1000px;
font-size: 120px;
font-weight: 900;
background: url("./background.jpg");
background-clip: text;
-webkit-background-clip: text;
color: transparent;
animation: dynamic 5s infinite alternate linear;
}
@keyframes dynamic {
0%{
background-position: 0%;
}
100%{
background-position: 100%;
}
}
视图:
<div class="text">JavaScript</div>
效果图: