CSS3 uses transform-origin to achieve dot distribution on a large circle and rotation effects

CSS3 uses transform-origin to achieve dot distribution on a large circle and rotation effects

First, we need to use the transform-origin attribute. The transform attribute must be used. It has many attributes. We only need to use the rotate attribute of transform (to set the 2D rotation angle), and then use transform-origin to set its center point. Finally, match it with the CSS3 animation attribute animation. Complete the effect we want.
First, the effect picture:

insert image description here

Circles are dynamic.
Here are the steps:
1. Use of transform attribute:
We just need to use this property to set the position of the point on the circle where we need it. transform:rotate(the degree you need). In addition, we need to pay attention to one point ( if the small circles need to be distributed on the edge of the big circle, we need to set the relative attribute position: relative for the big circle and the absolute attribute position: absolute for the small circle to prevent the small circle from running outside the big circle ). So we have completed the first step.
2. Use of transform-origin attribute:
First we need to understand the meaning of the transform-origin attribute. It can set 3 properties, which I understand to be the three axes XYZ in sequence. We need to use XY2 axes here. Its default properties are 50% 50% 0. So what does this mean? It's very simple, just set the upper left corner of the node that sets the transform-origin attribute as the starting point. Move 50% on the X axis and 50% on the Y axis. Of course, if the center point you want is not inside the node, you can use PX to specify the center point outside the node. In the second step, we can get the effect of a small circle distributed on the boundary line of the big circle.
3. Use of animation attributes:
Similarly, first we need to know that the animation attribute is animation, please refer to the document for details. This is what we need.

animation:myfirst 10s linear infinite;

myfirst: Id for binding @keyframes
10s: time
linear: uniform speed
infinite: continuous

Finally, with @keyframes

 @keyframes myfirst{
    0%{
      transform: rotate(0);
    }
    25%
      transform:rotate(90deg);
    }
    50%{
      transform:rotate(180deg);
    }
    75%
      transform:rotate(270deg);
    }
    100%{
      transform: rotate(360deg);
    }
  }

Finished

This is the end of this article about using transform-origin in CSS3 to achieve dot distribution on a big circle and rotation effects. For more related content about using transform-origin in CSS3 to achieve dot distribution on a big circle and rotation effects, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

<<:  Example of how to change the line spacing of HTML table

>>:  Example of how to display a default image when an image does not exist in HTML

Recommend

Ubuntu 20.04 firewall settings simple tutorial (novice)

Preface In today's increasingly convenient In...

Vue's Render function

Table of contents 1. Nodes, trees, and virtual DO...

Let's talk about the issue of passing parameters to React onClick

Background In a list like the one below, clicking...

Vue implements horizontal scrolling of marquee style text

This article shares the specific code for Vue to ...

Why node.js is not suitable for large projects

Table of contents Preface 1. Application componen...

How to install Maven automatically in Linux continuous integration

Unzip the Maven package tar xf apache-maven-3.5.4...

Introduction to HTML_PowerNode Java Academy

What is HTML? HTML is a language used to describe...

Tutorial on installing AutoFs mount service under Linux

Whether it is Samba service or NFS service, the m...

Summary of CSS counter and content

The content property was introduced as early as C...

Detailed tutorial on installing MySQL 5.7.20 on RedHat 6.5/CentOS 6.5

Download the rpm installation package MySQL offic...

Solution for Docker container not recognizing fonts such as Songti

Problem background: When using docker to deploy t...

CSS to achieve text on the background image

Effect: <div class="imgs"> <!-...

React method of displaying data in pages

Table of contents Parent component listBox List c...

Springboot+VUE to realize login and registration

This article example shares the specific code of ...