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

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

1. Sprite-切换纹理 [ 100%]

...y2Str = "res/apes/monkey2.png", monkey1Res, monkey2Res; class Sprite_SwitchTexture { constructor() { const Browser = Laya.Browser, WebGL = Laya.WebGL, Stage = Laya.Stage; // 不支持WebGL时自动切换至Canvas Laya.init(Browser.clientWidth, Browser.clientHeight, WebGL); Laya.stage.alignV = Stage....

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

2. 滤镜-发光滤镜 [ 99%]

...= 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 = (Laya.stage.height - texture.height) / 2; } applayFilter() { // 创建一个发...

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

3. 鼠标交互-拖动 [ 95%]

... Sprite(); this.ape.loadImage(ApePath); Laya.stage.addChild(this.ape); let texture = Laya.loader.getRes(ApePath); this.ape.pivot(texture.width / 2, texture.height / 2); this.ape.x = Laya.stage.width / 2; this.ape.y = Laya.stage.height / 2; this.ape.on(Event.MOUSE_DOWN, this, this.onStartDrag); } sho...

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

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

...; this.aimSp = null; this.drawImage = null; this.drawSp = null; this.monkeyTexture = null; // 不支持WebGL时自动切换至Canvas Config.preserveDrawingBuffer =true; Laya.init(Browser.clientWidth, Browser.clientHeight); Laya.stage.alignV = Stage.ALIGN_MIDDLE; Laya.stage.alignH = Stage.ALIGN_CENTE...

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

5. 鼠标交互-Hold [ 93%]

...nt = Laya.Event; this.ape = new Sprite(); this.ape.loadImage(apePath); let texture = Laya.loader.getRes(apePath); this.ape.pivot(texture.width / 2, texture.height / 2); this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2); this.ape.scale(0.8, 0.8); Laya.stage.addChild(this.ape); // 鼠标交互...

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

6. Sprite-显示图片 [ 91%]

...ya.stage.addChild(ape); ape.loadImage(monkey1Path); // 方法2:使用drawTexture Laya.loader.load(monkey2Path, Laya.Handler.create(this, function () { let monkey2 = Laya.loader.getRes(monkey2Path); let ape2 = new Laya.Sprite(); Laya.stage.addChild(ape2); ape2.graphics.drawTexture(monkey2, 100, 0);...

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

7. 滤镜-模糊滤镜 [ 89%]

...= 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 = (Laya.stage.height - texture.height) / 2; } applayFilter() { // 创建一个模...

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

8. 加载-单一类型资源加载 [ 88%]

...onkey2.png"], Handler.create(this, this.onAssetLoaded2)); } onAssetLoaded1(texture) { // 使用texture } onAssetLoaded2() { const Loader = Laya.Loader; let pic1 = Loader.getRes("res/apes/monkey0.png"); let pic2 = Loader.getRes("res/apes/monkey1.png"); let pic3 = Loader.getRes("res/apes/monkey2.png")...

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

9. 加载-错误处理和进度 [ 87%]

...载失败 Laya.loader.on(Event.ERROR, this, this.onError); } onAssetLoaded(texture) { // 使用texture console.log("加载结束"); } // 加载进度侦听器 onLoading(progress) { console.log("加载进度: " + progress); } onError(err) { console.log("加载失败: " + err); } } new Loader_Progress...

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

10. 加载-加载序列 [ 86%]

...r.create(this, this.onAssetLoaded), null, null, 2, false); } onAssetLoaded(texture) { console.log(texture.url); // 恢复默认并发加载个数。 if (++numLoaded == 3) { Laya.loader.maxLoader = 5; console.log("All done."); } } } new Loader_Sequence();module laya { import Texture = Laya.Texture; i...

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