Source:
| The code is as follows |
Copy Code |
<!doctype html> <title> to endure the darts rotation | Bin Fruit Blog </title> <style> Body{overflow:hidden;background: #666;} canvas{position:absolute;top:0;left:0;} </style> <body></body> <script type= "Text/javascript" > function g () { var B = this; B.D = function (a) { B.create (); B.A = A.A; B.E () }; B.E = function () { function A () { function e () { if (F < Math.PI * 8) { f + + 0.1; C.A + = d * 0.1; C.b.clearrect (0, 0, 400, 400); C.C (); C.timeout = settimeout (E, 10) } else { d =-D; C.timeout = settimeout (A, 10) } } var f = 0; E () } var d = 1, c = b; A () }; B.C = function () { var a = b.b; A.save (); A.translate (200, 200); A.rotate (B.A); if (B.A = = 0) B.A = 0.0010; A.scale (B.A/10, B.A/10); A.strokestyle = "#333"; A.fillstyle = "#eee"; A.linewidth = 1; A.beginpath (); A.moveto (20,-20); A.lineto (80, 0); A.lineto (20, 20); A.lineto (0, 80); A.lineto (-20, 20); A.lineto (-80, 0); A.lineto (-20,-20); A.lineto (0,-80); A.lineto (20,-20); A.translate (0, 0); A.arc (0, 0, 8, 0, Math.PI * 2, true); A.stroke (); A.fill (); A.restore () }; B.create = function () { var a = document.createelement ("Canvas"); A.width = 400; A.height = 400; b.b = A.getcontext ("2d"); Document.body.appendChild (a) } } Window.onload = function () { for (var b = 0; b < b++) (new G). D ({ A:B * 0.1 }) }; </script> |
The darts are made up of straight lines and background fills, and the edges are transparent and well handled.