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

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

1. Sprite-缓存为静态图像 [ 100%]

... new Text(); textBox.addChild(text); text.fontSize = 20; text.text = (Math.random() * 100).toFixed(0); text.rotation = Math.random() * 360; text.color = "#ccc"; text.x = Math.random() * Laya.stage.width; text.y = Math.random() * Laya.stage.height; } //缓存为静态图像 textBox.cacheAs = "bitmap"...

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

2. 其他引擎的Demo-Example_23 [ 99%]

...r.life = 0; let pos1; let pos2; if (type % 2) { pos1 = new Point(-20, Math.random() * viewHeight); pos2 = new Point(viewWidth, Math.random() * viewHeight + 20); } else { pos1 = new Point(Math.random() * viewWidth, -20); pos2 = new Point(Math.random() * viewWidth, viewHeight + 20); } let distX = pos1...

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

3. 输入设备-贪吃蛇(重力感应) [ 86%]

...food.graphics.drawRect(0, 0, foodSize, foodSize, "#00BFFF"); food.x = Math.random() * Laya.stage.width; food.y = Math.random() * Laya.stage.height; } } class Segment extends Laya.Sprite { constructor(width, height) { super(); this.size(width, height); this.init(); } init() { this.graphics.drawRect(-...

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

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

...his.sp.on(Event.CLICK, this, this.onSpriteClick); } onSpriteClick(e) { let randomAngle = Math.random() * 180; //发送自定义事件 this.sp.event(ROTATE, [randomAngle]); } // 触发自定义的rotate事件 onRotate(newAngle) { const Tween = Laya.Tween, Ease = Laya.Ease; Tween.to(this.sp, { "rotati...

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

5. 其他引擎的Demo-Example_04 [ 73%]

...效。const Browser = Laya.Browser; let starCount = 2500, sx = 1.0 + (Math.random() / 20), sy = 1.0 + (Math.random() / 20), stars = [], w = Browser.width, h = Browser.height, slideX = w / 2, slideY = h / 2, speedInfo; class PIXI_Example_04 { constructor() { const WebGL = Laya.WebGL, Stage = Laya.Sta...

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

6. 2D物理-桥 [ 64%]

...et width = 20, height = 2.5; for (let i = 0; i { let targetX = (300 + Math.random() * 400) / Laya.Physics.PIXEL_RATIO, targetY = 500 / Laya.Physics.PIXEL_RATIO; let newBall = new Laya.Sprite(); Laya.Laya.stage.addChild(newBall); let circleBody = newBall.addComponent(Laya.RigidBody); circleBody.bulle...

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

7. 混合模式-Lighter [ 61%]

...).slice(-strLen); } private evalBgColor(): void { var color: number = Math.random() * 0xFFFFFF; var channels: Array = this.getColorChannals(color); this.bgColorTweener.to(this.bgColorChannels, { r: channels[0], g: channels[1], b: channels[2] }, this.gradientInterval, null, Handler.create(this, this....

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