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

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

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

...t.y + vGap); Laya.timer.loop(200, this, this.animateTimeBased); Laya.timer.frameLoop(2, this, this.animateFrameRateBased); } createText(text, x, y) { const Text = Laya.Text; let t = new Text(); t.text = text; t.fontSize = 30; t.color = "white"; t.bold = true; t.pivot(t.width / 2, t.height / 2); t.po...

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

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

...h / 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_RoateAndScale(...

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

3. Sprite-容器 [ 89%]

... 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 = Laya.Bro...

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

4. 性能测试-虫子(慎入) [ 89%]

...tTexture = 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_Maggo...

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

5. 2D物理-复合碰撞器 [ 89%]

...nableMotor = 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.addComponent(Laya...

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

6. Sprite-节点控制 [ 88%]

... Laya.stage.addChild(this.ape1); this.ape1.addChild(this.ape2); Laya.timer.frameLoop(1, this, this.animate); } animate() { this.ape1.rotation += 2; this.ape2.rotation -= 4; } } new Sprite_NodeControl();module laya { import Sprite = Laya.Sprite; import Stage = Laya.Stage; import Event = Laya.Event; i...

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

7. Sprite-轴心点 [ 88%]

...is.ape2.pos(Laya.stage.width / 2 + gap, Laya.stage.height / 2); Laya.timer.frameLoop(1, this, this.animate); } animate() { this.ape1.rotation += 2; this.ape2.rotation += 2; } } new Sprite_Pivot();module laya { import Sprite = Laya.Sprite; import Stage = Laya.Stage; import Event = Laya.Event; import ...

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

8. 鼠标交互-键盘交互 [ 86%]

...etup(); } setup() { this.listenKeyboard(); this.createLogger(); Laya.timer.frameLoop(1, this, this.keyboardInspector); } listenKeyboard() { const Event = Laya.Event; // 用Set实现更好一些 keyDownList = []; // 添加键盘按下事件,一直按着某按键则会不断触发 Laya.stage.on(Event....

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

9. 其他引擎的Demo-Example_21 [ 85%]

....stage.bgColor = "#3da8bb"; Stat.show(); this.createCanvases(); Laya.timer.frameLoop(1, this, this.animate); Laya.stage.on('mousedown', this, this.onMouseDown); Laya.stage.on('mousemove', this, this.onMouseMove); Laya.stage.on('mouseup', this, this.onMouseUp); } createCanvases() { const Sprite = Lay...

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

10. 输入设备-贪吃蛇(重力感应) [ 81%]

...n(Event.CHANGE, this, this.monitorAccelerator); // 游戏循环 Laya.timer.frameLoop(1, this, this.animate); // 食物生产 Laya.timer.loop(3000, this, this.produceFood); // 游戏开始时有一个食物 this.produceFood(); } initSnake() { const Point = Laya.Point; for (let i = 0; i 0) { let prevS...

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