There is such a scenario: a circular container, the background of the outermost container is an arc. Now the outermost arc needs to be rotated to ensure that the content inside the inner container does not rotate. Next, I will share with you a solution. Let's take a look at the final effect: Implementation ideas
Implementation process DOM structure part: layout of outer div and inner div load-panel is the outer div, headPortrait-img-panel is the inner div, loadWhirl is the outer rotation animation, and avatarRotation is the inner rotation animation. <!--Avatar area--> <div class="headPortrait-panel"> <!--Loading layer--> <div class="load-panel loadWhirl"> <!--Avatar display layer--> <div class="headPortrait-img-panel avatarRotation"> <img src="../assets/img/login/[email protected]"/> </div> </div> </div> CSS part: layout the styles and implement the rotation animation logic. /*Avatar area*/ .headPortrait-panel{ width: 100%; height: 200px; display: flex; justify-content: center; align-items: center; margin-top: 50px; /*Load layer*/ .load-panel{ width: 240px; height: 240px; border-radius: 50%; display: flex; justify-content: center; align-items: center; background: url("../img/login/[email protected]"); img{ width: 100%; height: 100%; } // Avatar rotation animation.avatarRotation{ animation: internalAvatar 3s linear; // Animation infinite loop animation-iteration-count:infinite; } /*Avatar display layer*/ .headPortrait-img-panel{ width: 200px; height: 200px; border-radius: 50%; overflow: hidden; border: solid 1px #ebeced; img{ width: 100%; height: 100%; } } } // External rotation animation.loadWhirl{ animation: externalHalo 3s linear; // Animation infinite loop animation-iteration-count:infinite; } } // Define the external halo rotation animation @keyframes externalHalo { 0%{ transform: rotate(0deg); } 25% transform: rotate(90deg); } 50%{ transform: rotate(180deg); } 100%{ transform: rotate(360deg); } } // Define internal avatar rotation animation @keyframes internalAvatar { 0%{ transform: rotate(0deg); } 25% transform: rotate(-90deg); } 50%{ transform: rotate(-180deg); } 100%{ transform: rotate(-360deg); } } Project gallery The above code address: chat-system After cloning the project locally, visit http://localhost:8020/login to view the effect. The file path for this article is: src/views/login.vue The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: Let you understand the deep copy of js
>>: The principle and configuration of Nginx load balancing and dynamic and static separation
This article originated from my complaints about ...
Table of contents 1 What is container cloud? 2 In...
Before, I had built WordPress myself, but at that...
1. What is HTML markup language? HTML is a markup...
Table of contents Docker-Maven-Plugin Maven plugi...
Promise is a new solution for asynchronous progra...
Step 1. Enable MySQL slow query Method 1: Modify ...
Understanding of polling In fact, the focus of po...
Let's first talk about the value of web front...
1. Documentation Rules 1. Case sensitive. 2. The a...
1. Stop the MySQL service in the command line: ne...
This article example shares the specific code of ...
theme Today I will teach you how to create a circ...
selinux ( Security-Enhanced Linux) is a Linux ker...
Foregoing: This document is based on the assumpti...