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

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

1. 鼠标交互-修正交互区域 [ 100%]

...rite, Event = Laya.Event; let coralRect = new Sprite(); coralRect.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height / 2, "#FF7F50"); //设置名称 coralRect.name = "珊瑚色容器"; coralRect.size(Laya.stage.width, Laya.stage.height / 2); Laya.stage.addChild(coralRect); coralRect.on(Even...

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

2. Sprite-新手引导 [ 97%]

...guideContainer.addChild(maskArea); maskArea.alpha = 0.5; maskArea.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height, "#000"); // 绘制一个圆形区域,利用叠加模式,从遮罩区域抠出可交互区 interactionArea = new Sprite(); guideContainer.addChild(interactionArea); // ...

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

3. Sprite-屏幕截图 [ 97%]

...wser.clientHeight/2); Laya.stage.addChild(this.aimSp); this.aimSp.graphics.drawRect(0,0,this.aimSp.width,this.aimSp.height,"#333333"); this.monkeyTexture = Laya.loader.getRes("res/apes/monkey3.png"); this.aimSp.graphics.drawTexture(this.monkeyTexture,0,0,this.monkeyTexture.width,this.monkeyTexture.h...

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

4. Sprite-绘制各种形状 [ 95%]

...7, -100, 117, 0, 136, 100, 156, 0], "#ff0000", 5); //画矩形 sp.graphics.drawRect(10, 166, 166, 90, "#ffff00"); //画多边形 sp.graphics.drawPoly(264, 166, [0, 0, 60, 0, 78.48, 57, 30, 93.48, -18.48, 57], "#ffff00"); //画三角形 sp.graphics.drawPoly(400, 166, [0, 100, 50, 0, 100, 100], "#ffff...

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

5. 屏幕适配-缩放-No Border [ 92%]

...{ const Sprite = Laya.Sprite; this.rect = new Sprite(); this.rect.graphics.drawRect(-100, -100, 200, 200, "gray"); Laya.stage.addChild(this.rect); this.updateRectPos(); } updateRectPos() { this.rect.x = Laya.stage.width / 2; this.rect.y = Laya.stage.height / 2; } } new SmartScale_Scale_NOBORDER();mo...

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

6. 屏幕适配-缩放-No Scale [ 92%]

...{ const Sprite = Laya.Sprite; this.rect = new Sprite(); this.rect.graphics.drawRect(-100, -100, 200, 200, "gray"); Laya.stage.addChild(this.rect); this.updateRectPos(); } updateRectPos() { this.rect.x = Laya.stage.width / 2; this.rect.y = Laya.stage.height / 2; } } new SmartScale_Scale_NOSCALE();mod...

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

7. 屏幕适配-缩放-Extract Fit [ 92%]

...{ const Sprite = Laya.Sprite; this.rect = new Sprite(); this.rect.graphics.drawRect(-100, -100, 200, 200, "gray"); Laya.stage.addChild(this.rect); this.updateRectPos(); } updateRectPos() { this.rect.x = Laya.stage.width / 2; this.rect.y = Laya.stage.height / 2; } } new SmartScale_Scale_EXTRACT_FIT()...

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

8. 屏幕适配-缩放-Show All [ 92%]

...{ const Sprite = Laya.Sprite; this.rect = new Sprite(); this.rect.graphics.drawRect(-100, -100, 200, 200, "gray"); Laya.stage.addChild(this.rect); this.updateRectPos(); } updateRectPos() { this.rect.x = Laya.stage.width / 2; this.rect.y = Laya.stage.height / 2; } } new SmartScale_Scale_SHOW_ALL();mo...

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

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

...h(food); const foodSize = 40; food.size(foodSize, foodSize); food.graphics.drawRect(0, 0, foodSize, foodSize, "#00BFFF"); food.x = Math.random() * Laya.stage.width; food.y = Math.random() * Laya.stage.height; } } class Segment extends Laya.Sprite { constructor(width, height) { super(); this.size(wid...

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

10. 音频-播放演示 [ 86%]

...btn = new Sprite(); Laya.stage.addChild(btn); btn.size(w, h); btn.graphics.drawRect(0, 0, w, h, "#FF7F50"); btn.graphics.fillText(labelText, w / 2, 8, "24px SimHei", "#FFFFFF", "center"); return btn; } // 播放音效 onPlaySound() { console.log("播放音效"); Laya.SoundManager.playSound("res/soun...

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