国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > HTML > 正文

Canvas制作旋轉(zhuǎn)的太極的示例

2024-08-26 00:20:31
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

前言

好久沒(méi)動(dòng)canvas了,今下午突然想回顧一下,就寫(xiě)了個(gè)旋轉(zhuǎn)的太極,哈哈,蠻好玩的,在這里就將自己寫(xiě)的過(guò)程展示出來(lái),旋轉(zhuǎn)使用的css實(shí)現(xiàn)的,沒(méi)有用canvas自己的,希望大佬們不要吐槽。

css

body{    background: #ddd;}#canvas{    position: absolute;    left: 40%;    top: 30%;    -webkit-transform: translate(-50%,-50%);    -moz-transform: translate(-50%,-50%);    -ms-transform: translate(-50%,-50%);    -o-transform: translate(-50%,-50%);    transform: translate(-50%,-50%);    -webkit-animation: testAnimate 3s linear infinite;    -o-animation: testAnimate 3s linear infinite;    animation: testAnimate 3s linear infinite;}@keyframes testAnimate {    from {        -webkit-transform: rotate(0);        -moz-transform: rotate(0);        -ms-transform: rotate(0);        -o-transform: rotate(0);        transform: rotate(0);    }    to {        -webkit-transform: rotate(360deg);        -moz-transform: rotate(360deg);        -ms-transform: rotate(360deg);        -o-transform: rotate(360deg);        transform: rotate(360deg);    }}

html

<body>    <canvas id="canvas" width="500" height="500"></canvas></body>

js

let ctx = document    .getElementById("canvas")    .getContext("2d");// left-black-bigctx.beginPath();ctx.fillStyle = "#000";ctx.arc(250,250,200,Math.PI/2,Math.PI*1.5,false);ctx.closePath();ctx.fill();// right-white-bigctx.beginPath();ctx.fillStyle = "#fff";ctx.arc(250,250,200,Math.PI/2,Math.PI*1.5,true);ctx.closePath();ctx.fill();// top-black-middlectx.beginPath();ctx.fillStyle = "#000";ctx.arc(250,150,100,Math.PI/2,Math.PI*1.5,true);ctx.closePath();ctx.fill();// bottom-white-middlectx.beginPath();ctx.fillStyle = "#fff";ctx.arc(250,350,100,Math.PI/2,Math.PI*1.5,false);ctx.closePath();ctx.fill();// top-white-smallctx.beginPath();ctx.fillStyle = "#fff";ctx.arc(250,150,25,0,Math.PI*2);ctx.closePath();ctx.fill();// bottom-black-smallctx.beginPath();ctx.fillStyle = "#000";ctx.arc(250,350,25,0,Math.PI*2);ctx.closePath();ctx.fill();

效果

旋轉(zhuǎn),太極圖,Canvas,旋轉(zhuǎn)太極

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持VeVb武林網(wǎng)。

 

注:相關(guān)教程知識(shí)閱讀請(qǐng)移步到HTML教程頻道。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 祥云县| 东海县| 景泰县| 温州市| 武定县| 长春市| 马公市| 汉川市| 巴中市| 旅游| 富平县| 星子县| 灌云县| 长阳| 苍溪县| 英山县| 宁晋县| 红河县| 宁安市| 改则县| 凤凰县| 册亨县| 永泰县| 鹤山市| 贵州省| 保德县| 宝丰县| 平昌县| 资中县| 红安县| 安庆市| 福建省| 定边县| 开江县| 宿州市| 英超| 鹿泉市| 徐闻县| 彭泽县| 青田县| 香港 |