【问题标题】:raphael.js stroke/path width doesnt seem to workraphael.js 中风/路径宽度似乎不起作用
【发布时间】:2012-07-11 14:55:14
【问题描述】:

我在玩小提琴,无法控制路径宽度。

看到最后第二行,真是莫名其妙:

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});​

这是小提琴:

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

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

非常感谢

【问题讨论】:

    标签: javascript raphael graphael


    【解决方案1】:

    你应该使用笔画宽度

    例如:

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

    查看fiddle

    【讨论】:

      猜你喜欢
      • 2021-05-11
      • 2013-10-11
      • 1970-01-01
      • 1970-01-01
      • 2013-06-30
      • 2012-12-12
      • 1970-01-01
      • 1970-01-01
      • 2022-06-10
      相关资源
      最近更新 更多