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
Preface In order to meet the high availability of...
How to Install GRUB for Linux Server You cannot u...
Table of contents Preface 1. Iceraven Browser (Fi...
In MySQL, there is a function called "group_...
Description: Change the carriage return in the tex...
Definition and Usage The <input> tag is use...
How to implement text icons through CSS /*icon st...
The Linux command line provides many commands to ...
Table of contents What is an index The difference...
Table of contents ReactRouterV6 Changes 1. <Sw...
This tag is not part of HTML3.2 and only supports ...
If you have developed DApps on Ethereum, you may ...
It is very important to monitor the operating sta...
1. Check the maximum number of open files in the ...
1. Download the installation package -Choose the ...