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

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

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

...); // 设置舞台 Laya.stage.name = "暗灰色舞台" Laya.stage.on(Event.MOUSE_DOWN, this, onDown); } function createCoralRect() { var coralRect = new Sprite(); coralRect.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height / 2, "#FF7F50"); //设置名称 coralRect.name = "珊瑚色容器";...

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

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

... - 200) / 2; Laya.stage.addChild(rect); //增加鼠标事件 rect.on(Event.MOUSE_DOWN, this, mouseHandler); rect.on(Event.MOUSE_UP, this, mouseHandler); rect.on(Event.CLICK, this, mouseHandler); rect.on(Event.RIGHT_MOUSE_DOWN, this, mouseHandler); rect.on(Event.RIGHT_MOUSE_UP, this, mouseHandler); r...

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

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

...ge.width / 2, Laya.stage.height / 2); Laya.stage.addChild(sp); sp.on(Event.MOUSE_DOWN, this, onMouseDown); } function onMouseDown(e) { var touches = e.touches; if (touches && touches.length == 2) { preRadian = Math.atan2( touches[0].stageY - touches[1].stageY, touches[0].stageX - touches[1].stageX);...

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

4. 区块地图-滚动地图 [ 83%]

...caleMode = Stage.SCALE_FULL; Stat.show(); createMap(); Laya.stage.on(Event.MOUSE_DOWN, this, mouseDown); Laya.stage.on(Event.MOUSE_UP, this, mouseUp); })(); //创建地图 function createMap() { //创建地图对象 tiledMap = new TiledMap(); mX = mY = 0; //创建地图,适当的时候调用destor...

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

5. 鼠标交互-拖动 [ 83%]

... ape.x = Laya.stage.width / 2; ape.y = Laya.stage.height / 2; ape.on(Event.MOUSE_DOWN, this, onStartDrag); } function showDragRegion() { //拖动限制区域 var dragWidthLimit = 350; var dragHeightLimit = 200; dragRegion = new Rectangle(Laya.stage.width - dragWidthLimit >> 1, Laya.stage.height - dr...

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

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

...ge.width / 2, Laya.stage.height / 2); Laya.stage.addChild(sp); sp.on(Event.MOUSE_DOWN, this, onMouseDown); } function onMouseDown(e) { var touches = e.touches; if (touches && touches.length == 2) { lastDistance = getDistance(touches); Laya.stage.on(Event.MOUSE_MOVE, this, onMouseMove); } } function ...

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

7. 鼠标交互-Hold [ 82%]

...pe.scale(0.8, 0.8); Laya.stage.addChild(ape); // 鼠标交互 ape.on(Event.MOUSE_DOWN, this, onApePress); } function onApePress(e) { // 鼠标按下后,HOLD_TRIGGER_TIME毫秒后hold Laya.timer.once(HOLD_TRIGGER_TIME, this, onHold); Laya.stage.on(Event.MOUSE_UP, this, onApeRelease); } function onH...

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

8. 鼠标交互-滑动 [ 80%]

...idth - TrackLength) / 2; button.y = Laya.stage.height / 2; button.on(Event.MOUSE_DOWN, this, onMouseDown); Laya.stage.addChild(button); //左侧临界点设为圆形初始位置 beginPosition = button.x; //右侧临界点设置 endPosition = beginPosition + TrackLength; } function drawTrack() { var ...

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

9. 文本-滚动文本 [ 79%]

...ntSize = 20; txt.color = "#ffffff"; Laya.stage.addChild(txt); txt.on(Event.MOUSE_DOWN, this, startScrollText); } /* 开始滚动文本 */ function startScrollText(e) { prevX = txt.mouseX; prevY = txt.mouseY; Laya.stage.on(Event.MOUSE_MOVE, this, scrollText); Laya.stage.on(Event.MOUSE_UP, this, finis...

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