"; 2. Set borders with different effects through animation attributes to rotate, The code is "animation: circle 2s infinite linear; @keyframes circle {0% {transform: rotate(0deg);}"."/> "; 2. Set borders with different effects through animation attributes to rotate, The code is "animation: circle 2s infinite linear; @keyframes circle {0% {transform: rotate(0deg);}".">

Home  >  Article  >  Web Front-end  >  How to make a circle rotate with css3 animation

How to make a circle rotate with css3 animation

藏色散人
藏色散人Original
2023-02-01 10:54:302421browse

How to rotate a circle with css3 animation: 1. Create a new HTML sample file and define the div as "188263384bc4c0decce28aa87ab1847116b28748ea4df4d9c2150843fecfba68"; 2. Through animation attributes Set borders with different effects and perform rotation. The code is "animation: circle 2s infinite linear; @keyframes circle {0% {transform: rotate(0deg);}".

How to make a circle rotate with css3 animation

The operating environment of this tutorial: Windows 10 system, CSS3 version, DELL G3 computer

How to rotate a circle with css3 animation?

CSS3 ring rotation effect

1. CSS3 ring rotation effect 1

Principle: Set borders with different effects and rotate them

<div class="demo"></div><style>
    .demo {
        width: 250px;
        height: 250px;
        border: 50px solid red;
        border-left-color: blue;
        border-right-color: yellow;
        border-top-color: #04f105;
        margin: 100px;
        border-radius: 50%;
        animation: circle 2s infinite linear;
    }
    @keyframes circle {
        0% {
            transform: rotate(0deg);
        }

        100% {
            transform: rotate(-360deg);
        }
    }</style>

## 2. Css 3 Ring Effect 2

Principle: Use multi-layered borders to lower the groove and perform rotation

<div class="demoout">
    <div class="demo"></div></div><style>
    body {
        background: black;
    }

    .demo {
        width: 250px;
        height: 250px;
        border: 3px solid white;
        border-left-color: blue;
        border-right-color: yellow;
        margin: 25px;
        border-radius: 50%;
        animation: circle 4s infinite ease;
        background: white;
    }

    .demoout {
        width: 300px;
        height: 300px;
        border: 3px solid white;
        border-top-color: green;
        border-bottom-color: red;
        margin: 100px;
        border-radius: 50%;
        animation: circle 4s infinite linear;
        background: white;
    }

    @-webkit-keyframes circle {
        0% {
            transform: rotate(0deg);
        }

        100% {
            transform: rotate(-360deg);
        }
    }</style>
The effect is as follows:

Recommended study: "

css video tutorial"

The above is the detailed content of How to make a circle rotate with css3 animation. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What element is css pNext article:What element is css p