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

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

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

...eractiveTarget(); this.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.st...

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

2. 屏幕适配-屏幕适配 [ 94%]

... = 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 = ["noscale", "exactfit", "showall", "noborder", "full", "fixedwidth", "fixedheig...

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

3. 计时器-延迟执行 [ 94%]

...ya.stage.bgColor = "#232628"; Stat.show(); this.setup(); } setup() { const Event = Laya.Event; let vGap = 100; this.button1 = this.createButton("点我3秒之后 alpha - 0.5"); this.button1.x = (Laya.stage.width - this.button1.width) / 2; this.button1.y = (Laya.stage.height - this.button1.height - v...

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

4. IDE-显示IDE创建的界面 [ 93%]

...发更高效。var Loader = Laya.Loader; var Handler = Laya.Handler; var Event = Laya.Event; // 创建TestPageUI的子类 function TestUI() { TestUI.super(this); //btn是编辑器界面设定的,代码里面能直接使用,并且有代码提示 this.btn.on(Event.CLICK, this, onBtnClick); this.bt...

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

5. 音频-播放演示 [ 90%]

...ya.stage.bgColor = "#232628"; Stat.show(); this.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.s...

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

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

...项目开发更高效。const ROTATE = "rotate"; class Interaction_CustomEvent { constructor() { const Browser = Laya.Browser, WebGL = Laya.WebGL, Stage = Laya.Stage, Stat = Laya.Stat, Handler = Laya.Handler; // 不支持WebGL时自动切换至Canvas Laya.init(Browser.clientWidth, Browser.clientHeig...

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

7. 2D物理-仿生机器人 [ 81%]

...LE_FIXED_AUTO; Laya.Laya.stage.bgColor = "#232628"; this.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 = gr...

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

8. 2D物理-复合碰撞器 [ 78%]

...LE_FIXED_AUTO; Laya.Laya.stage.bgColor = "#232628"; this.createBox(); this.eventListener(); } createBox() { const width = 300, height = 20; const posx = Laya.Browser.width / 2, posy = Laya.Browser.height / 2; let box = this.box = new Laya.Sprite(); box.size(width + height * 2, width + height * 2); b...

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

9. Sprite-屏幕截图 [ 76%]

...ar btn = new Laya.Button(skin,name); Laya.stage.addChild(btn); btn.on(Laya.Event.CLICK,this,cb); btn.size(147,55); btn.name = name; btn.right = 10; btn.top = index * (btn.height + 10); return btn; } onLoaded(){ for (let index = 0; index = ["res/button.png", "res/button.png", "res/button.png"]; priva...

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

10. UI-RefreshList [ 74%]

...种开发语言、LayaAirIDE让项目开发更高效。Stage = Laya.Stage; Event = Laya.Event; Box = Laya.Box; List = Laya.List; Handler = Laya.Handler; WebGL = Laya.WebGL; Animation = Laya.Animation; Label = Laya.Label; Text = Laya.Text; Point = Laya.Point; Tween = Laya.Tween; TextArea = Laya.TextA...

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