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

大约有 19 项符合查询结果, 库内数据总量为 31,560 项。 (搜索耗时: 0.0020 秒)

1. Sprite-轴心点 [ 100%]

...ript三种开发语言、LayaAirIDE让项目开发更高效。class Sprite_Pivot { constructor() { const Browser = Laya.Browser, WebGL = Laya.WebGL, Stage = Laya.Stage; // 不支持WebGL时自动切换至Canvas Laya.init(Browser.clientWidth, Browser.clientHeight, WebGL); Laya.stage.alignV = Stage.AL...

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

2. 缓动-简单的Tween [ 94%]

...aracterA = this.createCharacter("res/cartoonCharacters/1.png"); characterA.pivot(46.5, 50); characterA.y = 100; let characterB = this.createCharacter("res/cartoonCharacters/2.png"); characterB.pivot(34, 50); characterB.y = 250; Laya.stage.graphics.drawLine(terminalX, 0, terminalX, Laya.stage.height,...

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

3. Sprite-节点控制 [ 93%]

...s.ape1.loadImage(monkey2Path); this.ape2.loadImage(monkey2Path); this.ape1.pivot(55, 72); this.ape2.pivot(55, 72); this.ape1.pos(Laya.stage.width / 2, Laya.stage.height / 2); this.ape2.pos(200, 0); // 一只猩猩在舞台上,另一只被添加成第一只猩猩的子级 Laya.stage.addChild(this.a...

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

4. 动画-图集动画 [ 82%]

... // 获取动画的边界信息 let bounds = ani.getGraphicBounds(); ani.pivot(bounds.width / 2, bounds.height / 2); ani.pos(Laya.stage.width / 2, Laya.stage.height / 2); } } new Animation_Altas();module laya { import Animation = Laya.Animation; import Stage = Laya.Stage; import Rectangle = Laya.Rec...

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

5. Sprite-旋转缩放 [ 82%]

...e.addChild(this.ape); this.ape.loadImage("res/apes/monkey2.png"); this.ape.pivot(55, 72); // this.ape.pos( Laya.stage.width / 2, Laya.stage.height / 2); this.ape.x = Laya.stage.width / 2; this.ape.y = Laya.stage.height / 2; this.scaleDelta = 0; Laya.timer.frameLoop(1, this, this.animate); } animate(...

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

6. Sprite-容器 [ 80%]

... this.apesCon.addChild(ape); ape.loadImage(`res/apes/monkey${i}.png`); ape.pivot(55, 72).pos( Math.cos(radianUnit * i) * layoutRadius, Math.sin(radianUnit * i) * layoutRadius ); } this.apesCon.pos(Laya.stage.width / 2, Laya.stage.height / 2); Laya.timer.frameLoop(1, this, this.animate); } animate() ...

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

7. 计时器-间隔循环 [ 79%]

...ext(); t.text = text; t.fontSize = 30; t.color = "white"; t.bold = true; t.pivot(t.width / 2, t.height / 2); t.pos(x, y); Laya.stage.addChild(t); return t; } animateTimeBased() { this.rotateTimeBasedText.rotation += 1; } animateFrameRateBased() { this.rotateFrameRateBasedText.rotation += 1; } } new ...

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

8. 鼠标交互-自定义事件 [ 78%]

...ew Sprite(); this.sp.graphics.drawRect(0, 0, 200, 200, "#D2691E"); this.sp.pivot(100, 100); this.sp.x = Laya.stage.width / 2; this.sp.y = Laya.stage.height / 2; this.sp.size(200, 200); Laya.stage.addChild(this.sp); this.sp.on(ROTATE, this, this.onRotate); // 侦听自定义的事件 this.sp.on(Event...

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

9. Sprite-遮罩-放大镜 [ 78%]

...sk let maskSp = new Sprite(); maskSp.graphics.drawTexture(maskRes); maskSp.pivot(50, 50); // 设置mask bg2.mask = maskSp; 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; })...

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

10. Sprite-切换纹理 [ 77%]

...tr); this.ape = new Laya.Sprite(); Laya.stage.addChild(this.ape); this.ape.pivot(55, 72); this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2); this.switchTexture(); this.ape.on(Laya.Event.CLICK, this, this.switchTexture); } switchTexture() { let monkey = (this.flag = !this.flag) ? monkey1Res :...

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