View unanswered posts | View active topics It is currently 2022-12-07 12:10



Reply to topic  [ 6 posts ] 
 label.alpha这个样式怎么才能生效 
Author Message
新手上路

Joined: 2016-11-11 8:12
Posts: 30
Post label.alpha这个样式怎么才能生效
我试了一下,根本没效果啊。。来个demo可以吗或者


2017-05-16 17:24
Profile
TWaver开发组
User avatar

Joined: 2017-02-22 10:01
Posts: 487
Post Re: label.alpha这个样式怎么才能生效
Code:
<!DOCTYPE html>
<html>

  <head>
    <meta charset="UTF-8">
    <title>TWaver HTML5</title>
    <script src="twaver.js"></script>
    <script type="text/javascript">
      var box = new twaver.ElementBox();
      var network = new twaver.network.Network(box);

      function init() {
        document.body.appendChild(network.getView());
        network.adjustBounds({
          x: 0,
          y: 0,
          width: 500,
          height: 500
        });
        initBox();
      }

      function initBox() {
        var node1 = new twaver.Node();
        node1.setName('node1');
        node1.setLocation(400, 100);
        node1.setStyle('label.alpha', 0.1);
        box.add(node1);
        var node2 = new twaver.Node();
        node2.setName('node2');
        node2.setLocation(100, 400);
        node2.setStyle('label.alpha', 1);
        box.add(node2);
      }
    </script>
  </head>

  <body onload="init()">
  </body>

</html>


2017-05-16 18:12
Profile
新手上路

Joined: 2016-11-11 8:12
Posts: 30
Post Re: label.alpha这个样式怎么才能生效
上面给的方法就是我用的方法,我这边还是无效。。。。请问你的效果图是怎么样的。。可以截图看看嘛


2017-05-22 7:52
Profile
TWaver开发组
User avatar

Joined: 2017-02-22 10:01
Posts: 487
Post Re: label.alpha这个样式怎么才能生效
你可以把你代码贴出来。


Attachments:
WX20170522-090222.png
WX20170522-090222.png [ 9.54 KiB | Viewed 7382 times ]
2017-05-22 9:04
Profile
新手上路

Joined: 2016-11-11 8:12
Posts: 30
Post Re: label.alpha这个样式怎么才能生效
求回复。。。我找到原因了。。因为楼上给出的例子是用了new twaver.network.Network(box);
而我用的是new twaver.vector.Network(box);
就因为这样就不行了。。。请问有没有解决办法。。。。我必须用vector才行,不然很多地方都有问题。。谢过。。有解决方案吗


2017-05-23 15:41
Profile
TWaver开发组
User avatar

Joined: 2017-02-22 10:01
Posts: 487
Post Re: label.alpha这个样式怎么才能生效
node.setStyle('label.color', 'rgba(208,32,144,0.1)');//后面0.1代表透明度。


2017-05-24 9:46
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
./cache/ is NOT writable.