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

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

1. Sprite-根据数据绘制路径 [ 100%]

...vas.graphics.drawPoly(Laya.stage.width / 2, Laya.stage.height / 2, path, "#FF7F50"); } })();module laya { import Sprite = Laya.Sprite; import Stage = Laya.Stage; import Browser = Laya.Browser; import WebGL = Laya.WebGL; export class Sprite_DrawPath { constructor() { // 不支持WebGL时自动切换...

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

2. 文本-下划线 [ 97%]

...0); createText('center', 2, "#00BFFF", 155, 150); createText('right', 3, "#FF7F50", 210, 290); } function createText(align, underlineWidth, underlineColor, x, y) { var txt = new Text(); txt.text = "Layabox\n是HTML5引擎技术提供商\n与优秀的游戏发行商\n面向AS/JS/TS开发者提供HTML...

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

3. 区块地图-等角地图 [ 90%]

... = 32; var radiusY = Math.tan(180 / Math.PI * 30) * radiusX; var color = "#FF7F50"; sprite = new Sprite(); sprite.graphics.drawLine(0, 0, -radiusX, radiusY, color); sprite.graphics.drawLine(0, 0, radiusX, radiusY, color); sprite.graphics.drawLine(-radiusX, radiusY, 0, radiusY * 2, color); sprite.gra...

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

4. 音频-播放演示 [ 88%]

... = 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.playMusic("../../res/s...

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

5. 鼠标交互-双指旋转(多点触控) [ 88%]

...p = new Sprite(); var w = 200, h = 300; sp.graphics.drawRect(0, 0, w, h, "#FF7F50"); sp.size(w, h); sp.pivot(w / 2, h / 2); sp.pos(Laya.stage.width / 2, Laya.stage.height / 2); Laya.stage.addChild(sp); sp.on(Event.MOUSE_DOWN, this, onMouseDown); } function onMouseDown(e) { var touches = e.touches; i...

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

6. 鼠标交互-双指缩放(多点触控) [ 85%]

...p = new Sprite(); var w = 300, h = 300; sp.graphics.drawRect(0, 0, w, h, "#FF7F50"); sp.size(w, h); sp.pivot(w / 2, h / 2); sp.pos(Laya.stage.width / 2, Laya.stage.height / 2); Laya.stage.addChild(sp); sp.on(Event.MOUSE_DOWN, this, onMouseDown); } function onMouseDown(e) { var touches = e.touches; i...

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

7. 计时器-延迟执行 [ 85%]

... h = 60; var button = new Sprite(); 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; } function onDecreaseAlpha1(e) { //移除鼠标单击事件 button1.off(Event.CLICK, this, onDecrease...

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

8. 鼠标交互-修正交互区域 [ 84%]

...ralRect.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(Event.MOUSE_DOWN, this, onDown); } function createDeepSkyblueR...

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

9. 鼠标交互-滑动 [ 81%]

...onst h = 30; button = new Sprite(); button.graphics.drawRect(0, 0, w, h, "#FF7F50"); button.pivot(w / 2, h / 2); //设置宽高(要接收鼠标事件必须设置宽高,否则不会被命中) button.size(w, h); button.x = (Laya.stage.width - TrackLength) / 2; button.y = Laya.stage.height / 2; b...

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

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

...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(radian) * this.width; var ty = this.y + Math.sin(radian) * this...

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