<!DOCTYPE html> <html lang="en">
<head> <meta charset="UTF-8" /> <meta name="viewport" content= "width=device-width, initial-scale=1.0" /> <title>GeeksforGeeks</title> </head>
<body> <div> <span>G</span> <span>e</span> <span>e</span> <span>k</span> <span>s</span> <span>f</span> <span>o</span> <span>r</span> <span>G</span> <span>e</span> <span>e</span> <span>k</span> <span>s</span> </div> </body>
</html>步驟1:第一步很簡單,我們將文本居中對齊並為我們的身體提供背景。
步驟2:然後,我們提供了一個線性動畫,其關鍵幀標識符為animate。
步驟3:現在我們使用關鍵幀將模糊功能應用於動畫的不同幀。
步驟4:最後一步是應用第n個子概念為每個角色提供動畫延遲,以便在一個時間點只有一個角色變得模糊。
<style> body { margin: 0; padding: 0; background: green; }
.geeks { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 30px; font-weight: 800; letter-spacing: 5px; }
.geeks span { animation: animate 3s linear infinite; }
.geeks span:nth-child(1) { animation-delay: 0s; }
.geeks span:nth-child(2) { animation-delay: 0.1s; }
.geeks span:nth-child(3) { animation-delay: 0.2s; }
.geeks span:nth-child(4) { animation-delay: 0.3s; }
.geeks span:nth-child(5) { animation-delay: 0.4s; }
.geeks span:nth-child(6) { animation-delay: 0.5s; }
.geeks span:nth-child(7) { animation-delay: 0.6s; }
.geeks span:nth-child(8) { animation-delay: 0.9s; }
.geeks span:nth-child(9) { animation-delay: 0.8s; }
.geeks span:nth-child(10) { animation-delay: 0.9s; }
.geeks span:nth-child(11) { animation-delay: 1s; }
.geeks span:nth-child(12) { animation-delay: 1.1s; }
.geeks span:nth-child(13) { animation-delay: 1.2s; }
@keyframes animate { 0% { filter: blur(0); }
40% { filter: blur(20px); }
80% { filter: blur(0); }
100% { filter: blur(0); } } </style>完整代碼:在本節中,我們將結合以上兩個部分來創建加載文本動畫效果。<!DOCTYPE html> <html lang="en">
<head> <meta charset="UTF-8" /> <meta name="viewport" content= "width=device-width, initial-scale=1.0" />
<title>Document</title> <style> body { margin: 0; padding: 0; background: green; }
.geeks { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 30px; font-weight: 800; letter-spacing: 5px; }
.geeks span { animation: animate 3s linear infinite; }
.geeks span:nth-child(1) { animation-delay: 0s; }
.geeks span:nth-child(2) { animation-delay: 0.1s; }
.geeks span:nth-child(3) { animation-delay: 0.2s; }
.geeks span:nth-child(4) { animation-delay: 0.3s; }
.geeks span:nth-child(5) { animation-delay: 0.4s; }
.geeks span:nth-child(6) { animation-delay: 0.5s; }
.geeks span:nth-child(7) { animation-delay: 0.6s; }
.geeks span:nth-child(8) { animation-delay: 0.9s; }
.geeks span:nth-child(9) { animation-delay: 0.8s; }
.geeks span:nth-child(10) { animation-delay: 0.9s; }
.geeks span:nth-child(11) { animation-delay: 1s; }
.geeks span:nth-child(12) { animation-delay: 1.1s; }
.geeks span:nth-child(13) { animation-delay: 1.2s; }
@keyframes animate { 0% { filter: blur(0); }
40% { filter: blur(20px); }
80% { filter: blur(0); }
100% { filter: blur(0); } } </style> </head>
<body> <div> <span>G</span> <span>e</span> <span>e</span> <span>k</span> <span>s</span> <span>f</span> <span>o</span> <span>r</span> <span>G</span> <span>e</span> <span>e</span> <span>k</span> <span>s</span> </div> </body>
</html>