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

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

1. 2D物理-碰撞过滤器 [ 100%]

...,自己实现,可以实现更大程度的控制 // Laya.stage.on(Event.MOUSE_MOVE, this, this.mouseMove); // Laya.stage.on(Event.MOUSE_UP, this, this.mouseUp); // Laya.stage.on(Event.MOUSE_OUT, this, this.mouseUp); // let rigidbody = this.curTarget.getComponent(RigidBody); // rigidbody.type = "k...

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

2. 鼠标交互-滑动 [ 94%]

...{ const Event = Laya.Event; //添加鼠标移到侦听 Laya.stage.on(Event.MOUSE_MOVE, this, this.onMouseMove); buttonPosition = this.button.x; Laya.stage.on(Event.MOUSE_UP, this, this.onMouseUp); Laya.stage.on(Event.MOUSE_OUT, this, this.onMouseUp); } /**移到事件处理*/ onMouseMove(e) { this.b...

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

3. 文本-滚动文本 [ 94%]

...ent; 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; Laya.stage.off(Event.MOUSE_MOVE, this, this.scrollText...

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

4. 鼠标交互-鼠标交互 [ 90%]

...ndler); rect.on(Event.RIGHT_CLICK, this, this.mouseHandler); rect.on(Event.MOUSE_MOVE, this, this.mouseHandler); rect.on(Event.MOUSE_OVER, this, this.mouseHandler); rect.on(Event.MOUSE_OUT, this, this.mouseHandler); rect.on(Event.DOUBLE_CLICK, this, this.mouseHandler); rect.on(Event.MOUSE_WHEEL, thi...

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

5. 区块地图-滚动地图 [ 90%]

...ya.stage.mouseX; mLastMouseY = Laya.stage.mouseY; Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.mouseMove); } mouseMove() { let moveX = mX - (Laya.stage.mouseX - mLastMouseX), moveY = mY - (Laya.stage.mouseY - mLastMouseY); // 移动地图视口 this.tiledMap.moveViewPort(moveX, moveY); } mouseUp(...

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

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

...hes[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 == 2) { let nowRadian = Math.atan2( touches[0].stageY - touches[1].stageY, touches[0].stageX - touches[1].stageX...

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

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

...ngth == 2) { lastDistance = this.getDistance(touches); Laya.stage.on(Event.MOUSE_MOVE, this, this.onMouseMove); } } onMouseMove(e) { let distance = this.getDistance(e.touches); //判断当前距离与上次距离变化,确定是放大还是缩小 const factor = 0.01; this.sp.scaleX += (distance - ...

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

8. UI-RefreshList [ 52%]

...tage.mouseY)); //鼠标按下的时候进行移动侦听 e.target.on(Event.MOUSE_MOVE, this, this.onItemBoxMouseMove, [e.target, index]); } } if (e.type == Event.MOUSE_UP) { this.mouseDown = false; this.itemOnMouseUp(); } //点击标记文本 if (e.target.name == "flag" && e.type == Event.CLICK) thi...

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