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

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

1. 其他引擎的Demo-Example_23 [ 100%]

... laser.life = 0; let pos1; let pos2; if (type % 2) { pos1 = new Point(-20, Math.random() * viewHeight); pos2 = new Point(viewWidth, Math.random() * viewHeight + 20); } else { pos1 = new Point(Math.random() * viewWidth, -20); pos2 = new Point(Math.random() * viewWidth, viewHeight + 20); } let distX =...

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

2. Sprite-缓存为静态图像 [ 97%]

...ext = new Text(); textBox.addChild(text); text.fontSize = 20; text.text = (Math.random() * 100).toFixed(0); text.rotation = Math.random() * 360; text.color = "#ccc"; text.x = Math.random() * Laya.stage.width; text.y = Math.random() * Laya.stage.height; } //缓存为静态图像 textBox.cacheAs = "bi...

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

3. 其他引擎的Demo-Example_05 [ 95%]

...] - 1; } x3d = tpoint1[i]; y3d = tpoint2[i]; z3d = tpoint3[i]; ty = (y3d * Math.cos(vx)) - (z3d * Math.sin(vx)); tz = (y3d * Math.sin(vx)) + (z3d * Math.cos(vx)); tx = (x3d * Math.cos(vy)) - (tz * Math.sin(vy)); tz = (x3d * Math.sin(vy)) + (tz * Math.cos(vy)); ox = tx; tx = (tx * Math.cos(vz)) - (ty...

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

4. 区块地图-等角地图 [ 95%]

...通过地图坐标得到屏幕坐标 this.layer.getScreenPositionByTilePos(Math.floor(p.x), Math.floor(p.y), p); this.sprite.pos(p.x, p.y); } mapLoaded() { this.layer = this.tiledMap.getLayerByIndex(0); var radiusX = 32; var radiusY = Math.tan(180 / Math.PI * 30) * radiusX; // 14.37 var color = "#FF...

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

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

...ze); 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(width, height); this.init(); } init() { this.graphics.drawR...

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

6. Sprite-容器 [ 93%]

...Ape() { const Sprite = Laya.Sprite; const layoutRadius = 150, radianUnit = Math.PI / 2; // 该容器用于装载4张猩猩图片 this.apesCon = new Sprite(); Laya.stage.addChild(this.apesCon); // 添加4张猩猩图片 let ape; for (let i = 0; i < 4; i++) { ape = new Sprite(); this.apesCon.addChild(...

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

7. 混合模式-Lighter [ 92%]

...frameLoop(1, this, this.renderBg); } createPhoenixes() { let scaleFactor = Math.min( Laya.stage.width / (phoenixWidth * 2), Laya.stage.height / phoenixHeight); // 混合模式的凤凰 let blendedPhoenix = this.createAnimation(); blendedPhoenix.blendMode = Laya.BlendMode.LIGHTER; // 指定要使用...

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

8. 2D物理-仿生机器人 [ 90%]

... p1.concat(p2).concat(p3).join(","); legCollider2.points = [0, 0].concat(B2Math.SubVV(p5, p4)).concat(B2Math.SubVV(p6, p4)).join(","); } else { legCollider1.points = p1.concat(p3).concat(p2).join(","); legCollider2.points = [0, 0].concat(B2Math.SubVV(p6, p4)).concat(B2Math.SubVV(p5, p4)).join(","); ...

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

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

...let touches = e.touches; if (touches && touches.length == 2) { preRadian = Math.atan2( touches[0].stageY - touches[1].stageY, touches[0].stageX - touches[1].stageX); Laya.stage.on(Event.MOUSE_MOVE, this, this.onMouseMove); } } onMouseMove(e) { let touches = e.touches; if (touches && touches.length =...

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

10. 输入设备-指南针 [ 85%]

...并非正确方位。"); } // 更新角度显示 degreesText.text = 360 - Math.floor(info.alpha) + "°"; compassImg.rotation = info.alpha; // 更新方位指示器 directionIndicator.x = -1 * Math.floor(info.gamma) / 90 * 70 + compassImg.x; directionIndicator.y = -1 * Math.floor(info.beta) / 90 * 70...

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