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

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

1. 2D物理-复合碰撞器 [ 100%]

...r.width / 2, posy = Laya.Browser.height / 2; let box = this.box = new Laya.Sprite(); box.size(width + height * 2, width + height * 2); box.pivot(box.width / 2, box.height / 2); box.pos(posx, posy); Laya.Laya.stage.addChild(box); let boxBody = box.addComponent(Laya.RigidBody); let box1Shape = box.add...

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

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

...a.stage.removeChild(food); foods.splice(i, 1); } } } produceFood() { const Sprite = Laya.Sprite; // 最多五个食物同屏 if (foods.length == 5) return; let food = new Sprite(); Laya.stage.addChild(food); foods.push(food); const foodSize = 40; food.size(foodSize, foodSize); food.graphics.drawRect...

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

3. 滤镜-颜色滤镜 [ 97%]

...ild.x + apeTexture.width; grayApe.y = secondChild.y; } createApe() { const Sprite = Laya.Sprite; let ape = new Sprite(); Laya.stage.addChild(ape); apeTexture = Laya.loader.getRes(apePath); ape.graphics.drawTexture(apeTexture); return ape; } } new Filters_Color();module laya { import Sprite = Laya.Sp...

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

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

... y); } tick += 0.1; } } new PerformanceTest_Maggots();module laya { import Sprite = Laya.Sprite; import Browser = Laya.Browser; import Handler = Laya.Handler; import Stat = Laya.Stat; import Rectangle = Laya.Rectangle; import WebGL = Laya.WebGL; export class PerformanceTest_Maggots { private texture...

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

5. 鼠标交互-修正交互区域 [ 96%]

...stage.on(Event.MOUSE_DOWN, this, this.onDown); } createCoralRect() { const Sprite = Laya.Sprite, Event = Laya.Event; let coralRect = new Sprite(); coralRect.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height / 2, "#FF7F50"); //设置名称 coralRect.name = "珊瑚色容器"; coralRect.size(...

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

6. 音频-播放演示 [ 96%]

...setup(); } setup() { const Event = Laya.Event; var gap = 10; //创建一个Sprite充当音效播放按钮 let soundButton = this.createButton("播放音效"); soundButton.x = (Laya.stage.width - soundButton.width * 2 + gap) / 2; soundButton.y = (Laya.stage.height - soundButton.height) / 2; //创建...

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

7. Sprite-屏幕截图 [ 95%]

...TypeScript三种开发语言、LayaAirIDE让项目开发更高效。class Sprite_ScreenShot { constructor() { const Browser = Laya.Browser, WebGL = Laya.WebGL, Stage = Laya.Stage; this.btnArr = ["res/threeDimen/ui/button.png", "res/threeDimen/ui/button.png", "res/threeDimen/ui/button.png"]; this.nam...

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

8. 输入设备-摇一摇 [ 94%]

...Pic(); this.showConsoleText(); this.startShake(); } showShakePic() { const Sprite = Laya.Sprite; let shakePic = new Sprite(); shakePic.loadImage("res/inputDevice/shake.png"); Laya.stage.addChild(shakePic); } showConsoleText() { const Text = Laya.Text; console = new Text(); Laya.stage.addChild(consol...

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

9. 滤镜-发光滤镜 [ 94%]

...; } setup() { this.createApe(); this.applayFilter(); } createApe() { const Sprite = Laya.Sprite; this.ape = new Sprite(); Laya.stage.addChild(this.ape); let texture = Laya.loader.getRes(apePath); this.ape.graphics.drawTexture(texture); this.ape.x = (Laya.stage.width - texture.width) / 2; this.ape.y ...

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

10. Sprite-轴心点 [ 94%]

...TypeScript三种开发语言、LayaAirIDE让项目开发更高效。class Sprite_Pivot { constructor() { const Browser = Laya.Browser, WebGL = Laya.WebGL, Stage = Laya.Stage; // 不支持WebGL时自动切换至Canvas Laya.init(Browser.clientWidth, Browser.clientHeight, WebGL); Laya.stage.alignV = St...

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