查看: 2717|回复: 2

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

[复制链接]
梦石
0
星屑
362
在线时间
36 小时
注册时间
2018-12-29
回帖
26
发表于 2019-3-15 15:38:23 | 显示全部楼层 |阅读模式

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

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

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

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

[pre lang="javascript"]
    if (this._commandWindow._quiting) {

        if (this._commandWindow.y > 52)
            this._commandWindow.y -= 5;
            this._commandWindow.opacity -= 50 ;
            this._commandWindow.contents.paintOpacity -=50 ;
            this._goldWindow.opacity -= 50 ;            
            this._goldWindow.contents.paintOpacity -=50 ;

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

        if (this._commandWindow.y != 10) {

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

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

        }
    }[/pre]

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

求教如何控制文字的透明度……
/  w\ 大家好我是飞剑Flysword,正在学习写js代码,希望能早日做出来自己的小游戏嘿嘿
梦石
0
星屑
538
在线时间
37 小时
注册时间
2017-12-16
回帖
29
发表于 2019-3-15 16:44:54 | 显示全部楼层
本帖最后由 blue_ku 于 2019-3-15 16:46 编辑
  1. contentsOpacity Number
复制代码

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

使用道具 举报

梦石
0
星屑
362
在线时间
36 小时
注册时间
2018-12-29
回帖
26
 楼主| 发表于 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代码,希望能早日做出来自己的小游戏嘿嘿
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部