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
1. What is positioning? The position attribute in...
Mouse effects require the use of setTimeout to ge...
Table of contents Listener watch Format Set up th...
Table of contents 1. Preliminary preparation 1.1 ...
Table of contents Preface Dockerfile What is a Do...
1. Virtual environment follows the project, creat...
In the front-end and back-end separation developm...
Database migration is a problem we often encounte...
I have been in contact with PHP for so long, but ...
Table of contents 1. Project folder structure 1. ...
To summarize the form submission method: 1. Use t...
This article mainly introduces an example of how ...
Two-column layout is often used in projects. Ther...
Zabbix 2019/10/12 Chenxin refer to https://www.za...
Today I experimented with the network settings un...