html5 canvas 绘制太极图
<div class="container"> <canvas id="myCanvas" width="400" height="400" ></canvas> </div>
* {
padding: 0;
margin: 0;
}
body {
background-color: #d5d3d4;
}
.container {
width: 500px;
height: 500px;
position: relative;
top: 80px;
left: 50%;
transform: translateX(-50%);
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 5px #c2bfbf;
}
#myCanvas{
border:1px solid #000;
position:relative;
top: 50px;
left: 50px;
transform:translate(-50%,-50%);
border-radius:50%;
animation: myfirst 30s linear infinite;
}
@keyframes myfirst
{
0% {transform:rotate(0deg);}
100% {transform:rotate(360deg);}
}
window.onload = function () {
var canvas=document.getElementById("myCanvas");
var ctx=canvas.getContext("2d");
ctx.beginPath();
ctx.arc(200, 100, 100, -0.5 * Math.PI, 0.5 * Math.PI, false);
ctx.arc(200, 300, 100, 1.5 * Math.PI, 0.5 * Math.PI, true);
ctx.arc(200, 200, 200, 0.5 * Math.PI, 1.5 * Math.PI, false);
ctx.closePath();
ctx.fillStyle = "black";
ctx.fill();
ctx.beginPath();
ctx.arc(200, 100, 25, 0 * Math.PI, 2 * Math.PI, false);
ctx.fillStyle = "white";
ctx.fill();
ctx.beginPath();
ctx.arc(200, 300, 25, 0 * Math.PI, 2 * Math.PI, false);
ctx.fillStyle = "black";
ctx.fill();
}
html5 canvas 绘制太极图的更多相关文章
- 学习笔记:HTML5 Canvas绘制简单图形
HTML5 Canvas绘制简单图形 1.添加Canvas标签,添加id供js操作. <canvas id="mycanvas" height="700" ...
- 使用 HTML5 Canvas 绘制出惊艳的水滴效果
HTML5 在不久前正式成为推荐标准,标志着全新的 Web 时代已经来临.在众多 HTML5 特性中,Canvas 元素用于在网页上绘制图形,该元素标签强大之处在于可以直接在 HTML 上进行图形操作 ...
- 使用html5 canvas绘制图片
注意:本文属于<html5 Canvas绘制图形入门详解>系列文章中的一部分.如果你是html5初学者,仅仅阅读本文,可能无法较深入的理解canvas,甚至无法顺畅地通读本文.请点击上述链 ...
- 使用html5 canvas绘制圆形或弧线
注意:本文属于<html5 Canvas绘制图形入门详解>系列文章中的一部分.如果你是html5初学者,仅仅阅读本文,可能无法较深入的理解canvas,甚至无法顺畅地通读本文.请点击上述链 ...
- html5 Canvas绘制图形入门详解
html5,这个应该就不需要多作介绍了,只要是开发人员应该都不会陌生.html5是「新兴」的网页技术标准,目前,除IE8及其以下版本的IE浏览器之外,几乎所有主流浏览器(FireFox.Chrome. ...
- 解决html5 canvas 绘制字体、图片与图形模糊问题
html5 canvas 绘制字体.图片与图形模糊问题 发生情况 多出现在高dpi设备,这意味着每平方英寸有更多的像素,如手机,平板电脑.当然很多高端台式电脑也有高分辨率高dpi的显示器. canva ...
- 使用html5 Canvas绘制线条(直线、折线等)
使用html5 Canvas绘制直线所需的CanvasRenderingContext2D对象的主要属性和方法(有"()"者为方法)如下: 属性或方法 基本描述 strokeSty ...
- html5 canvas绘制环形进度条,环形渐变色仪表图
html5 canvas绘制环形进度条,环形渐变色仪表图 在绘制圆环前,我们需要知道canvas arc() 方 ...
- 怎样用JavaScript和HTML5 Canvas绘制图表
原文:https://code.tutsplus.com/zh-...原作:John Negoita翻译:Stypstive 在这篇教程中,我将展示用JavaScript和canvas作为手段,在饼状 ...
随机推荐
- 利用BitMap进行大数据排序去重
1.问题 问题提出: M(如10亿)个int整数,只有其中N个数重复出现过,读取到内存中并将重复的整数删除. 2.解决方案 问题分析: 我们肯定会先想到在计算机内存中开辟M个int整型数据数组,来on ...
- Java学习笔记14---使用标志位控制循环
使用标志位控制循环 前面提到了控制循环的常用技术:计数器控制的循环.另一种控制循环的常用技术是在读取和处理一个集合的值时指派一个特殊值.这个特殊的输入值也成为标志值(sentinel value),用 ...
- React项目(一):markdown编辑器
在之前的React官网教程中,提到了用Remarkable为插件的markdown评论框.现在就来正儿八经地用另外一个插件marked.js做一个markdown编辑器吧! 准备工作 或许在做之前,应 ...
- CSS样式收集
1.改变浏览器滚动条样式(适合webkit内核,摘自www.webhek.com/scrollbar) ::-webkit-scrollbar{width:2px;} ::-webkit-scroll ...
- Solved: “Cannot execute a program. The command being executed was \roslyn\csc.exe”
When you publish your ASP.NET project to a hosting account such as GoDaddy, you may run into the iss ...
- Codeforces Round #353 (Div. 2) ABCDE 题解 python
Problems # Name A Infinite Sequence standard input/output 1 s, 256 MB x3509 B Restoring P ...
- PostgreSQL数据库中的常见错误
转载以作参考. 错误1 FATAL: connection limit exceeded for non-superusers 原因:非超级用户的连接数(max_connections - super ...
- python --> 正则表达式
在python中使用正则表达式,需要导入 re 模块 一. 元字符,包括 [] {} | ? * + . ^ $ \ () . 号:通配符,一个点号就代表一个字符,一般情况下不能通配换行符 \ ...
- C和指针 第十六章 标准函数库
字符串转换: long int strtol(char const *string, char **unused, int base); 将字符串转换为数值形式,遇到非法字符停止,如果stop不是NU ...
- Qt工程打包发布
Qt版本 5.7.1 1.添加环境变量 在..\Qt5.7.0\5.7\msvc2013_64\bin(..省略了盘符,例如我的是D:\Qt\Qt5.7.0\5.7\msvc2013_64\bin) ...