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

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

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-屏幕截图 [ 96%]

...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-绘制各种形状 [ 94%]

...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. 输入设备-贪吃蛇(重力感应) [ 87%]

...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

6. DOM元素-视频 [ 84%]

...ce); reference.pos(100, 100); reference.size(600, 400); reference.graphics.drawRect(0, 0, reference.width, reference.height, "#CCCCCC"); // 每次舞台尺寸变更时,都会调用Utils.fitDOMElementInArea设置Video的位置,对齐的位置和refence重合 Laya.stage.on(Laya.Event.RESIZE, this,...

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

7. 音频-播放演示 [ 84%]

...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

8. 鼠标交互-自定义事件 [ 83%]

... Laya.Sprite, Event = Laya.Event; this.sp = new Sprite(); this.sp.graphics.drawRect(0, 0, 200, 200, "#D2691E"); this.sp.pivot(100, 100); this.sp.x = Laya.stage.width / 2; this.sp.y = Laya.stage.height / 2; this.sp.size(200, 200); Laya.stage.addChild(this.sp); this.sp.on(ROTATE, this, this.onRotate);...

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

9. 计时器-延迟执行 [ 81%]

...0; let button = new Sprite(); Laya.stage.addChild(button); button.graphics.drawRect(0, 0, w, h, "#FF7F50"); button.size(w, h); button.graphics.fillText(label, w / 2, 17, "20px simHei", "#ffffff", "center"); return button; } onDecreaseAlpha1(e) { const Event = Laya.Event; //移除鼠标单击事件 t...

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

10. 混合模式-Lighter [ 79%]

...BgColor(); } renderBg() { Laya.stage.graphics.clear(); Laya.stage.graphics.drawRect( 0, 0, phoenixWidth, phoenixHeight, this.getHexColorString()); } getHexColorString() { bgColorChannels.r = Math.floor(bgColorChannels.r); // 绿色通道使用0 bgColorChannels.g = 0; //obj.g = Math.floor(obj.g); bgC...

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