了解CreateJs

时间:2015-10-22 20:30:18

标签: javascript createjs

我对理解某些代码有一些问题

(function (lib_p, img, cjs) {

var p; // shortcut to reference prototypes

// library properties:
lib_p.properties = {
  width: 364,
  height: 540,
  fps: 20,
  color: "#000000",
  manifest: [
    {src:"img/bot1_l.png", id:"bot1_l"}

  ]
};

// symbols

(lib_p.bot1_l = function() {
  this.initialize(img.bot1_l);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,116,344);

我在哪里可以读到这个?我知道这是createJS,但我不知道这是什么意思 - 特别是:

  1. (lib_p, img, cjs)

  2. (lib_p.bot1_l = function(){                   this.initialize(img.bot1_l);                 })。原型= p = new cjs.Bitmap();                 p.nominalBounds = new cjs.Rectangle(0,0,116,344);

1 个答案:

答案 0 :(得分:2)

  1. 这就是你define arguments for a function
  2. 的方式
  3. cjs.Rectangle p的实例,将其分配给变量p,创建一个函数,将prototype的值赋给bot1_l属性然后将新函数分配给任何对象lib_p所指向的public class RelativeResource extends AbstractResource { private final String relativePath; public RelativeResource(String relativePath) { this.relativePath = relativePath; } @Override public String getDescription() { return "RelativeResource [" + relativePath + "]"; } @Override public boolean isReadable() { File resourceFile = new File(getAbsoluteFileLocation()); return resourceFile.exists(); } @Override public boolean isOpen() { return true; } @Override public InputStream getInputStream() throws IOException { return new FileInputStream(getAbsoluteFileLocation()); } private String getAbsoluteFileLocation() { return Paths.get("").toAbsolutePath().resolve(relativePath).toString(); } } 属性。