Skip to Content
Nextra 4.0 is released 🎉
笔记CSSCss 脉冲效果

Css 脉冲效果

html

<div> <span style="--i:1;"></span> <span style="--i:2;"></span> <span style="--i:3;"></span> <span style="--i:4;"></span> <span style="--i:5;"></span> <span style="--i:6;"></span> </div>

css

* { margin: 0; padding: 0; box-sizing: border-box; } body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #0a3643; } .pulse { position: relative; width: 200px; height: 200px; box-shadow: inset 0 0 40px #12b9ff, 0 0 50px #12b9ff; border-radius: 50%; border: 1px solid #12b9ff; background: url(earth.png); background-size: cover; animation: animateEarth 10s linear infinite; } .pulse span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: transparent; border: 1px solid #12b9ff; animation: animate 6s linear infinite; animation-delay: calc(var(--i) * -1s); border-radius: 50%; } @keyframs animate { 0% { width: 200px; height: 200px; opacity: 1; } 50% { opacity: 1; } 100% { width: 600px; height: 600px; opacity: 0; } } @keyframs animateEarth { 0% { background-position-x: 0px; } 100% { background-position-x: 360px; } }
Last updated on