魔方图形代码
来源:互联网 发布:mac usb设备已停用 编辑:程序博客网 时间:2024/05/16 00:56
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title></title></head><body><div id="canvas-warp"> <canvas id="canvas"style="border:1px solid #aaaaaa;display: block;margin: 50px auto;"> </canvas></div><script> window.onload=function(){ var canvas=document.getElementById("canvas"); canvas.width=800; canvas.height=600; var context=canvas.getContext("2d"); context.beginPath(); context.rect(0,0,800,600); context.fillStyle="#AA9033"; context.fill(); context.beginPath(); for(var i=0; i<=20; i++){ drawWhiteRect(context, 200 + 10 * i, 100 + 10 * i, 400 - 20 * i, 400 - 20 * i); drawBlackRect(context, 205 + 10 * i, 105 + 10 * i, 390 - 20 * i, 390 - 20 * i); } context.beginPath(); context.rect(395,295,5,5); context.fillStyle="black"; context.lineWidth=5; context.fill(); context.stroke(); } function drawBlackRect(cxt,x,y,width,height){ cxt.beginPath(); cxt.rect(x,y,width,height); cxt.lineWidth=5; cxt.strokeStyle="black"; cxt.stroke(); } function drawWhiteRect(cxt,x,y,width,height){ cxt.beginPath(); cxt.rect(x,y,width,height); cxt.lineWidth=5; cxt.strokeStyle="white"; cxt.stroke(); }</script></body></html></body></html>
0 0
- 魔方图形代码
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- 魔方
- Collections的一些方法(replaceAll---替换指定元素--fill---替换所有元素--reverse---实现反转)
- Android四大基本组件详解
- struts2 文件的上传与下载
- oracle字符集笔记
- 顺序队的基本操作(C 完整源代码)
- 魔方图形代码
- 代码创建约束01
- Java基础——运算符
- iOS-置顶按钮相关
- JSON及JSON-LIB
- 单例模式 解析——浅显易懂
- 关于splash页面 白屏问题
- css background属性的使用方法
- Java中的算术运算符