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

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

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

...ction createCoralRect() { var 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...

来源: Laya_示例 发布时间: 20241118

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

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

来源: Laya_示例 发布时间: 20241118

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

来源: Laya_示例 发布时间: 20241118

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

...); })(); function createCantralRect() { rect = new Sprite(); rect.graphics.drawRect(-100, -100, 200, 200, "gray"); Laya.stage.addChild(rect); updateRectPos(); } function updateRectPos() { rect.x = Laya.stage.width / 2; rect.y = Laya.stage.height / 2; } })();module laya { import Sprite = Laya.Sprite;...

来源: Laya_示例 发布时间: 20241118

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

...); })(); function createCantralRect() { rect = new Sprite(); rect.graphics.drawRect(-100, -100, 200, 200, "gray"); Laya.stage.addChild(rect); updateRectPos(); } function updateRectPos() { rect.x = Laya.stage.width / 2; rect.y = Laya.stage.height / 2; } })();module laya { import Sprite = Laya.Sprite;...

来源: Laya_示例 发布时间: 20241118

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

...); })(); function createCantralRect() { rect = new Sprite(); rect.graphics.drawRect(-100, -100, 200, 200, "gray"); Laya.stage.addChild(rect); updateRectPos(); } function updateRectPos() { rect.x = Laya.stage.width / 2; rect.y = Laya.stage.height / 2; } })();module laya { import Sprite = Laya.Sprite;...

来源: Laya_示例 发布时间: 20241118

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

...); })(); function createCantralRect() { rect = new Sprite(); rect.graphics.drawRect(-100, -100, 200, 200, "gray"); Laya.stage.addChild(rect); updateRectPos(); } function updateRectPos() { rect.x = Laya.stage.width / 2; rect.y = Laya.stage.height / 2; } })();module laya { import Sprite = Laya.Sprite;...

来源: Laya_示例 发布时间: 20241118

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

...{ Segment.super(this); Segment.prototype.init = function() { this.graphics.drawRect(-height / 2, -height / 2, width + height, height, "#FF7F50"); } // 获取关节另一头位置 Segment.prototype.getPinPosition = function() { var radian = this.rotation * Math.PI / 180; var tx = this.x + Math.cos(ra...

来源: Laya_示例 发布时间: 20241118

9. 鼠标交互-自定义事件 [ 87%]

...teSprite(); })(); function createSprite() { sp = new Sprite(); sp.graphics.drawRect(0, 0, 200, 200, "#D2691E"); sp.pivot(100, 100); sp.x = Laya.stage.width / 2; sp.y = Laya.stage.height / 2; sp.size(200, 200); Laya.stage.addChild(sp); sp.on(ROTATE, this, onRotate); // 侦听自定义的事件 sp.on(...

来源: Laya_示例 发布时间: 20241118

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

... var h = 40; var button = new Sprite(); button.size(w, h); button.graphics.drawRect(0, 0, w, h, "#FF7F50"); button.graphics.fillText(label, w / 2, 8, "25px SimHei", "#FFFFFF", "center"); Laya.stage.addChild(button); return button; } function onPlayMusic(e) { console.log("播放音乐"); SoundManager...

来源: Laya_示例 发布时间: 20241118