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

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

11. [分享]实现颜色渐变 [ 76%]

...etContext('2d'); var my_gradient = this.context.createLinearGradient(0,0,0,1136); //创建一个线性渐变 my_gradient.addColorStop(0,"#FF0000"); my_gradient.addColorStop(1,"#0000FF"); let sprite = new Laya.Sprite(); Laya.stage.addChild(sprite); sprite.graphics.drawRect(0,0,640,1136,my_gradient); ...

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

12. 用Transform和直接设置xy坐标的效果不一致 [ 75%]

...Text = new Laya.Text(); txt.text = "HELLO"; txt.color = "#ffffff"; txt.x = 1136 / 2, txt.y = 320; Laya.stage.addChild(txt);          txt = new Laya.Text(); txt.text = "HELLO"; txt.color = "#ffffff"; let mat = new Laya.Matrix(); mat.translate(1136 / 2, 320); txt.transform = mat; Laya.stage.ad...

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

13. 如何实现渐变填充对象呀? [ 75%]

...etContext('2d'); var my_gradient = this.context.createLinearGradient(0,0,0,1136); //创建一个线性渐变 my_gradient.addColorStop(0,"#FF0000"); my_gradient.addColorStop(1,"#0000FF"); let sprite = new Laya.Sprite(); Laya.stage.addChild(sprite); sprite.graphics.drawRect(0,0,640,1136,my_gradient); ...

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

14. 文本基础样式(JavaScript-LayaAir基础篇(JS)-文本) [ 75%]

... ![1](img/1.png) ![2](img/2.png) ```typescript //初始化引擎 Laya.init(1136,640); var txt = new Laya.Text(); //设置文本内容 txt.text = "hello_world"; //设置文本颜色 txt.color = "#ffffff"; Laya.stage.addChild(txt); ``` 这个时候我们就可以看到txt已经添加到舞台上了,...

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

15. 用native打包后输入框聚焦时,文本的位置有偏移 [ 74%]

...的代码上,因为我们是自己做的屏幕适配,在设计分辨率1136*640下,如果机型的屏幕分辨率的高宽比大于1136/640的情况下,会使stage有一个Y方向的偏移来达到居中的效果,引擎代码在计算输入框光标坐标的时候,这个Y方向的偏移...

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

16. Sprite-遮罩-放大镜 [ 74%]

...var bg2; (function() { // 不支持WebGL时自动切换至Canvas Laya.init(1136, 640, WebGL); Laya.stage.alignV = Stage.ALIGN_MIDDLE; Laya.stage.alignH = Stage.ALIGN_CENTER; Laya.stage.scaleMode = "showall"; Laya.stage.bgColor = "#232628"; Laya.loader.load("../../res/bg2.png", Handler.create(this, s...

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

17. 手机游戏,一般做多大分辨率的呀?? [ 74%]

...一半,为320*480,请问怎么解决? 有个需求,pc分辨率为1136x640,手机上分辨率为640x1136,这个要怎么实现? 如何获得浏览器的窗口分辨率 不同手机分辨率怎么适配 怎么根据分辨率加载不同资源 咨询一下.laya的分辨率为什么和物...

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

18. 文本基础样式(ActionScript-LayaAir基础篇(AS3)-文本) [ 74%]

...ss LayaSample { public function LayaSample() { //初始化引擎 Laya.init(1136, 640); var txt:Text = new Text(); txt.text = "hello_world"; txt.color = "#ffffff"; Laya.stage.addChild(txt); } } } ``` 这个时候我们就可以看到txt已经添加到舞台上了,显示了txt中 白色的hello_worl...

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

19. iPhone6 webgl渲染下sprite.loadimage加载不出canvas.toDateUrl [ 73%]

...载不出canvas.toDateUrl $("#ewm").qrcode({render:"canvas",width:parseInt(1136*0.3),height:parseInt(1136*0.3),correctLevel:0,text:textDz});//生成二维码图案 var t = new Texture(); t.load($("#ewm canvas")[0].toDataURL()); ewmSprit.graphics.drawTexture(t,0,0);//这样可以加载出来 --------...

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

20. 设置遮罩(ActionScript-LayaAir基础篇(AS3)-位图) [ 72%]

...Res:String; private var img:Sprite; public function MaskDemo() { Laya.init(1136,640); //设置舞台背景色 Laya.stage.bgColor = "#ffffff" //资源路径 Res = "res/img/monkey1.png"; //先加载图片资源,在图片资源加载成功后,通过回调方法绘制图片并添加到舞台 Laya.lo...

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