设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2003|回复: 2
打印 上一主题 下一主题

[有事请教] 求助:淡出窗口时只淡出了窗口框,中间文字没淡出

[复制链接]

Lv2.观梦者

梦石
0
星屑
362
在线时间
36 小时
注册时间
2018-12-29
帖子
35
跳转到指定楼层
1
发表于 2019-3-15 15:38:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
想自己写个小动画,让主菜单在退出时慢慢上浮然后淡出。

上浮做到了,但是淡出的时候用的opacity,结果只有边框淡出了,中间文字没有淡出

JAVASCRIPT 代码复制
  1. if (this._commandWindow._quiting) {
  2.  
  3.         if (this._commandWindow.y > 52)
  4.             this._commandWindow.y -= 5;
  5.             this._commandWindow.opacity -= 50 ;
  6.             this._commandWindow.contents.paintOpacity -=50 ;
  7.             this._goldWindow.opacity -= 50 ;            
  8.             this._goldWindow.contents.paintOpacity -=50 ;
  9.  
  10.         if (this._commandWindow.y < 55)
  11.             this.popScene();
  12.     } else {
  13.  
  14.         if (this._commandWindow.y != 10) {
  15.  
  16.             if (this._commandWindow.y < 82)
  17.                 this._commandWindow.y += 5;
  18.  
  19.             if (this._commandWindow.y > 82)
  20.                 this._commandWindow.y = 82;
  21.  
  22.         }
  23.     }


如代码,我尝试了  this.window.opacity,结果只有窗口边框淡出;去试了contents.paintopacity,结果文字仍然不淡出。

求教如何控制文字的透明度……
/  w\ 大家好我是飞剑Flysword,正在学习写js代码,希望能早日做出来自己的小游戏嘿嘿

Lv2.观梦者

梦石
0
星屑
538
在线时间
37 小时
注册时间
2017-12-16
帖子
31
2
发表于 2019-3-15 16:44:54 | 只看该作者
本帖最后由 blue_ku 于 2019-3-15 16:46 编辑
  1. contentsOpacity Number
复制代码

窗口内容的不透明度
爆ぜろリアル!弾けろシナプス!パニッシュメント......ディス、ワールド!
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
362
在线时间
36 小时
注册时间
2018-12-29
帖子
35
3
 楼主| 发表于 2019-3-15 23:11:45 | 只看该作者
blue_ku 发表于 2019-3-15 16:44
窗口内容的不透明度

感谢!!成功了!!opacity控制边框不透明度,contentsOpacity控制内容不透明度

  1.     if (this._commandWindow._quiting) {

  2.         if (this._commandWindow.y > 42)
  3.             this._commandWindow.y -= 5;
  4.             this._commandWindow.opacity -= 40 ;
  5.             this._commandWindow.contentsOpacity -=40 ;
  6.             this._goldWindow.opacity -= 40 ;            
  7.             this._goldWindow.contentsOpacity -=40 ;

  8.         if (this._commandWindow.y < 55)
  9.             this.popScene();
  10.     } else {

  11.         if (this._commandWindow.y != 82) {

  12.             if (this._commandWindow.y < 82)
  13.                 this._commandWindow.y += 5;

  14.             if (this._commandWindow.y > 82)
  15.                 this._commandWindow.y = 82;

  16.         }
  17.     }
复制代码



进游戏试了一下,没有问题,就是想要的效果,感谢!!!
/  w\ 大家好我是飞剑Flysword,正在学习写js代码,希望能早日做出来自己的小游戏嘿嘿
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-2 15:59

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表