效果预览
鼠标经过文字的时候,会出现烟雾的效果
午南卜卯印即去又及取受口召可史右各合吉名向君启吹告周咸品唐唯商
喜嘉四因囿圉土在壬复夕夙多大天夫夷奚奠女好如妣妥妹妻妾姬娥子季
宀宁它宅安宗官宜宣室宫
gif预览
具体代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| <!DOCTYPE html> <html lang="en">
<head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>烟雾效果测试</title> </head>
<body> <div id="preview-container" class="smoke-container"> <p class="smoke-text"> 午南卜卯印即去又及取受口召可史右各合吉名向君启吹告周咸品唐唯商
喜嘉四因囿圉土在壬复夕夙多大天夫夷奚奠女好如妣妥妹妻妾姬娥子季
宀宁它宅安宗官宜宣室宫 </p> </div> <script> const text = document.getElementById('preview-container').querySelector('.smoke-text'); text.innerHTML = text.textContent.replace(/\S/g, "<span>$&</span>")
const letters = text.querySelectorAll("span");
for (let letter of letters) { letter.addEventListener('mouseover', function () { letter.classList.add('active'); }); } </script> </body> <style> .smoke-container { position: relative; display: flex; justify-content: center; align-items: center; width: 100%; height: 440px; background-image: url('https://cdn.jsdelivr.net/gh/Qiu-Weidong/blog/resources/images/matrix/wallhaven-e72xro.jpg'); background-size: 100%; overflow: hidden; }
.smoke-container .smoke-text { color: aliceblue; user-select: none; font-family: '甲骨文'; font-size: 20px; margin-left: 20%; margin-right: 20%; }
.smoke-container .smoke-text span { position: relative; display: inline-block; }
.smoke-container .smoke-text span.active { animation: smoke 4s linear forwards; transform-origin: bottom; }
@keyframes smoke { 0% { opacity: 1; filter: blur(0); transform: translateX(0) translateY(0) rotate(0deg) scale(1); }
30% { opacity: 0; filter: blur(20px); transform: translateX(300px) translateY(-300px) rotate(720deg) scale(4); }
100% { opacity: 1; transform: translateX(0) translateY(0) rotate(0deg) scale(1);
} }
@font-face { font-family: '甲骨文'; font-display: swap; src: url('https://cdn.jsdelivr.net/gh/Qiu-Weidong/blog/resources/fonts/FZJiaGW.TTF') format('truetype'); }
@font-face { font-family: '小篆'; src: url('https://cdn.jsdelivr.net/gh/Qiu-Weidong/blog/resources/fonts/FZXZTFW.TTF'); }
@font-face { font-family: '大篆'; font-display: swap; src: url('https://cdn.jsdelivr.net/gh/Qiu-Weidong/blog/resources/fonts/STFJinWDZFU.TTF'); } </style>
</html>
|