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

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

1. 2D灯光与网格 · LayaAir3.3 · 引擎文档 · LAYABOX [ 100%]

... 通过按位或运算组合这些值 将结果赋值给图层遮罩属性 示例代码如下: const { regClass, property } = Laya; @regClass() export class lightTest extends Laya.Script { declare owner: Laya.Sprite; @property({ type: Laya.Sprite }) light1: Laya.Sprite; @property({ type: Laya.Spri...

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

2. CommandBuffer · LayaAir3.3 · 引擎文档 · LAYABOX [ 97%]

CommandBuffer文档1.简介2.使用步骤3.使用示例CommandBuffer文档 1.简介 CommandBuffer为渲染命令缓冲区,保存了渲染命令列表。当我们将一些渲染指令添加到CommandBuffer后,可以实现对渲染流程的控制,将这些指令在我们想要的时机进行执...

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

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

... 使用 Transform3D 类,可以对3D基础对象做基础变换,代码示例如下: //改变立方体的世界坐标 box.transform.position = new Laya.Vector3(0, 0, 0); //立方体的平移 box.transform.translate(new Laya.Vector3(1, 1, 1)); //立方体的旋转 box.transform.rotate(new Laya.Ve...

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

4. 组件装饰器说明 · LayaAir3.3 · 引擎文档 · LAYABOX [ 93%]

...件脚本,需要在类定义之前使用装饰器的标识@regClass(),示例代码如下所示: const { regClass } = Laya; @regClass() export class Script extends Laya.Script { } 1.2 IDE中如何找到被识别的组件脚本 只有使用了@regClass()装饰器标识,才会被LayaAir3-IDE识...

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

5. 资源加载 · LayaAir3.3 · 引擎文档 · LAYABOX [ 93%]

...((res)=> {/** 不带类型,用于常规的资源 */}); 完整的脚本示例如下: const { regClass, property } = Laya; @regClass() export class LoaderDemo extends Laya.Script { onAwake(): void { this.loadTexture("resources/image/monkey2.png", 500);//需要在resources/image放入相应的...

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

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

...e(x, y, width, height, fillColor, lineColor, lineWidth, percent)); } 代码示例: let sp = new Laya.Sprite(); //画矩形 sp.graphics.drawRect(20, 20, 100, 50, "#ffff00", "#00ff00", 5, false); this.owner.addChild(sp); 示例中的 20,20 是矩形起始点坐标,100是向右的宽度,如果...

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

7. 面板容器组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 92%]

...以开发者可以在Panel下添加一些子节点。需要添加如下的示例代码,实现脚本控制Panel: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { @property({ type: Laya.Panel }) public panel: Laya.Panel; //组件被激活后执行,此...

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

8. 组件脚本的内置方法 · LayaAir3.3 · 引擎文档 · LAYABOX [ 92%]

...机(如节点创建、启用等)自动执行相应的方法。 使用示例如下: const { regClass } = Laya; @regClass() export class NewScript extends Laya.Script { //被添加到节点后调用,和Awake不同的是即使节点未激活onAdded也会调用 onAdded(): void { console.log("Gam...

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

9. 角色控制器 · LayaAir3.3 · 引擎文档 · LAYABOX [ 91%]

...撞分组的话,引擎API的碰撞分组需要将值设置为2的幂。 示例代码如下: //用代码指定xxx碰撞器所属哪个碰撞组 xxx.collisionGroup = 1 << 3 ;// 值为2 的 3 次幂(8),可以简单理解分组ID为3,这样就更容易与IDE中的概念统一 2.2 可...

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

10. 精灵 · LayaAir3.3 · 引擎文档 · LAYABOX [ 91%]

... 接着,就可以在组件脚本中用代码对Sprite进行控制了,示例代码如下: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { //declare owner : Laya.Sprite3D; @property({ type: Laya.Sprite }) public sprite: Laya.Sprite; constructor() { s...

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