{"id":208,"date":"2017-04-24T17:55:19","date_gmt":"2017-04-24T09:55:19","guid":{"rendered":"http:\/\/blog.xrhoujie.com\/?p=208"},"modified":"2021-10-19T10:48:56","modified_gmt":"2021-10-19T02:48:56","slug":"create-js%e5%ae%b9%e5%99%a8%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"http:\/\/blog.xrhoujie.com\/?p=208","title":{"rendered":"Create.js\u5b9e\u6218-Container\u5bb9\u5668\u64cd\u4f5c"},"content":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u4eca\u5929\u7ed9\u5927\u5bb6\u5e26\u6765\u7684\u662fCreate.js\u5b9e\u6218-Container\u5bb9\u5668\u64cd\u4f5c\uff0c\u5b98\u7f51\u4f20\u9001\u5165\u53e3\uff1a<a href=\"http:\/\/www.createjs.cc\/src\/docs\/easeljs\/classes\/Container.html\">http:\/\/www.createjs.cc\/src\/docs\/easeljs\/classes\/Container.html<\/a><\/p>\n<p>\u5b98\u7f51\u8bf4\u6cd5\u662f\uff1a<\/p>\n<p>\u5bb9\u5668\u662f\u4e00\u4e2a\u5d4c\u5957\u663e\u793a\u5217\u8868\uff0c\u5141\u8bb8\u60a8\u4e0e\u5316\u5408\u7269\u663e\u793a\u5143\u7d20\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u5c06\u624b\u81c2\u3001\u817f\u90e8\u3001\u8eaf\u5e72\u548c\u5934\u90e8<a class=\"crosslink\" href=\"http:\/\/www.createjs.cc\/src\/docs\/easeljs\/classes\/Bitmap.html\">Bitmap<\/a> instances together into a Person Container, and \u5b9e\u4f8b\u805a\u5728\u4e00\u8d77\uff0c\u628a\u5b83\u4eec\u8f6c\u6362\u4e3a\u4e00\u7ec4\uff0c\u540c\u65f6\u8fd8\u53ef\u4ee5\u5c06\u5404\u4e2a\u90e8\u5206\u76f8\u5bf9\u5f7c\u6b64\u79fb\u52a8\u3002\u96c6\u88c5\u7bb1\u7684\u513f\u7ae5\u6709\u4ed6\u4eec\u7684 <code>transform<\/code> \u548c <code>alpha<\/code>\u4e0e\u5b83\u4eec\u7684\u7236\u5bb9\u5668\u8fde\u63a5\u7684\u5c5e\u6027\u3002 Container.<\/p>\n<p>\u4f8b\u5982\uff0c\u4e00\u4e2a<a class=\"crosslink\" href=\"http:\/\/www.createjs.cc\/src\/docs\/easeljs\/classes\/Shape.html\">\u5f62\u72b6(Shape)<\/a> \u4e0e\u00d7= 100\u548c\u03b1= 0.5\uff0c\u653e\u7f6e\u5728\u4e00\u4e2a\u5bb9\u5668\u4e2d\uff0c\u4e0e\u00d7= 50\u548c\u03b1= 0.7\u5c06\u5448\u73b0\u7ed9\u753b\u5e03\u5728\u00d7= 150\u548c\u03b1= 0.35\u3002\u5bb9\u5668\u6709\u4e00\u4e9b\u5f00\u9500\uff0c\u6240\u4ee5\u4f60\u901a\u5e38\u4e0d\u5e94\u8be5\u521b\u5efa\u4e00\u4e2a\u5bb9\u5668\u6765\u5bb9\u7eb3\u4e00\u4e2a\u5b69\u5b50\u3002<\/p>\n<div id=\"yui_3_10_1_3_1493027809974_650\" class=\"box intro\">\n<h4 id=\"yui_3_10_1_3_1493027809974_652\">\u5b9e\u4f8b<\/h4>\n<pre class=\"code prettyprint prettyprinted\"><code> <span class=\"kwd\">var<\/span><span class=\"pln\"> container <\/span><span class=\"pun\">=<\/span> <span class=\"kwd\">new<\/span><span class=\"pln\"> createjs<\/span><span class=\"pun\">.<\/span><span class=\"typ\">Container<\/span><span class=\"pun\">();<\/span><span class=\"pln\">\r\n container<\/span><span class=\"pun\">.<\/span><span class=\"pln\">addChild<\/span><span class=\"pun\">(<\/span><span class=\"pln\">bitmapInstance<\/span><span class=\"pun\">,<\/span><span class=\"pln\"> shapeInstance<\/span><span class=\"pun\">);<\/span><span class=\"pln\">\r\n container<\/span><span class=\"pun\">.<\/span><span class=\"pln\">x <\/span><span class=\"pun\">=<\/span> <span class=\"lit\">100<\/span><span class=\"pun\">; \r\n<\/span><\/code><\/pre>\n<p>\u521a\u521a\u8bf4\u5b98\u7f51\u7684\u8bf4\u6cd5\uff0c\u63a5\u4e0b\u6765\u6211\u5f00\u59cb\u628a\u81ea\u5df1\u7684\u4ee3\u7801\u641e\u4e0a\u6765\uff0c<\/p>\n<pre class=\"code prettyprint prettyprinted\"><code>var gameView = new createjs.Container();\r\n\/\/\u5bb9\u5668\r\n          gameView.width = stage.width;\r\n          gameView.height = stage.height;\r\n\/\/\u5bb9\u5668\u4e0e\u821e\u53f0\u7b49\u5bbd\u7b49\u9ad8\r\n          stage.addChild(gameView);<\/code><\/pre>\n<p>\u6210\u529f\u7684\u628a\u5bb9\u5668\u6dfb\u52a0\u5230\u4e86\u821e\u53f0\u4e0a\uff0c\u5e76\u4e14\u8ddf\u821e\u53f0\u7b49\u5bbd\u7b49\u9ad8\uff0c\u5bb9\u5668\u8fd9\u4e2a\u4e1c\u897f\u53ef\u4ee5\u7406\u89e3\u4e3a\u5b58\u50a8\u56fe\u7247\uff0c\u5bf9\u8c61\uff0c\u6570\u7ec4\uff0c\u653e\u7f6e\u7684\u7bb1\u5b50\u7b49\u7b49\u3002<\/p>\n<p>\u4eca\u5929\u53c8\u662f\u4ee3\u7801\u6ee1\u6ee1\u7684\u4e00\u5929\uff0c\u5404\u4f4d\u8001\u54e5\u6211\u4eec\u4e0b\u671f\u518d\u89c1<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u4eca\u5929\u7ed9\u5927\u5bb6\u5e26\u6765\u7684\u662fCreate.js\u5b9e\u6218-Container\u5bb9\u5668\u64cd\u4f5c\uff0c\u5b98\u7f51\u4f20\u9001\u5165\u53e3\uff1ahttp:\/\/ww [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":179,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[27],"_links":{"self":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/208"}],"collection":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208"}],"version-history":[{"count":3,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/208\/revisions"}],"predecessor-version":[{"id":831,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/208\/revisions\/831"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/media\/179"}],"wp:attachment":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}