效果图

关键样式 - 遮罩mask
图片素材
【注】需要透明底色的文字图片

完整代码
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>loading</title>
<style lang="scss" scoped>
* {
padding: 0;
margin: 0;
}
.a-loading {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.content {
position: absolute;
padding: 0 20px;
border-radius: 20px;
background-color: #dad8d554;
}
.content-loading {
max-width: 420px;
min-width: 300px;
width: 100%;
height: 90px;
background: linear-gradient(to right, #ffffff, #d94c4c);
background-size: 200%;
animation: translationX 2s linear infinite;
/* mask-size: 100%; */
mask-repeat: no-repeat;
mask-position: center;
mask-image: url("/images/loading1.png");
}
@keyframes translationX {
0% {
background-position: 200% 200%;
}
100% {
background-position: 0 0;
}
}
</style>
</head>
<body>
<div class="a-loading">
<div class="content">
<div class="content-loading"> </div>
</div>
</div>
</body>
</html>