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

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

1. 定时器 · LayaAir3.3 · 引擎文档 · LAYABOX [ 100%]

.... 清理定时器6. 立即执行并删除定时器定时器 定时器 Laya.Timer 是时钟管理类。它是一个单例,不要手动实例化此类,应该通过 Laya.timer 访问。 同时 Laya.Timer 表示游戏主时针,同时也是管理场景、动画、缓动等效果时钟,通过控...

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

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

...量4.2 尽量减少旋转,缩放,alpha等属性的使用4.3 不要在Timer的循环里创建对象及复杂计算4.4 尽量少用autoSize与getBounds4.5 被try catch的函数执行会变得非常慢五、使用chrome的性能分析器5.1 CPU占用分析5.2 内存占用分析六、纹理压缩的...

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

3. 进度条组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 77%]

... this.loadText.text = "资源加载中……"; // 测试加载效果 Laya.timer.loop(100, this, this.changeProgress); } //这里仅模拟加载演示效果 changeProgress(): void { this.progressBar.value += 0.05; //每次进度条的改变量 if (this.progressBar.value == 1) { this.loadText.text = "...

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

4. 2D自由形态光 · LayaAir3.3 · 引擎文档 · LAYABOX [ 64%]

...灯光旋转动画 this.lightComp.lightRotation += this.rotateSpeed * Laya.timer.delta / 1000; // 实现灯光缩放动画 this.scaleTime += Laya.timer.delta / 1000 * this.scaleSpeed; const scale = 1 + Math.sin(this.scaleTime) * 0.5; // 增加缩放变化幅度 this.lightComp.lightScale.setValue(sca...

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

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

...e(); this.owner.addChild(sp); let i: number = 0; //每秒重画一次 Laya.timer.loop(1000, this, () => { i == res.length && (i = 0); //清除sp节点的所有绘图(不含子节点) sp.graphics.clear(); //在sp节点上重绘纹理 sp.graphics.drawTexture(res[i]); i++; }); }); } } 2....

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

6. 3D变换 · LayaAir3.3 · 引擎文档 · LAYABOX [ 52%]

...ke(): void { //设置定时器执行,定时重复执行(基于帧率) Laya.timer.frameLoop(1, this, this.animate); } private animate(): void { // 旋转立方体(四元数) this.cube.transform.rotate(this.rot, false, false); } } 旋转的效果如动图2-1所示: (动图2-1) 2.2 localRotat...

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

7. 组件属性的代码使用 · LayaAir3.3 · 引擎文档 · LAYABOX [ 48%]

...te rotation: Laya.Vector3 = new Laya.Vector3(0, 0.01, 0); onStart() { Laya.timer.frameLoop(1, this, ()=> { this.cube.transform.rotate(this.rotation, false); }); } } 效果如动图1-4所示: (动图1-4) 1.3 3D节点的进阶使用 @property( { type :Laya.Sprite3D } ) //节点类型 public p...

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

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

... } onUpdate(): void { // 更新时间 this.dayTime = (this.dayTime + Laya.timer.delta / 1000) % this.dayDuration; const totalMinutes = Math.floor((this.getAdjustedProgress()) * 24 * 60); const hours = Math.floor(totalMinutes / 60); const minutes = totalMinutes % 60; const timeString = `${this.padNum...

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

9. 场景管理 · LayaAir3.3 · 引擎文档 · LAYABOX [ 34%]

...用显示Loading场景 Laya.Scene.showLoadingPage(this.loadingScene); Laya.timer.once(3000,this,()=>{ //3秒后跳转到Game场景 Laya.Scene.open("Game.ls"); }) } } 在打开的场景Scene.ls下,挂上脚本,并拖入Loading.lh作为场景。 (图2-5) 这样就可以使用Loading场景...

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

10. 3D寻路 · LayaAir3.0文档 · LAYABOX [ 33%]

...通过Tween来执行角色位置改变的 //开启定时重复执行 Laya.timer.loop(40, this, this.loopfun); private loopfun(): void { //resPath,角色需要移动的每个世界坐标位置数组 if (this.resPath && this.index < this.resPathLength) { //AStar寻路位置 this._position...

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