Preface This article mainly shares with you an example of using CSS3 animation to achieve the effect of a circle expanding from small to large and spreading outward. The article involves CSS3 animation (animation), 2D transformation (transform: scale) A new animation property is added in CSS3, which is similar to creating an animation object. For example: animation: bounce 2.0s infinite ease-in-out; The animation has the following parameters:
2D transformations in CSS 3 are implemented using two properties:
Static renderings: As shown in the code: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style> @keyframes warn { 0% { transform: scale(0); opacity: 0.0; } 25% { transform: scale(0); opacity: 0.1; } 50% { transform: scale(0.1); opacity: 0.3; } 75% { transform: scale(0.5); opacity: 0.5; } 100% { transform: scale(1); opacity: 0.0; } } @-webkit-keyframes "warn" { 0% { -webkit-transform: scale(0); opacity: 0.0; } 25% { -webkit-transform: scale(0); opacity: 0.1; } 50% { -webkit-transform: scale(0.1); opacity: 0.3; } 75% { -webkit-transform: scale(0.5); opacity: 0.5; } 100% { -webkit-transform: scale(1); opacity: 0.0; } } .container { position: relative; width: 40px; height: 40px; border: 1px solid #000; } /* Keep the size of the small circle unchanged*/ .dot { position: absolute; width: 6px; height: 6px; left: 15px; top: 15px; -webkit-border-radius: 20px; -moz-border-radius: 20px; border: 2px solid red; border-radius: 20px; z-index: 2; } /* Generate an animated circle (spreading outward and getting bigger)*/ .pulse { position: absolute; width: 24px; height: 24px; left: 2px; top: 2px; border: 6px solid red; -webkit-border-radius: 30px; -moz-border-radius: 30px; border-radius: 30px; z-index: 1; opacity: 0; -webkit-animation: warn 3s ease-out; -moz-animation: warn 3s ease-out; animation: warn 3s ease-out; -webkit-animation-iteration-count: infinite; -moz-animation-iteration-count: infinite; animation-iteration-count: infinite; } </style> </head> <body> <div class="container"> <div class="dot"></div> <div class="pulse"></div> </div> </body> </html> Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM. |
<<: Vue sample code for online preview of office files
>>: HTML line spacing setting methods and problems
A cool JavaScript code to unfollow Weibo users in...
This article shares the specific code of jQuery t...
1. Block-level element: refers to the ability to e...
1. Enter start in the menu bar and click startup ...
MySQL consistency log What happens to uncommitted...
The command pattern is a behavioral design patter...
Table of contents 1. Nginx installation and start...
Original configuration: http { ...... limit_conn_...
Preface MySQL supports many types of tables (i.e....
html <!DOCTYPE html> <html lang="en...
The reason is that this type of web page originate...
Preface: The importance of database backup is sel...
Table of contents 1. Communication between father...
The application scenario is: the iframe page has n...
Use native js to implement a simple calculator (w...