Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw clock Animation by html5

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article editor for you detailed introduction of "html5 how to draw clock animation", the content is detailed, the steps are clear, the details are handled properly, I hope this "html5 how to draw clock animation" article can help you solve doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.

Copy the code

The code is as follows:

Var clock=document.getElementById ("clock")

Var cxt=clock.getContext ("2d")

Function drawNow () {

Var now=new Date ()

Var hour=now.getHours ()

Var min=now.getMinutes ()

Var sec=now.getSeconds ()

Hour=hour > 12?hour-12:hour

Hour=hour+min/60

/ / dial (blue)

Cxt.lineWidth=10

Cxt.strokeStyle= "blue"

Cxt.beginPath ()

Cxt.arc (250, 250, 250, 200, 0, 360, 360, false)

Cxt.closePath ()

Cxt.stroke ()

/ / scale

/ / time degree

For (var iTuno Bandi)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report