Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use css3 to draw a circular dynamic clock

Shulou Source: shulou.com Published: 2022-06-01 12:33:49 11月14日 Update

This article is about how to use css3 to draw a circular dynamic clock. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Use css3 to draw the code of a circular dynamic clock

Clock and watch

# wrap {width:200px;height:200px;border:2pxsolid#000;margin:100pxauto;border-radius:50%;position:relative;}

# wrapul {margin:0;padding:0;height:200px;position:relative;list-style:none;}

# wrapulli {width:2px;height:6px;background:#000;position:absolute;left:99px;top:0;-webkit-transform-origin:center100px;}

/ * # wrapulli:nth-of-type (1) {- webkit-transform:rotate (0);}

# wrapulli:nth-of-type (2) {- webkit-transform:rotate (6deg);}

# wrapulli:nth-of-type (3) {- webkit-transform:rotate (12deg);}

# wrapulli:nth-of-type (4) {- webkit-transform:rotate (18deg);}

# wrapulli:nth-of-type (5) {- webkit-transform:rotate (24deg);}

# wrapulli:nth-of-type (6) {- webkit-transform:rotate (30deg);}

# wrapulli:nth-of-type (7) {- webkit-transform:rotate (36deg);}

# wrapulli:nth-of-type (8) {- webkit-transform:rotate (42deg);} * /

# wrapulli:nth-of-type (5n+1) {height:12px;}

# hour {width:6px;height:45px;background:#000;position:absolute;left:97px;top:55px;-webkit-transform-origin:bottom;}

# min {width:4px;height:65px;background:#999;position:absolute;left:98px;top:35px;-webkit-transform-origin:bottom;}

# sec {width:2px;height:80px;background:red;position:absolute;left:99px;top:20px;-webkit-transform-origin:bottom;}

.icon {width:20px;height:20px;background:#000;border-radius:50%;position:absolute;left:90px;top:90px;}

VaroList=document.getElementById ("list"); / / get the scale

VaroCss=document.getElementById ("css")

VaroHour=document.getElementById ("hour"); / / get the hour hand

VaroMin=document.getElementById ("min"); / / get the minute hand

VaroSec=document.getElementById ("sec"); / / get the second hand

VaroLi= ""

VarsCss= ""

For (vari=0;i

Tags: Dial dynamic circular clock scale hour angle content hour hand more second hand article good practical code minute hand article time look knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Apple OPPO Reno Linux MySQL