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

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

1. 字体切片组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 100%]

...龙蛇马羊猴鸡狗猪年快乐"; testFontClip.spaceY = 10; this.owner.addChild(clipnum); this.owner.addChild(fontClip); this.owner.addChild(testFontClip); this.owner.addChild(testClipNum); this.owner.addChild(clipnum1); } } 通常FontClip已经可以满足开发者的基本需求。如果有特...

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

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

...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

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

...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

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

....skin = url; //ui组件直接设置skin也可以 img.pos(x, y); this.owner.addChild(img); }); } } 1.2 带类型的加载方式 有的时候,网络资源没有后缀名,又或者,图片xxx.png并非是当成Texture使用,需要被定义为TextureCube。所以,这些时候需要通过类型...

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

5. 2D光遮挡器与阴影 · LayaAir3.3 · 引擎文档 · LAYABOX [ 85%]

...createLightOccluder(): void { this.lightOccluder.pos(233, 265); this.owner.addChild(this.lightOccluder); let lightOccluderComponent = this.lightOccluder.addComponent(Laya.LightOccluder2D); lightOccluderComponent.canInLight = true; lightOccluderComponent.outside = true; let poly: Laya.PolygonPoint2D ...

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

6. 2D方向光 · LayaAir3.3 · 引擎文档 · LAYABOX [ 85%]

...如,设置在屏幕左上角 this.displayText.y = 10; this.owner.scene.addChild(this.displayText); // 在场景中添加文本显示 } onUpdate(): void { // 更新时间 this.dayTime = (this.dayTime + Laya.timer.delta / 1000) % this.dayDuration; const totalMinutes = Math.floor((this.getAdjustedPro...

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

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

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

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

8. TiledMap地图 · LayaAir3.3 · 引擎文档 · LAYABOX [ 81%]

... private onLoaded(): void { this.tMap.mapSprite().removeSelf(); this.owner.addChild(this.tMap.mapSprite()); } //地图加载完成的回调 private completeHandler(e: any = null): void { this.onLoaded(); } } 编译运行代码,效果如图3-3所示,说明地图已创建成功。 (图3-3) 3.3...

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

9. 音频节点 · LayaAir3.3 · 引擎文档 · LAYABOX [ 80%]

...(): void { let sound = new Laya.SoundNode(); // 添加到舞台 Laya.stage.addChild(sound); sound.source = "resources/sound.wav"; //音频路径 sound.loop = 0; //循环次数设置,要放在autoPlay参数设置前 sound.autoPlay = true; //自动播放 sound.isMusic = false; //是否为背景音...

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

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

...a.Pool.getItemByCreateFun("effect", this.createEffect, this); owner.parent.addChild(effect);//将爆炸动画添加到父节点中 effect.pos(owner.x, owner.y);//设置爆炸动画的位置,让其跟随方块 owner.removeSelf();//删除方块自身节点对象 Laya.SoundManager.playSound("resource...

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