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

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

1. 区块地图-滚动地图 [ 100%]

...peScript三种开发语言、LayaAirIDE让项目开发更高效。let mLastMouseX = 0, mLastMouseY = 0, mX, mY; class TiledMap_ScrollMap { constructor() { const Browser = Laya.Browser, WebGL = Laya.WebGL, Stage = Laya.Stage, Event = Laya.Event, Stat = Laya.Stat; // 不支持WebGL时自动切换至Ca...

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

2. Sprite-遮罩-放大镜 [ 96%]

...Sp; Laya.stage.on(Laya.Event.MOUSE_MOVE, this, () => { bg2.x = -Laya.stage.mouseX * 2; bg2.y = -Laya.stage.mouseY * 2; maskSp.x = Laya.stage.mouseX; maskSp.y = Laya.stage.mouseY; }); } } new Sprite_MagnifyingGlass();module laya { import Sprite = Laya.Sprite; import Stage = Laya.Stage; import Browser...

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

3. 鼠标交互-滑动 [ 88%]

...件处理*/ onMouseMove(e) { this.button.x = Math.max(Math.min(Laya.stage.mouseX, endPosition), beginPosition); } /**抬起事件处理*/ onMouseUp(e) { const Event = Laya.Event, Tween = Laya.Tween; Laya.stage.off(Event.MOUSE_MOVE, this, this.onMouseMove); Laya.stage.off(Event.MOUSE_UP, this, this.o...

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

4. 文本-滚动文本 [ 87%]

...文本 */ startScrollText(e) { const Event = Laya.Event; prevX = this.txt.mouseX; prevY = this.txt.mouseY; Laya.stage.on(Event.MOUSE_MOVE, this, this.scrollText); Laya.stage.on(Event.MOUSE_UP, this, this.finishScrollText); } /* 停止滚动文本 */ finishScrollText(e) { const Event = Laya.Event; La...

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

5. 其他引擎的Demo-Example_21 [ 78%]

...th.length = 0; } onMouseMove() { if (!isDown) return; path.push(Laya.stage.mouseX); path.push(Laya.stage.mouseY); } onMouseUp() { isDown = false; canvasGraphics.drawPoly(0, 0, path.concat(), color); } animate() { liveGraphics.clear(); liveGraphics.drawPoly(0, 0, path, color); } } new PIXI_Example_21...

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

6. 区块地图-等角地图 [ 77%]

...取选中格子的索引 this.layer.getTilePositionByScreenPos(Laya.stage.mouseX, Laya.stage.mouseY, p); // 通过地图坐标得到屏幕坐标 this.layer.getScreenPositionByTilePos(Math.floor(p.x), Math.floor(p.y), p); this.sprite.pos(p.x, p.y); } mapLoaded() { this.layer = this.tiledMap.getLayerB...

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

7. 屏幕适配-屏幕适配 [ 72%]

... ")"; } onClick(e) { //输出坐标信息 console.log("mouse:", Laya.stage.mouseX, Laya.stage.mouseY); } onResize() { //输出当前适配模式下的stage大小 console.log("size:", Laya.stage.width, Laya.stage.height); } } new SmartScale_T();module laya { import Sprite = Laya.Sprite; import Stage ...

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

8. 2D物理-桥 [ 70%]

...leCollider); circleCollider.radius = 5; circleCollider.x = Laya.Laya.stage.mouseX; circleCollider.y = Laya.Laya.stage.mouseY; let circlePosx = circleCollider.x / Laya.Physics.PIXEL_RATIO; let circlePosy = circleCollider.y / Laya.Physics.PIXEL_RATIO; let velocityX = targetX - circlePosx; let velocity...

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

9. 2D物理-碰撞过滤器 [ 55%]

... = movementX; this.preMovementY = movementY; this.curTarget.pos(Laya.stage.mouseX, Laya.stage.mouseY); } mouseUp() { Laya.stage.off(Event.MOUSE_MOVE, this, this.mouseMove); Laya.stage.off(Event.MOUSE_UP, this, this.mouseUp); Laya.stage.off(Event.MOUSE_OUT, this, this.mouseUp); let rigidbody: RigidBo...

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

10. 2D物理-仿生机器人 [ 49%]

...circleCollider.radius = 3 * this.scale; circleCollider.x = Laya.Laya.stage.mouseX; circleCollider.y = Laya.Laya.stage.mouseY; let circlePosx = circleCollider.x / Laya.Physics.PIXEL_RATIO; let circlePosy = circleCollider.y / Laya.Physics.PIXEL_RATIO; let velocityX = chassisPos.x - circlePosx; let vel...

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