SVG starts to achieve colorful circular countdown

This article shared everyone about SVG to start realize the method of achieving colorful circular countdown. Xiaobian feels quite practical, so share it with you to do a reference. Let’s take a look at Xiaobian.

The ring countdown, we often see, there are many ways to implement. However, this article will introduce a new implementation, using SVG to implement countdown function.

SVG countdown case

Talk below to talk about implementation code. The CSS implementation code is as follows:

SVG {Transform: rotate (-0.05deg);} circle {transition: stroke-dasharray .2s;}. Time-count-x {line-height : 1.5; Position: relative;}. Time-second {position: absolute; top: 50%; Left: 0; Right: 0; margin-top: -.75em; text-align: center; font-size: 100px; }

The associated HTML code is as follows:

finally related JavaScript code : Var electrircles = document.QuerySelectoral ("# timecountx circle"); var EletimeSec = document.getlementByid ("timesecond"); var perimeter = math.pi * 2 * 170; Var circleinit = function () {if (electrircles [1]) {electributers ("stroke-dasharray", "1069 1069")} if (electrircles [2]) {electrircles [2] .SetaTRibute (" Stroke-dasharray ", Perimeter / 2 +" 1069 ")} Eletimesec.innerhtml ="}; var timetimecount = null; var fntimecount = function (b) {if (timertimecount) {return} var b = B || 10; VAR a = function () {var C = B / 10; IF (electrircles [1]) {Elecircles [1] .SetaTAttribute ("StrOke-dasharray ", Perimeter * C +" 1069 ")} f (electrircles [2] && b Thank you for reading! About SVG to start a colorful circular countdown method to share Here, I hope that the above can have some help to everyone, let everyone learn more. If the article is good, you can share it out to let more people see it!
© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment