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

大约有 17 项符合查询结果, 库内数据总量为 30,786 项。 (搜索耗时: 0.0029 秒)

1. 计时器-间隔循环 [ 100%]

...TypeScript三种开发语言、LayaAirIDE让项目开发更高效。class Timer_Interval { constructor() { const Browser = Laya.Browser, WebGL = Laya.WebGL, Stage = Laya.Stage, Stat = Laya.Stat, Handler = Laya.Handler; // 不支持WebGL时自动切换至Canvas Laya.init(Browser.width, Browser.height...

来源: Laya2.0_示例 发布时间: 20241124

2. Sprite-旋转缩放 [ 91%]

...e.width / 2; this.ape.y = Laya.stage.height / 2; this.scaleDelta = 0; Laya.timer.frameLoop(1, this, this.animate); } animate() { this.ape.rotation += 2; //心跳缩放 this.scaleDelta += 0.02; let scaleValue = Math.sin(this.scaleDelta); this.ape.scale(scaleValue, scaleValue); } } new Sprite_RoateAnd...

来源: Laya2.0_示例 发布时间: 20241124

3. 鼠标交互-Hold [ 91%]

...ent = Laya.Event; // 鼠标按下后,HOLD_TRIGGER_TIME毫秒后hold Laya.timer.once(HOLD_TRIGGER_TIME, this, this.onHold); Laya.stage.on(Event.MOUSE_UP, this, this.onApeRelease); } onHold() { const Tween = Laya.Tween, Ease = Laya.Ease; Tween.to(this.ape, { "scaleX": 1, "scaleY": 1 }, 500, Ease.bou...

来源: Laya2.0_示例 发布时间: 20241124

4. UI-ProgressBar [ 86%]

..."; this.progressBar.changeHandler = new Handler(this, this.onChange); Laya.timer.loop(100, this, this.changeValue); } changeValue() { if (this.progressBar.value >= 1) { this.progressBar.value = 0; } this.progressBar.value += 0.05; } onChange(value) { console.log("进度:" + Math.floor(value * 100)...

来源: Laya2.0_示例 发布时间: 20241124

5. 混合模式-Lighter [ 84%]

...) { this.createPhoenixes(); // 动态背景渲染 this.evalBgColor(); Laya.timer.frameLoop(1, this, this.renderBg); } createPhoenixes() { let scaleFactor = Math.min( Laya.stage.width / (phoenixWidth * 2), Laya.stage.height / phoenixHeight); // 混合模式的凤凰 let blendedPhoenix = this.createAn...

来源: Laya2.0_示例 发布时间: 20241124

6. 骨骼动画-换装 [ 78%]

...STOPPED, this, this.completeHandler); this.play(); this.changeSkin(); Laya.timer.loop(1000, this, this.changeSkin); } changeSkin() { mCurrSkinIndex++; let skinLength = mSkinList.length; if (mCurrSkinIndex >= skinLength) { mCurrSkinIndex = 0; } mArmature.showSkinByName(mSkinList[mCurrSkinIndex]); } c...

来源: Laya2.0_示例 发布时间: 20241124

7. 2D物理-仿生机器人 [ 77%]

...cleBody.linearVelocity = { x: velocityX * 5, y: velocityY * 5 }; Laya.Laya.timer.frameOnce(120, this, function () { newBall.destroy(); }); }); let label = this.label = Laya.Laya.stage.addChild(new Laya.Label("双击屏幕,仿生机器人向相反方向运动\n单击产生新的小球刚体")); lab...

来源: Laya2.0_示例 发布时间: 20241124

8. 2D物理-复合碰撞器 [ 77%]

...oint.enableMotor = true; box.addComponentIntance(revoluteJoint); Laya.Laya.timer.frameLoop(1, this, this.addMiniBox); } addMiniBox() { let box = this.box; if (this.count >= this.totalBox) { return; } let sp = new Laya.Sprite(); Laya.Laya.stage.addChild(sp); sp.x = box.x; sp.y = box.y; sp.addComponen...

来源: Laya2.0_示例 发布时间: 20241124

9. Sprite-容器 [ 72%]

...s ); } this.apesCon.pos(Laya.stage.width / 2, Laya.stage.height / 2); Laya.timer.frameLoop(1, this, this.animate); } animate() { this.apesCon.rotation += 1; } } new Sprite_Container();module laya { import Sprite = Laya.Sprite; import Stage = Laya.Stage; import Event = Laya.Event; import Browser = La...

来源: Laya2.0_示例 发布时间: 20241124

10. 性能测试-虫子(慎入) [ 72%]

... maggotTexture = Laya.loader.getRes(texturePath); this.initMaggots(); Laya.timer.frameLoop(1, this, this.animate); } initMaggots() { let maggotContainer; for (let i = 0; i wb.x + wb.width) x -= wb.width; if (y wb.y + wb.height) y -= wb.height; maggot.pos(x, y); } tick += 0.1; } } new PerformanceTest...

来源: Laya2.0_示例 发布时间: 20241124