国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

首頁(yè) web前端 html教學(xué) 利用html5制作一個(gè)時(shí)鐘動(dòng)畫_html/css_WEB-ITnose

利用html5制作一個(gè)時(shí)鐘動(dòng)畫_html/css_WEB-ITnose

Jun 24, 2016 am 11:59 AM
html5 使用 製作 動(dòng)畫 時(shí)鐘

1 <canvas id="clock" width="500" height="500" style="background-color: yellow"></canvas>

  1 var clock=document.getElementById("clock");  2     var cxt=clock.getContext("2d");  3 function drawNow(){  4     var now=new Date();  5     var hour=now.getHours();  6     var min=now.getMinutes();  7     var sec=now.getSeconds();  8     hour=hour>12?hour-12:hour;  9     hour=hour+min/60; 10     //表盤(藍(lán)色) 11     cxt.lineWidth=10; 12     cxt.strokeStyle="blue" 13     cxt.beginPath(); 14     cxt.arc(250,250,200,0,360,false); 15     cxt.closePath(); 16     cxt.stroke(); 17     //刻度 18     //時(shí)刻度 19     for(var i=0;i<12;i++){ 20         cxt.save(); 21         cxt.lineWidth=7; 22         cxt.strokeStyle="black"; 23         cxt.translate(250,250); 24         cxt.rotate(i*30*Math.PI/180);//旋轉(zhuǎn)角度  角度*Math.PI/180=弧度 25         cxt.beginPath(); 26         cxt.moveTo(0,-170); 27         cxt.lineTo(0,-190); 28         cxt.closePath(); 29         cxt.stroke(); 30         cxt.restore(); 31     } 32     //分刻度 33     for(var i=0;i<60;i++){ 34         cxt.save(); 35         //設(shè)置分刻度的粗細(xì) 36         cxt.lineWidth=5; 37         //重置畫布原點(diǎn) 38         cxt.translate(250,250); 39         //設(shè)置旋轉(zhuǎn)角度 40         cxt.rotate(i*6*Math.PI/180); 41         //畫分針刻度 42         cxt.strokeStyle="black"; 43         cxt.beginPath(); 44         cxt.moveTo(0,-180); 45         cxt.lineTo(0,-190); 46         cxt.closePath(); 47         cxt.stroke(); 48         cxt.restore(); 49     } 50  51     //時(shí)針 52     cxt.save(); 53     // 設(shè)置時(shí)針風(fēng)格 54     cxt.lineWidth=7; 55     cxt.strokeStyle="black"; 56     cxt.translate(250,250); 57     cxt.rotate(hour*30*Math.PI/180); 58     cxt.beginPath(); 59     cxt.moveTo(0,-140); 60     cxt.lineTo(0,10); 61     cxt.closePath(); 62     cxt.stroke(); 63     cxt.restore(); 64     //分針 65     cxt.save(); 66     cxt.lineWidth=5; 67     cxt.strokeStyle="black"; 68     //設(shè)置異次元空間分針畫布的中心 69     cxt.translate(250,250); 70     cxt.rotate(min*6*Math.PI/180); 71     cxt.beginPath(); 72     cxt.moveTo(0,-160); 73     cxt.lineTo(0,15); 74     cxt.closePath(); 75     cxt.stroke() 76     cxt.restore(); 77  78     //秒針 79     cxt.save(); 80     //設(shè)置秒針的風(fēng)格 81     //顏色:紅色 82     cxt.strokeStyle="red"; 83     cxt.lineWidth=3; 84     //重置原點(diǎn) 85     cxt.translate(250,250); 86     //設(shè)置角度 87     //cxt.rotate(330*Math.PI/180); 88     cxt.rotate(sec*6*Math.PI/180); 89  90     cxt.beginPath(); 91     cxt.moveTo(0,-170); 92     cxt.lineTo(0,20); 93     cxt.closePath(); 94     cxt.stroke(); 95     //畫出時(shí)針,分針,秒針的交叉點(diǎn) 96     cxt.beginPath(); 97     cxt.arc(0,0,5,0,360,false); 98     cxt.closePath(); 99     //設(shè)置填充100     cxt.fillStyle="gray";101     cxt.fill();102     //cxt.strokeStyle="red";103     cxt.stroke();104 105     //畫出秒針的小圓點(diǎn)106     cxt.beginPath();107     cxt.arc(0,-140,5,0,360,false);108     cxt.closePath();109     //設(shè)置填充110     cxt.fillStyle="gray";111     cxt.fill();112     //cxt.strokeStyle="red";113     cxt.stroke();114 115 116     cxt.restore();117 118 119 120 }121 function drawClock(){122     cxt.clearRect(0,0,500,500);123     drawNow();124 }125     drawNow();126     setInterval(drawClock,1000);

?

?

?

本網(wǎng)站聲明
本文內(nèi)容由網(wǎng)友自願(yuàn)投稿,版權(quán)歸原作者所有。本站不承擔(dān)相應(yīng)的法律責(zé)任。如發(fā)現(xiàn)涉嫌抄襲或侵權(quán)的內(nèi)容,請(qǐng)聯(lián)絡(luò)admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費(fèi)脫衣圖片

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅(qū)動(dòng)的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費(fèi)的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費(fèi)的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強(qiáng)大的PHP整合開(kāi)發(fā)環(huán)境

Dreamweaver CS6

Dreamweaver CS6

視覺(jué)化網(wǎng)頁(yè)開(kāi)發(fā)工具

SublimeText3 Mac版

SublimeText3 Mac版

神級(jí)程式碼編輯軟體(SublimeText3)

HTML5:標(biāo)準(zhǔn)及其對(duì)Web開(kāi)發(fā)的影響 HTML5:標(biāo)準(zhǔn)及其對(duì)Web開(kāi)發(fā)的影響 Apr 27, 2025 am 12:12 AM

HTML5的核心特性包括語(yǔ)義化標(biāo)籤、多媒體支持、離線存儲(chǔ)與本地存儲(chǔ)、表單增強(qiáng)。 1.語(yǔ)義化標(biāo)籤如、等,提升代碼可讀性和SEO效果。 2.和標(biāo)籤簡(jiǎn)化多媒體嵌入。 3.離線存儲(chǔ)和本地存儲(chǔ)如ApplicationCache和LocalStorage,支持無(wú)網(wǎng)絡(luò)運(yùn)行和數(shù)據(jù)存儲(chǔ)。 4.表單增強(qiáng)引入新輸入類型和驗(yàn)證屬性,簡(jiǎn)化處理和驗(yàn)證。

H5和HTML5之間的連接:相似性和差異 H5和HTML5之間的連接:相似性和差異 Apr 24, 2025 am 12:01 AM

H5和HTML5是不同的概念:HTML5是HTML的一個(gè)版本,包含新元素和API;H5是基於HTML5的移動(dòng)應(yīng)用開(kāi)發(fā)框架。 HTML5通過(guò)瀏覽器解析和渲染代碼,H5應(yīng)用則需要容器運(yùn)行並通過(guò)JavaScript與原生代碼交互。

理解H5:含義和意義 理解H5:含義和意義 May 11, 2025 am 12:19 AM

H5是HTML5,是HTML的第五個(gè)版本。 HTML5提升了網(wǎng)頁(yè)的表現(xiàn)力和交互性,引入了語(yǔ)義化標(biāo)籤、多媒體支持、離線存儲(chǔ)和Canvas繪圖等新特性,推動(dòng)了Web技術(shù)的發(fā)展。

H5:探索最新版本的HTML H5:探索最新版本的HTML May 03, 2025 am 12:14 AM

html5isamajorrevisionofthehtmlStandardThatRevolutionsWebDevelopmentBybyIntroDucingNewSemanticeLementSemelementsandAndCapabilities.1)itenhancesCodereAdabilityAndSeowitability andSeowithelientsLike,and.2)

HTML5:限制 HTML5:限制 May 09, 2025 pm 05:57 PM

HTML5hasseverallimitationsincludinglackofsupportforadvancedgraphics,basicformvalidation,cross-browsercompatibilityissues,performanceimpacts,andsecurityconcerns.1)Forcomplexgraphics,HTML5'scanvasisinsufficient,requiringlibrarieslikeWebGLorThree.js.2)I

HTML5的重要目標(biāo):增強(qiáng)網(wǎng)絡(luò)開(kāi)發(fā)和用戶體驗(yàn) HTML5的重要目標(biāo):增強(qiáng)網(wǎng)絡(luò)開(kāi)發(fā)和用戶體驗(yàn) May 14, 2025 am 12:18 AM

html5aimstoenhancewebdevelopmentanduserexperiencethroughsemantstructure,多媒體綜合和performanceimprovements.1)SemanticeLementLike like,和ImproVereAdiability and ImproVereAdabilityActibility.2)and tagsallowsemlessallowseamelesseamlessallowseamelesseamlesseamelesseamemelessmultimedimeDiaiaembediiaembedplugins.3)。 3)3)

什麼是微數(shù)據(jù)? HTML5解釋了 什麼是微數(shù)據(jù)? HTML5解釋了 Jun 10, 2025 am 12:09 AM

MicrodataenhancesSEOandcontentdisplayinsearchresultsbyembeddingstructureddataintoHTML.1)Useitemscope,itemtype,anditempropattributestoaddsemanticmeaning.2)ApplyMicrodatatokeycontentlikebooksorproductsforrichsnippets.3)BalanceusagetoavoidclutteringHTML

HTML5 microdata:最好的在線工具 HTML5 microdata:最好的在線工具 Jun 09, 2025 am 12:06 AM

thebestonlinetoolsforhtml5microdataaregooglestructuctureddatamarkuphelperandschema.org'smarkupvalidator.1)googlestructuctuctructuctureddatama RKUPHELPERISUSER友好型,GuidinguserstoAddmicrodatatagsforenhancedseo.2)schema.org'smarkupvalidatoratorChecksmicrodatiaimplementa

See all articles