婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > Canvas制作旋轉的太極的示例

Canvas制作旋轉的太極的示例

熱門標簽:江蘇智能電銷機器人哪家好 黃島區地圖標注 當涂高德地圖標注 鎮江智能外呼系統有效果嗎 電銷機器人電話用什么卡 四川點撥外呼系統 成都智能外呼系統平臺 南寧點撥外呼系統哪家公司做的好 云南大理400電話申請官方

前言

好久沒動canvas了,今下午突然想回顧一下,就寫了個旋轉的太極,哈哈,蠻好玩的,在這里就將自己寫的過程展示出來,旋轉使用的css實現的,沒有用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-big
ctx.beginPath();
ctx.fillStyle = "#000";
ctx.arc(250,250,200,Math.PI/2,Math.PI*1.5,false);
ctx.closePath();
ctx.fill();
// right-white-big
ctx.beginPath();
ctx.fillStyle = "#fff";
ctx.arc(250,250,200,Math.PI/2,Math.PI*1.5,true);
ctx.closePath();
ctx.fill();
// top-black-middle
ctx.beginPath();
ctx.fillStyle = "#000";
ctx.arc(250,150,100,Math.PI/2,Math.PI*1.5,true);
ctx.closePath();
ctx.fill();
// bottom-white-middle
ctx.beginPath();
ctx.fillStyle = "#fff";
ctx.arc(250,350,100,Math.PI/2,Math.PI*1.5,false);
ctx.closePath();
ctx.fill();
// top-white-small
ctx.beginPath();
ctx.fillStyle = "#fff";
ctx.arc(250,150,25,0,Math.PI*2);
ctx.closePath();
ctx.fill();
// bottom-black-small
ctx.beginPath();
ctx.fillStyle = "#000";
ctx.arc(250,350,25,0,Math.PI*2);
ctx.closePath();
ctx.fill();

效果

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

標簽:淮安 廣西 十堰 咸寧 南京 佳木斯 酒泉 西寧

巨人網絡通訊聲明:本文標題《Canvas制作旋轉的太極的示例》,本文關鍵詞  Canvas,制作,旋轉,的,太極,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《Canvas制作旋轉的太極的示例》相關的同類信息!
  • 本頁收集關于Canvas制作旋轉的太極的示例的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 化德县| 邢台市| 东乡族自治县| 新闻| 宜良县| 台中市| 宁陕县| 灵宝市| 石棉县| 兴海县| 西安市| 南充市| 科技| 和硕县| 泽库县| 遂宁市| 黎城县| 普洱| 无棣县| 临武县| 伊春市| 木兰县| 长武县| 遂平县| 龙口市| 玉山县| 开化县| 荣成市| 郴州市| 疏勒县| 尼玛县| 南江县| 湖南省| 桦甸市| 托克托县| 杂多县| 罗城| 浦城县| 辽中县| 得荣县| 五大连池市|