<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body onload="star()">
<canvas id="canvas" width="800" height="500" style="border: 1px #ccc solid;"></canvas> </body>
</html>
<script>
function star(){
var canvas=document.getElementById("canvas");
var cxt=canvas.getContext("2d");
cxt.translate(100,100);
var s=50;
cxt.beginPath();
cxt.fillStyle="blue";
var x=Math.sin(0);
var y=Math.cos(0);
var dig=Math.PI/5*4;
for(var i=0;i<5;i++){
var x=Math.sin(i*dig);
var y=Math.cos(i*dig);
cxt.lineTo(x*s,y*s);
}
cxt.closePath();
cxt.fill();
}
</script>


canvas 绘制五角星的更多相关文章

  1. canvas绘制五角星详细过程

    canvas绘制 <canvas id="straight"></canvas> <script> var canvas = document. ...

  2. HTML5 Canvas 绘制五角星

    代码: <!DOCTYPE html> <html lang="utf-8"> <meta http-equiv="Content-Type ...

  3. Canvas绘制五角星

    from tkinter import * import math as m root = Tk() w = Canvas(root, width=200, height=100, backgroun ...

  4. html5 canvas绘制圆形印章,以及与页面交互

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  5. HTML5 canvas 绘制五星红旗

    这个例子并不是自己写的,在网上找的案列,仿照写的,,,自己真的公布董这些算法,看完这个例子还是有一点模糊,,, 如果谁看的比较明白,指点一下,,,多谢!!!! <!doctype html> ...

  6. HTML5 给图形绘制阴影(绘制五角星示例)

    几个属性 shadowOffsetX:阴影的横向位移量. shadowOffsetY:阴影的纵向位移量. shadowColor:阴影的颜色. shadowBlur:阴影的模糊范围. 属性说明 sha ...

  7. HTML5 Canvas ( 绘制一片星空 )

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  8. canvas画画板,canvas画五角星,canvas制作钟表、Konva写钟表

    制作一个画画板,有清屏有橡皮擦有画笔可以换颜色 style样式 <head> <meta charset="UTF-8"> <title>画画板 ...

  9. HTML5用canvas绘制五星红旗

    在HTML5一览中,我们提到html 5被冠以很多高帽,其中最高的一顶.备受争议的就是"Flash杀手".IT评论界老喜欢用这个词了,杀手无处不在.不管是不是杀手,HTML 5引进 ...

随机推荐

  1. trangleProble switch方法 java

    public class trangleProblem { static int res=1; int codePart=1; int n=100; Stack<Param> stack= ...

  2. toj4119HDFS

    In HDFS( Hadoop Distributed File System), each data may have a lot of copies in case of data lose. T ...

  3. HDU 1070 - Milk

    给每种牛奶价格和量 要求买最便宜的牛奶 #include <iostream> using namespace std; int t,n; ][]; ],v[]; int main() { ...

  4. HDU 1056 - HangOver

    递推 #include <iostream> using namespace std; ]; double c; int main() { f[]=; ;i<=;i++) f[i]= ...

  5. ado.net实现一个通知公告功能

    一.建立相应的数据库,此处就不多说了,相信大家都非常了解

  6. Listview注意事项

    1.缓存 @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder ho ...

  7. Nginx 教程的连载计划

    下面以教程系列为单位,列举出了已经发表和计划发表的连载教程: Nginx 新手起步 Nginx 是如何匹配 URI 的 Nginx 变量漫谈 Nginx 配置指令的执行顺序 Nginx 的 if 是邪 ...

  8. VMware双网卡实现虚拟机连开发板和Internet

    前面已经介绍过关于VMware产生的虚拟交换机和虚拟网卡,当宿主机拥有两个网卡时,可以让虚拟系统同时实现上网和连接开发板的功能. 首先,在设置中虚拟出两块虚拟机网卡,一块连接VMnet0交换机一块连接 ...

  9. UVA 12902 Reverse Polish Notation

    //跟wyr学的//其实是贪心//题解稍后补上 #include<cstdio> #include<iostream> #include<cmath> #inclu ...

  10. 解决GitHub未配置SSH key提示错误信息

    git push -u origin master Permission denied (publickey). fatal: Could not read from remote repositor ...