CSS3 achieves conic-gradient effect

CSS3 achieves conic-gradient effect

grammar:

background-image: conic-gradient(from angle at position, start-color, ..., last-color )

First parameter:

from angle: starting angle, optional, default is from top to bottom

position: the position of the cone point

Second parameter:

start-color : defines the start color

stop-color : defines the end color

1. The first parameter

Likewise, the first parameter can be empty, the default angle is 0 degrees, and the cone center is the center point of the shape. For example:

background-image: conic-gradient(#69f, #fd44ff); 

We can change the starting angle, such as:

background-image: conic-gradient(from -90deg, #69f, #fd44ff); 

Change the cone center position:

background-image: conic-gradient(from -90deg at 80px 120px, #69f, #fd44ff) 

2. The second parameter

Like linear and radial gradients, you can set the color and the starting position of the gradient. The position parameters accepted are percentage and angle. For example:

background-image: conic-gradient(#69f 10%, #fd44ff 10%);

The above code is equivalent to:

background-image: conic-gradient(#69f 36deg, #fd44ff 36deg);

The display effect is as follows:

3. Repeat the cone gradient

Like linear and radial gradients, conic gradients also have the property of repeating.

background-image: repeating-conic-gradient(#69f 0 36deg, #fd44ff 36deg 72deg);

The effect is as shown below:

Does this rendering look a little familiar?

Let's set it to a circle and add a button, and it will become a lottery disc.

The effect is as follows:

Address: https://codepen.io/jianxiujiucan/pen/bGddbez

We can use cones to create a variety of loading effects:

Address: https://codepen.io/jianxiujiucan/pen/bGdGyKN

For the second loading, please study it yourself and write some exercises~

We can use gradients to create a variety of effects.

Summarize

The above is the editor's introduction to the conic-gradient effect achieved with CSS3. I hope it will be helpful to everyone!

<<:  How to Use rsync in Linux

>>:  Analysis of Facebook's Information Architecture

Recommend

Linux unlink function and how to delete files

1. unlink function For hard links, unlink is used...

Using MySQL database with Python 3.4 under Windows 7

The detailed process of using MySQL database with...

jQuery implements HTML element hiding and display

Let's imitate Taobao's function of displa...

Use Rem layout to achieve adaptive

I have written an article about mobile adaptation...

Detailed explanation of anonymous slots and named slots in Vue

Table of contents 1. Anonymous slots 2. Named slo...

WeChat applet realizes simple tab switching effect

This article shares the specific code for WeChat ...

Use the Linux seq command to generate a sequence of numbers (recommended)

The Linux seq command can generate lists of numbe...

Implementation of formatting partitions and mounting in Centos7

Linux often encounters situations such as adding ...

The "3I" Standards for Successful Print Advertising

For many domestic advertisers, the creation and ev...

MySQL view principles and basic operation examples

This article uses examples to illustrate the prin...

Explanation of the working mechanism of namenode and secondarynamenode in Hadoop

1) Process 2) FSImage and Edits Nodenode is the b...

Using MySQL in Windows: Implementing Automatic Scheduled Backups

1. Write a backup script rem auther:www.yumi-info...

MySQL 5.6 installation steps with pictures and text

MySQL is an open source small relational database...

An example of the calculation function calc in CSS in website layout

calc is a function in CSS that is used to calcula...

A brief analysis of the use of the HTML webpack plugin

Using the html-webpack-plugin plug-in to start th...