avatar

前端/CSS特效

loading:

玩命加载中...

h1 { position: relative; color: rgba(0, 0, 0, .3); font-size: 5em } h1:before { content: attr(data-text); position: absolute; overflow: hidden; max-width: 7em; white-space: nowrap; color: #fff; animation: loading 8s linear; } @keyframes loading { 0% { max-width: 0; } }

链接:https://zhuanlan.zhihu.com/p/391561733

聚光灯:

LIZHENWEN

body {
margin: 0;
display: flex;
justify-content: center;
align-items: center;
background-color: #222;
min-height: 100vh;
}

h1 {
font-size: 9rem;
font-family: Helvetica;
letter-spacing: -.3rem;
color: #333;
position: relative;
}

h1::after {
content: attr(dot-light);
position: absolute;
top: 0;
left: 0;
color: transparent;
clip-path: ellipse(100px 100px at 0% 50%);
animation: SpotLight 5s infinite;
background-image: url(“https://images.unsplash.com/photo-1568279898331-4870e84677dd?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTh8fGxpbmVhcnxlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60");
background-size: 150%;
background-position: center center;
-webkit-background-clip: text;
background-clip: text;
}

@keyframes SpotLight {
0% {
clip-path: ellipse(100px 100px at 0% 50%);
}

50% {
    clip-path: ellipse(100px 100px at 100% 50%);
}

100% {
    clip-path: ellipse(100px 100px at 0% 50%);
}

}

文章作者: 小黑
文章链接: http://ynxh.xyz/2023/01/17/前端/CSS特效/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 小黑的小站
打赏
  • 微信
    微信
  • 支付寶
    支付寶
2