-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparams.json
More file actions
6 lines (6 loc) · 1.85 KB
/
Copy pathparams.json
File metadata and controls
6 lines (6 loc) · 1.85 KB
1
2
3
4
5
6
{
"name": "Yxmanyxman.GitHub.com",
"tagline": "canvas 粽子",
"body": "<!DOCTYPE html>\r\n<html >\r\n<head>\r\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\r\n <title></title>\r\n</head>\r\n\r\n<body>\r\n<canvas id=\"canvas\" width=\"500\" height=\"400\" style=\"border: 1px solid\"></canvas>\r\n<div id=\"ds\"></div>\r\n\r\n<script type=\"text/javascript\">\r\n var canvas = document.getElementById(\"canvas\");\r\n var ctx = canvas.getContext(\"2d\");\r\n var dir = 0;\r\n var height = 1000;\r\n var width = 1000;\r\n var exp = 1;//像素移动的位置\r\n function fff() {\r\n ctx.restore();\r\n ctx.clearRect(0,0,height,width);//清除上一次的痕迹\r\n //set the shadow\r\n ctx.shadowOffsetX=-3;\r\n ctx.shadowOffsetY=-3;\r\n ctx.shadowBlur=9;\r\n ctx.shadowColor=\"rgba(0,0,0,0.5)\";\r\n //draw the quadratic\r\n ctx.strokeStyle=\"gary\";\r\n ctx.beginPath();\r\n ctx.moveTo(200,100+dir);\r\n ctx.quadraticCurveTo(250,10 + dir,300,100 + dir);//1\r\n ctx.quadraticCurveTo(350,200 + dir,250,200 + dir);//2\r\n ctx.quadraticCurveTo(150,200 + dir,200,100 + dir);//3\r\n ctx.stroke();\r\n //ctx.globalCompositeOperation=\"destination-in\";\r\n ctx.save();\r\n ctx.clip();\r\n ctx.fillStyle=\"black\";\r\n ctx.fillRect(220, 150 + dir,60,50);\r\n// ctx.arc(190, dir, 20, 0, Math.PI * 2, 1);\r\n dir = dir + exp;\r\n if(dir==0||dir==height)\r\n {\r\n exp = exp *( -1);\r\n }\r\n }\r\n\r\n</script>\r\n<button onclick=\"cvs=setInterval(fff,70);\">开始</button>\r\n<button onclick=\"clearInterval(cvs);\" >停止</button>\r\n</body>\r\n</html>\r\n",
"note": "Don't delete this file! It's used internally to help with page regeneration."
}