javascript - raphael.js 笔划/路径宽度似乎不起作用

标签 javascript raphael graphael

我正在胡思乱想,无法控制路径宽度。

看到倒数第二行,真是莫名其妙:

var paper = Raphael(20, 20, 320, 320);

  function arc(center, radius, startAngle, endAngle) {
      angle = startAngle;
      coords = toCoords(center, radius, angle);
      path = "M " + coords[0] + " " + coords[1];
      while(angle<=endAngle) {
          coords = toCoords(center, radius, angle);
          path += " L " + coords[0] + " " + coords[1];
          angle += 1;
      }
      return path;
  }

  function toCoords(center, radius, angle) {
      var radians = (angle/180) * Math.PI;
      var x = center[0] + Math.cos(radians) * radius;
      var y = center[1] + Math.sin(radians) * radius;
      return [x, y];
  }
  var ps = paper.path(arc([100, 100], 80, -90, 90));
  ps.attr({stroke:'#C00',width:100});
  ps.glow({color: '#f00',width: 20});​

这是 fiddle :

http://jsfiddle.net/U5Kpx/5/

谁能看出我在这里做错了什么?

非常感谢

最佳答案

你应该使用 stroke-width

例如:

ps.attr({stroke:'#C00',"stroke-width":5});
ps.glow({color: '#f00',width: 40});​

检查这个fiddle

关于javascript - raphael.js 笔划/路径宽度似乎不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11426824/

相关文章:

javascript - gRaphael图书馆: Can't Create Line Chart

javascript - knockout 可观察到未受到约束

来自 php json_encode 的数据出现 javascript parse.json 错误

javascript - 双花括号在页面中呈现,并且不被绑定(bind)值替换

javascript - 传单:将 RaphaelLayer 用于 Raphael JS

javascript - Raphael ID 在 iPad 上与在浏览器上不同

javascript - gRaphael Js : where can I find tutorials to produce data charts (pie, 条等)

javascript - 联系表格 7 : display/hide div on selection

javascript - 单击后删除 SVG 元素

javascript - gRaphael 饼图动态大小