The content of this article is about how to use pure CSS to realize abstract rippling water animation (source code attached). It has certain reference value. Friends in need can refer to it. I hope it will be useful to you. Helps.
<div> <span></span> <span></span> <span></span> <span></span> <span></span> <span></span> <span></span> <span></span> <span></span> </div>
body { margin: 0; height: 100vh; display: flex; align-items: center; justify-content: center; background-color: black; }
.container { width: 30em; height: 30em; font-size: 10px; }
.container { display: grid; grid-template-columns: repeat(3, 1fr); }
.container span { position: relative; } .container span::before, .container span::after { content: ''; position: absolute; box-sizing: border-box; border-style: none solid solid none; border-width: 1em; border-color: gold; width: 100%; height: 100%; }
.container { transform: rotate(-135deg); }
.container span::before, .container span::after { animation: animate-scale 1.6s linear infinite; } @keyframes animate-scale { from { width: 1%; height: 1%; } to { width: 100%; height: 100%; } }
.container span::before, .container span::after { animation: animate-border-color 1.6s linear infinite, animate-scale 1.6s linear infinite; } @keyframes animate-border-color { 0%, 25% { border-color: tomato; } 50%, 75% { border-color: gold; } 100% { border-color: black; } }
.container span::before, .container span::after { animation: animate-border-width 1.6s linear infinite, animate-border-color 1.6s linear infinite, animate-scale 1.6s linear infinite; }
::after slow down the animation time of the pseudo element by half a beat :
.container span::after { animation-delay: -0.8s; } @keyframes animate-border-width { 0%, 100%{ border-width: 0.1em; } 25% { border-width: 1.5em; } }
The above is the detailed content of How to use pure CSS to achieve abstract rippling water animation (source code attached). For more information, please follow other related articles on the PHP Chinese website!