lufy's legend

标题: 如何在lufylegend中实现repeat效果 [打印本页]

作者: lufy    时间: 2016-12-6 14:00
标题: 如何在lufylegend中实现repeat效果
很简单,利用createPattern即可
代码
  1.    LInit(50, "legend", 480, 800, main);
  2.                         function main() {
  3.                                 var loader = new LLoader();
  4.                                 loader.addEventListener(LEvent.COMPLETE, loadBitmapdata);
  5.                                 loader.load("light/icon.png", "bitmapData");
  6.                         }

  7.                         function loadBitmapdata(event) {
  8.                                 var pat = LGlobal.canvas.createPattern(event.target, "repeat");
  9.                                 var shape = new LShape();
  10.                                 addChild(shape);
  11.                                 shape.graphics.drawRect(0, "#000000", [0, 0, 480, 800], true, pat);
  12.                         }
复制代码
测试
http://lufylegend.com/demo/test/151.html



作者: lixiansen1991yy    时间: 2016-12-6 14:06
请问,只能在 LGlobal.canvas.下吗
作者: lufy    时间: 2016-12-6 14:11
lixiansen1991yy 发表于 2016-12-6 14:06
请问,只能在 LGlobal.canvas.下吗

你能生成createPattern就行,用什么来调用有影响吗?




欢迎光临 lufy's legend (http://lufylegend.com/forum/) Powered by Discuz! X2.5