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

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

1. Sprite-轴心点 [ 100%]

...e.width - gap) / 2, Laya.stage.height / 2); //设置轴心点为中心 sp1.pivot(55, 72); Laya.stage.addChild(sp1); //不设置轴心点默认为左上角 sp2 = new Sprite(); sp2.loadImage("../../res/apes/monkey2.png", 0, 0); sp2.pos((Laya.stage.width + gap) / 2, Laya.stage.height / 2); Laya.stage.a...

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

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

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

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

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

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

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

4. Sprite-旋转缩放 [ 85%]

...ape.loadImage("../../res/apes/monkey2.png"); Laya.stage.addChild(ape); ape.pivot(55, 72); ape.x = Laya.stage.width / 2; ape.y = Laya.stage.height / 2; Laya.timer.frameLoop(1, this, animate); } function animate(e) { ape.rotation += 2; //心跳缩放 scaleDelta += 0.02; var scaleValue = Math.sin(scale...

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

5. 动画-图集动画 [ 85%]

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

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

6. Sprite-容器 [ 83%]

...e = new Sprite(); ape.loadImage("../../res/apes/monkey" + i + ".png"); ape.pivot(55, 72); // 以圆周排列猩猩 ape.pos( Math.cos(radianUnit * i) * layoutRadius, Math.sin(radianUnit * i) * layoutRadius); apesCtn.addChild(ape); } apesCtn.pos(Laya.stage.width / 2, Laya.stage.height / 2); Laya.timer...

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

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

...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; } function animateTimeBased() { rotateTimeBasedText.rotation += 1; } function animateFrameRateBased() { rotateFrameRateBasedText.rotation += 1; ...

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

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

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

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

9. Sprite-切换纹理 [ 81%]

...ction onAssetsLoaded() { ape = new Sprite(); Laya.stage.addChild(ape); ape.pivot(55, 72); ape.pos(Laya.stage.width / 2, Laya.stage.height / 2); // 显示默认纹理 switchTexture(); ape.on("click", this, switchTexture); } function switchTexture() { var textureUrl = (flag = !flag) ? texture1 : textu...

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

10. Sprite-遮罩-放大镜 [ 81%]

...mask maskSp = new Sprite(); maskSp.loadImage("../../res/mask.png"); maskSp.pivot(50, 50); //设置mask bg2.mask = maskSp; Laya.stage.on("mousemove", this, onMouseMove); } function onMouseMove() { bg2.x = -Laya.stage.mouseX * 2; bg2.y = -Laya.stage.mouseY * 2; maskSp.x = Laya.stage.mouseX; maskSp.y =...

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