jTopo学习笔记2——节点元素

var textNode = new JTopo.TextNode('This is a text node.'); // 文本节点

var linkNode = new JTopo.LinkNode('超链接:http://www.jtopo.com'); // 链接节点

linkNode.target = '_blank'; // 新窗口打开链接

linkNode.font = 'italic bold 16px 微软雅黑';

linkNode.visitedColor = '0,0,255'; // 访问过的链接为蓝色

2.添加阴影

linkNode.shadow = true; // 默认值为false

linkNode.shadowOffsetX = 30; // 阴影设置

linkNode.shadowOffsetY = 30;

peopleNode.setBound(500, 210, 64, 64); // 同时设置大小及位置

3.添加圆形节点

var circleNode = new JTopo.CircleNode('node');

circleNode.radius = 24; // 半径

circleNode.fillColor = '0, 0, 255'; // 填充颜色

4.自定义绘制节点

var node = new JTopo.Node("自定义"); 

 node.percent = 0.8; 

 node.beginDegree = 0; 

 node.width = node.height = 60;

 node.setLocation(200, 210); 

 node.paint = function(g){ 

      g.beginPath();

      g.moveTo(0,0);

      g.fillStyle = 'rgba(0,255,0,' + this.alpha + ')'; 

      g.arc(0, 0, this.width/2, this.beginDegree, this.beginDegree + 2*Math.PI*this.percent);

      g.fill(); 

      g.closePath();

      g.save();

      g.beginPath();

      g.fillStyle = 'rgba(255,255,0,' + this.alpha + ')'; 

      g.moveTo(0,0);

      g.arc(0, 0, this.width/2-10, this.beginDegree, this.beginDegree + 2*Math.PI); 

      g.fill(); 

      g.closePath();

      g.restore();

      this.paintText(g); 

 }; 

 scene.add(node); 

 });


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值