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

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

1. 鼠标交互-鼠标交互 [ 100%]

... = (Laya.stage.height - 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, t...

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

2. 计时器-延迟执行 [ 97%]

...ter"); return button; } function onDecreaseAlpha1(e) { //移除鼠标单击事件 button1.off(Event.CLICK, this, onDecreaseAlpha1); //定时执行一次(间隔时间) Laya.timer.once(3000, this, onComplete1); } function onDecreaseAlpha2(e) { //移除鼠标单击事件 button2.off(Event.CLICK, this, ...

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

3. 屏幕适配-屏幕适配 [ 92%]

...y2.on("click", this, onBoyClick); Laya.stage.addChild(boy2); //侦听点击事件,输出坐标信息 Laya.stage.on("click", this, onClick); Laya.stage.on("resize", this, onResize); })(); function onBoyClick(e) { //点击后小人会放大缩小 var boy = e.target; if (boy.scaleX === 1) { boy.scale...

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

4. 鼠标交互-自定义事件 [ 87%]

...ya.stage.addChild(sp); sp.on(ROTATE, this, onRotate); // 侦听自定义的事件 sp.on(Event.CLICK, this, onSpriteClick); } function onSpriteClick(e) { var randomAngle = Math.random() * 180; //发送自定义事件 sp.event(ROTATE, [randomAngle]); } // 触发自定义的rotate事件 function onRota...

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