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

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

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

...is.createLogger(); } createInteractiveTarget() { const Event = Laya.Event, Sprite = Laya.Sprite; let rect = new Sprite(); rect.graphics.drawRect(0, 0, 200, 200, "#D2691E"); rect.size(200, 200); rect.x = (Laya.stage.width - 200) / 2; rect.y = (Laya.stage.height - 200) / 2; Laya.stage.addChild(rect); ...

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

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

...n(Event.CLICK, this, this.onDecreaseAlpha2); } createButton(label) { const Sprite = Laya.Sprite; let w = 300, h = 60; let button = new Sprite(); Laya.stage.addChild(button); button.graphics.drawRect(0, 0, w, h, "#FF7F50"); button.size(w, h); button.graphics.fillText(label, w / 2, 17, "20px simHei", ...

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

3. 音频-播放演示 [ 94%]

...setup(); } setup() { const Event = Laya.Event; var gap = 10; //创建一个Sprite充当音效播放按钮 let soundButton = this.createButton("播放音效"); soundButton.x = (Laya.stage.width - soundButton.width * 2 + gap) / 2; soundButton.y = (Laya.stage.height - soundButton.height) / 2; //创建...

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

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

...age.width, Laya.stage.height); } } new SmartScale_T();module laya { import Sprite = Laya.Sprite; import Stage = Laya.Stage; import Text = Laya.Text; import Event = Laya.Event; import Image = Laya.Image; import WebGL = Laya.WebGL; export class SmartScale_T { //所有适配模式 private modes: Array ...

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

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

...age.bgColor = "#232628"; Stat.show(); this.setup(); } setup() { this.createSprite(); } createSprite() { const Sprite = Laya.Sprite, Event = Laya.Event; this.sp = new 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 =...

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

6. 2D物理-仿生机器人 [ 85%]

...s.Construct(); this.eventListener(); } Construct() { let ground = new Laya.Sprite(); Laya.Laya.stage.addChild(ground); let rigidbody = new Laya.RigidBody(); rigidbody.type = "static"; ground.addComponentIntance(rigidbody); let chainCollider = ground.addComponent(Laya.ChainCollider); chainCollider.po...

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

7. 2D物理-复合碰撞器 [ 83%]

...r.width / 2, posy = Laya.Browser.height / 2; let box = this.box = new Laya.Sprite(); box.size(width + height * 2, width + height * 2); box.pivot(box.width / 2, box.height / 2); box.pos(posx, posy); Laya.Laya.stage.addChild(box); let boxBody = box.addComponent(Laya.RigidBody); let box1Shape = box.add...

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

8. Sprite-屏幕截图 [ 79%]

...TypeScript三种开发语言、LayaAirIDE让项目开发更高效。class Sprite_ScreenShot { constructor() { const Browser = Laya.Browser, WebGL = Laya.WebGL, Stage = Laya.Stage; this.btnArr = ["res/threeDimen/ui/button.png", "res/threeDimen/ui/button.png", "res/threeDimen/ui/button.png"]; this.nam...

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

9. 2D物理-桥 [ 77%]

...teBridge() { const startPosX = 250, startPosY = 450; let ground = new Laya.Sprite(); Laya.Laya.stage.addChild(ground); let groundBody = new Laya.RigidBody(); groundBody.type = "static"; ground.addComponentIntance(groundBody); let chainCollider = ground.addComponent(Laya.ChainCollider); chainCollider...

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

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

...1.png", monkey2Str = "res/apes/monkey2.png", monkey1Res, monkey2Res; class Sprite_SwitchTexture { constructor() { const Browser = Laya.Browser, WebGL = Laya.WebGL, Stage = Laya.Stage; // 不支持WebGL时自动切换至Canvas Laya.init(Browser.clientWidth, Browser.clientHeight, WebGL); Laya.stage.al...

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