I often see some circular wave graphics on mobile devices to display the amount. At first I thought this effect could only be created using canvas, but later I found that it could also be created using CSS. Principle: We all know that setting Let’s take a look at the effect diagram first: //css code .wave { position: relative; width: 200px; height: 200px; background: @color; border: 5px solid #76daff; border-radius: 50%; overflow: hidden; } .wave-box::before, .wave-box::after { content: ''; position: absolute; top: 0; left: 50%; width: 400px; height: 400px; border-radius: 45%; -webkit-transform: translate(-50%, -70%); transform: translate(-50%, -70%); background: rgba(255, 255, 255, 0.5); -webkit-animation: rotate 10s linear infinite; animation: rotate 10s linear infinite; z-index: 10; } @keyframes rotate { 50% { -webkit-transform: translate(-50%, -75%) rotate(180deg); transform: translate(-50%, -75%) rotate(180deg); } 100% { -webkit-transform: translate(-50%, -70%) rotate(180deg); transform: translate(-50%, -70%) rotate(180deg); } } //Or it is more convenient to use a precompiled language, here we use less .wave(@width; @height; @color) { position: relative; width: @width; height: @height; background: @color; border: 5px solid @color; border-radius: 50%; overflow: hidden; &::before, &::after { content: ''; position: absolute; top: 0; left: 50%; width: @width * 2; height: @height * 2; border-radius: 45%; transform: translate(-50%, -70%); background: rgba(255,255,255,0.5); animation: rotate 10s linear infinite; z-index: 10; } &::after { border-radius: 47%; background: rgba(255,255,255,0.5); animation: rotate 10s linear -5s infinite; z-index: 20; } } //Call .wave-box { .wave(200px; 200px; #76daff); } <!-- Called on the page --> <div class="wave-box"></div> Summarize The above is what I introduced to you about using CSS to achieve circular wave effects. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! |
<<: A brief discussion on the synchronization solution between MySQL and redis cache
>>: Web standards learning to understand the separation of structure and presentation
1. Import echart in HTML file <!-- Import echa...
1. Write a Mysql link setting page first package ...
Preface: The "Getting Started with MySQL&quo...
In Linux systems, especially server systems, it i...
There are many read-write separation architecture...
To merge the following two files, merge them toge...
Table of contents 1. Generate AST abstract syntax...
1. Rendering JD Effect Simulation Effect 2. Princ...
How to Install GRUB for Linux Server You cannot u...
Preface The SQL mode affects the SQL syntax that ...
Block element HTML tag classification details * a...
Before reading this article, it is best to have a...
Table of contents 1. Requirements description 2. ...
Three MySQL instance processes are started on one...
Table of contents Initially using the callback fu...