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

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

471. [LayaAir 2.0] 如何用代码为Spirte添加2d物理特性 [ 78%]

...2d物理引擎文档都是IDE篇的。   class CollisionBoll extends Laya.Sprite { private _boll1:Laya.Sprite; constructor() { super(); //物理模块 this._boll1 = new Laya.Sprite(); this.addChild(this._boll1); this._boll1.x = 20; this._boll1.loadImage('comp/btn_close.png'); let box:laya.physics.B...

来源: Laya_社区 发布时间: 20190428

472. LayaAir和原生DOM交互(TypeScript-2D进阶篇(TS)-扩展模块) [ 78%]

...," + '' + '' + '' + 'I like ' + '' + 'cheese' + '' + '' + ''; var sp: Laya.Sprite = new Laya.Sprite(); sp.loadImage(data, 0, 0, 200, 200); Laya.stage.addChild(sp); } } new LayaUISample; ``` 通过data来当做url传递给loadImage这个方法引擎就会帮我们加载并解码显示出来。loadIma...

来源: Laya2.0_文档 发布时间: 20210715

473. 鼠标点击穿透问题 [ 78%]

...命!canvas定位后 点击区域偏移,求大大们解答 如何设置Sprite的宽高和点击区域? 关于使用matterjs物理引擎鼠标问题 ui list 里面的元素不能点击两次 关于适配采用showAll后留白部分的颜色问题 问题状态 最新活动: 2015-11-02 17:06 浏...

来源: Laya_社区 发布时间: 20151102

474. graphics使用matrix的异常情况 [ 77%]

... { var t = Laya.loader.getRes("../../res/apes/monkey2.png"); var ape = new Sprite(); ape.graphics.drawTexture(t, 0, 0); ape.graphics.scale(1.01, 1) Laya.stage.addChild(ape); ape.pos(200, 0); })); 上面这段代码并没有得到图片缩放的效果,看到的现象是图片一直在往左移动 201...

来源: Laya_社区 发布时间: 20170609

475. CPU优化方式(TypeScript-2D进阶篇(TS)-性能优化) [ 77%]

...。 1. 使用getBounds/ getGraphicBounds。 ```typescript var sp=new Laya.Sprite(); sp.graphics.drawRect(0,0,100,100,"#FF0000"); var bounds:Laya.Rectangle=sp.getGraphicBounds(); Laya.stage.addChild(sp); ``` getBounds可以满足多数多数需求,但由于其需要计算边界,不适合频繁调...

来源: Laya2.0_文档 发布时间: 20210714

476. 如何在游戏入口处获取对象的子对象 [ 77%]

....TiledMap; var Rectangle = Laya.Rectangle; var Handler = Laya.Handler; var Sprite = Laya.Sprite; var MapLayer = Laya.MapLayer; var loadMap = (function (_super) { function loadMap() { loadMap.super(this); } Laya.class(loadMap,"loadMap",_super); var _proto = loadMap.prototype; _proto.init = function()...

来源: Laya_社区 发布时间: 20170605

477. .lh 文件不能在同一js文件内重复引用吗? [ 77%]

...出了一个lh文件,打算复用。            var shelf0 = Laya.Sprite3D.load("DoorShelf/shelf.lh");            this.scene.addChild(shelf0);            shelf0.transform.translate(new Laya.Vector3(-4,1.2,35));            var shelf3 = Laya.Sprite3D.load("DoorShe...

来源: Laya_社区 发布时间: 20180301

478. 模拟石头下落过程不明抖动 [ 77%]

...me'; import Stage = Laya.Stage; export class TexasMain{ private balls:Laya.Sprite = ; constructor(){ Config.isAntialias = true // alert("宽"+Laya.Browser.clientWidth+"高"+Laya.Browser.clientHeight ); // Laya.init(Laya.Browser.clientWidth,Laya.Browser.clientHeight, Laya.WebGL ); Laya.init(720,1280,...

来源: Laya_社区 发布时间: 20180226

479. 【求助】关于Cannot read property 'visible' of undefined问题 [ 77%]

...题 我的代码是这样子的: private function showFoods():void{ foodSprite = new Sprite(); Laya.stage.addChild(foodSprite); this.index = 0; foodsList = new Array(); foodsList.push(new Food("菜品1", "1", 0)); foodsList.push(new Food("菜品2", "2", 1)); foodsList.push(new Food("菜品3", "3",...

来源: Laya_社区 发布时间: 20180405

480. 加上size设置后,精灵不能点击. [ 77%]

...行代码注释掉就正常了. function createImg(){ var img = new Laya.Sprite(); var r = Math.random(); var s = r > 0.66 ? "img/flower1.jpg" : r > 0.33 ? "img/flower2.png" : "img/flower3.jpg" img.loadImage(s); img.on(Laya.Event.CLICK, this, () => { img.y -= 10; }) img.pos(100, 300) Laya.s...

来源: Laya_社区 发布时间: 20180412