• 首页
  • 动态
  • 案例
  • 引擎社区
  • API
  • 文档
  • 示例
  • 引擎下载

大约有 54 项符合查询结果, 库内数据总量为 31,560 项。 (搜索耗时: 0.0043 秒)

1. HTML文本 · LayaAir3.0文档 · LAYABOX [ 100%]

...yaBox</span><span>欢迎你的加入</span>"; Laya.stage.addChild(div); 运行效果: 3.2 同一个文本中设置字体、颜色同 示例如下: var htmlD:HTMLDivElement = new HTMLDivElement(); Laya.stage.addChild(htmlD); htmlD.innerHTML = "<font style='fontSize:30' col...

来源: Laya3.0_文档 发布时间: 20230303

2. 3D基础显示对象 · LayaAir3.3 · 引擎文档 · LAYABOX [ 98%]

...l(); boxRender.sharedMaterial = boxMaterial; // 添加到场景 this.scene.addChild(box); // 设置位置 box.transform.position = new Laya.Vector3(2.0, 0.25, 0.6); box.transform.rotate(new Laya.Vector3(0, 45, 0), false, false); /* 球体 */ let sphere = new Laya.Sprite3D; let sphereMesh = sphere.ad...

来源: Laya3.0_文档 发布时间: 20251010

3. 列表组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 98%]

...参考滚动支持 一、 管理列表内容 运行时,可以直接通过addChild/removeChild等API修改列表的孩子。但在实际应用中,列表的内容通常被频繁的更新。典型的用法就是当接收到后台数据时,将列表清空,然后再重新添加所有项目。如...

来源: Laya3.0_文档 发布时间: 20251128

4. 精灵 · LayaAir3.3 · 引擎文档 · LAYABOX [ 97%]

...ke(): void { let sprite = new Laya.Sprite(); // 添加到舞台 Laya.stage.addChild(sprite); } 3.2 显示图片 图片的显示是游戏开发的基础,Sprite类中用于显示图片是 Sprite.loadImage 和 Sprite.texture。 3.2.1 loadImage /** * <p>加载并显示一个图片。相当于加...

来源: Laya3.0_文档 发布时间: 20251010

5. 2D性能优化 · LayaAir3.3 · 引擎文档 · LAYABOX [ 97%]

...CC"; this.text.x=Math.random()*550; this.text.y=Math.random()*400; textBox.addChild(this.text); } Laya.stage.addChild(textBox); } } 下面是笔者电脑上的运行时截图,FPS稳定于52上下。 (图2-1) 当我们对文字所在的容器设置为cacheAs之后,如下面的例子所示,...

来源: Laya3.0_文档 发布时间: 20251010

6. 位图切片组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 91%]

...bg.width >> 1, Laya.stage.height - bg.height >> 1); this.owner.addChild(bg); } private createTimerAnimation(): void { this.counter = new Laya.Clip(this.clipSkin, 10, 1); this.counter.autoPlay = true; this.counter.interval = 1000; this.counter.x = (Laya.stage.width - this.counter.width) /...

来源: Laya3.0_文档 发布时间: 20251010

7. 绘制能力 · LayaAir3.3 · 引擎文档 · LAYABOX [ 90%]

...hics.drawRect(20, 20, 100, 50, "#ffff00", "#00ff00", 5, false); this.owner.addChild(sp); 示例中的 20,20 是矩形起始点坐标,100是向右的宽度,如果是负数则是向左的宽度。50是向下的高度,如果是负数则是向上的高度。 运行效果: (图2-3) 2.3 用d...

来源: Laya3.0_文档 发布时间: 20251010

8. 节点管理 · LayaAir3.3 · 引擎文档 · LAYABOX [ 89%]

...下面来熟悉一下Node类的所有基础的功能 添加 添加子节点addChild(node:Node) 在考虑层级的情况下,我们可以给某个节点添加子节点,可让子节点跟随父节点显示与否,移动,以及方便管理。添加的子节点会加到所有子节点的最后...

来源: Laya3.0_文档 发布时间: 20251010

9. 树状列表组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 88%]

...Laya.stage.height - tree.height) / 2; tree.bgColor = "#d25454"; this.owner.addChild(tree); } } class Item extends Laya.Box { constructor() { super(); this.right = 0; this.left = 0; var selectBox: Laya.Clip = new Laya.Clip("resources/tree/clip_selectBox.png", 1, 2); selectBox.name = "selectBox";//设...

来源: Laya3.0_文档 发布时间: 20251010

10. 使用二进制图片 · LayaAir3.0文档 · LAYABOX [ 87%]

...载Base64图片数据 sp1.loadImage(e.target.result as string); this.owner.addChild(sp1); } }); 上述代码中,用 Laya.loader.fetch 加载图片二进制数据,根据自定义的规则,可以解析数据加密方式,并获得完整图片数据。在这里我们更多的介绍一下 LayaAir...

来源: Laya3.0_文档 发布时间: 20230303