{"id":1012,"date":"2016-12-13T14:51:13","date_gmt":"2016-12-13T06:51:13","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=1012"},"modified":"2016-12-13T14:51:13","modified_gmt":"2016-12-13T06:51:13","slug":"%e4%bd%bf%e7%94%a8%e8%85%be%e8%ae%af-alloyteam-js-%e6%8f%92%e4%bb%b6%e6%89%93%e9%80%a0%e6%b3%a2%e6%b5%aa%e5%8a%a0%e8%bd%bd%e8%bf%9b%e5%ba%a6%e6%9d%a1","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=1012","title":{"rendered":"\u4f7f\u7528\u817e\u8baf AlloyTeam.js \u63d2\u4ef6\u6253\u9020\u6ce2\u6d6a\u52a0\u8f7d\u8fdb\u5ea6\u6761"},"content":{"rendered":"<p>\n\t\u6700\u8fd1\u4f7f\u7528&nbsp;\u817e\u8baf\u7684AlloyTeam\u79fb\u52a8Web\u89e6\u6478\u89e3\u51b3\u65b9\u6848\u5b9e\u73b0\u4e86\u4e00\u6b3e\u57fa\u4e8e HTML5 Canvas\u7684\u52a0\u8f7d\u8fdb\u5ea6\u6761\u6848\u4f8b\uff0c\u8fd9\u91cc\u5206\u4eab\u7ed9\u5927\u5bb6\uff0c\u5e0c\u671b\u80fd\u5bf9\u5404\u4f4d\u5728\u5f00\u53d1\u548c\u5b66\u4e60\u8fc7\u7a0b\u4e2d\u6709\u6240\u5e2e\u52a9\u3002\n<\/p>\n<p>\n\t\u6700\u8fd1 <a href=\"https:\/\/github.com\/AlloyTeam\/AlloyTouch\" target=\"_blank\">AlloyTouch<\/a> \u5199\u4e86\u4e00\u4e2a\u4e0b\u62c9\u5237\u65b0\u7684\u9177\u70ab loading \u6548\u679c\u3002\u6240\u4ee5\u9996\u9009\u5927\u6ce2\u6d6a\u8fdb\u5ea6\u56fe\u3002<br \/>\n\t\u9996\u5148\u8981\u5c01\u88c5\u4e00\u4e0b\u5927\u6ce2\u6d6a\u56fe\u7247\u8fdb\u5ea6\u7ec4\u4ef6\u3002\u57fa\u672c\u7684\u539f\u7406\u662f\u5229\u7528 Canvas \u7ed8\u5236\u77e2\u91cf\u56fe\u548c\u56fe\u7247\u7d20\u6750\u5408\u6210\u51fa\u6ce2\u6d6a\u7279\u6548\u3002<br \/>\n\t\u76f8\u5173\u4ee3\u7801\u53ef\u4ee5\u5728\u8fd9\u91cc <a href=\"https:\/\/github.com\/AlloyTeam\/AlloyTouch\/blob\/master\/refresh\/wave\/image_wave.html\" target=\"_blank\">https:\/\/github.com\/AlloyTeam\/AlloyTouch\/blob\/master\/refresh\/wave\/image_wave.html<\/a> \u4e0b\u8f7d\n<\/p>\n<h2>\n\t\u8fd0\u884c\u6548\u679c<br \/>\n<\/h2>\n<p>\n\t<img decoding=\"async\" alt=\"HTML5 Canvas \u52a0\u8f7d\u8fdb\u5ea6\u6761\" src=\"http:\/\/ocuzluml6.bkt.clouddn.com\/105416-20161213115104620-1393781477.gif\" style=\"width: 144px;height: 157px\" \/>\n<\/p>\n<h2>\n\tquadraticCurveTo<br \/>\n<\/h2>\n<p>\n\tquadraticCurveTo() \u65b9\u6cd5\u901a\u8fc7\u4f7f\u7528\u8868\u793a\u4e8c\u6b21\u8d1d\u585e\u5c14\u66f2\u7ebf\u7684\u6307\u5b9a\u63a7\u5236\u70b9\uff0c\u5411\u5f53\u524d\u8def\u5f84\u6dfb\u52a0\u4e00\u4e2a\u70b9\u3002<br \/>\n\tJavaScript \u8bed\u6cd5\uff1a\n<\/p>\n<pre class=\"brush:jscript;\">\r\ncontext.quadraticCurveTo(cpx,cpy,x,y);<\/pre>\n<p>\n\t<strong>\u53c2\u6570\u503c<\/strong>\n<\/p>\n<ul>\n<li>\n\t\tcpx \u8d1d\u585e\u5c14\u63a7\u5236\u70b9\u7684 x \u5750\u6807\n\t<\/li>\n<li>\n\t\tcpy \u8d1d\u585e\u5c14\u63a7\u5236\u70b9\u7684 y \u5750\u6807\n\t<\/li>\n<li>\n\t\tx \u7ed3\u675f\u70b9\u7684 x \u5750\u6807\n\t<\/li>\n<li>\n\t\ty \u7ed3\u675f\u70b9\u7684 y \u5750\u6807\n\t<\/li>\n<\/ul>\n<pre class=\"brush:jscript;\">\r\nctx.moveTo(20,20);\r\nctx.quadraticCurveTo(20,100,200,20);\r\nctx.stroke();<\/pre>\n<p>\n\t\u901a\u8fc7\u4e0a\u9762\u4ee3\u7801\u53ef\u4ee5\u7ed8\u5236\u4e00\u6761\u4e8c\u6b21\u8d1d\u585e\u5c14\u66f2\u7ebf\uff0c\u5177\u4f53\u539f\u7406\u6548\u679c\u770b\u4e0b\u56fe\uff1a\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"Canvas \u7528\u6cd5\" src=\"http:\/\/ocuzluml6.bkt.clouddn.com\/105416-20161213115120636-1871822499.gif\" style=\"width: 258px;height: 140px\" \/>\n<\/p>\n<h2>\n\t\u6574\u4f53\u5b9e\u73b0<br \/>\n<\/h2>\n<pre class=\"brush:jscript;\">\r\nvar img = new Image();\r\nfunction tick() {\r\n    ...\r\n    ...\r\n    ctx.fill();\r\n    ctx.globalCompositeOperation = &quot;destination-atop&quot;;\r\n    ctx.drawImage(img, 0, 0);\r\n    requestAnimationFrame(tick);\r\n}\r\n\r\nimg.onload = function () {\r\n    tick();\r\n};\r\n\r\nimg.src = &quot;asset\/alloy.png&quot;;<\/pre>\n<p>\n\t\u4e3a\u4e86\u4ee3\u7801\u7b80\u5355\u76f4\u63a5\uff0c\u8fd9\u91cc\u514d\u53bb\u4e86\u5c01\u88c5\u4e00\u4e2a\u52a0\u8f7d\u5668\u7684\u4ee3\u7801\uff0c\u76f4\u63a5\u901a\u8fc7new Image\u6765\u8bbe\u7f6esrc\u6765\u52a0\u8f7d\u56fe\u7247\u3002<br \/>\n\t\u5728\u7ed8\u5236\u5b8c\u77e2\u91cf\u56fe\u4e4b\u540e\uff0c\u8bbe\u7f6eglobalCompositeOperation\uff0c\u7136\u540e\u518d\u7ed8\u5236\u4f01\u9e45\u56fe\u7247\uff0c\u7ed8\u5236\u987a\u5e8f\u4e0d\u80fd\u641e\u9519\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=1012\">\u4f7f\u7528\u817e\u8baf AlloyTeam.js \u63d2\u4ef6\u6253\u9020\u6ce2\u6d6a\u52a0\u8f7d\u8fdb\u5ea6\u6761<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u4f7f\u7528&nbsp;\u817e\u8baf\u7684AlloyTeam\u79fb\u52a8Web\u89e6\u6478\u89e3\u51b3\u65b9\u6848\u5b9e\u73b0\u4e86\u4e00\u6b3e\u57fa\u4e8e HTML5 Canvas\u7684\u52a0 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[721,31,119,720],"class_list":["post-1012","post","type-post","status-publish","format-standard","hentry","category-html5","tag-alloytouch","tag-canvas","tag-html5","tag-720"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1012"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1012\/revisions"}],"predecessor-version":[{"id":1013,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1012\/revisions\/1013"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}