最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - raphael.js strokepath width doesnt seem to work - Stack Overflow

programmeradmin0浏览0评论

I'm hacking at a fiddle and cannot control the path width.

see the 2nd last line, really baffling:

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

here's the fiddle:

/

can anyone see what I'm doing wrong here?

Thanks very much

I'm hacking at a fiddle and cannot control the path width.

see the 2nd last line, really baffling:

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

here's the fiddle:

http://jsfiddle/U5Kpx/5/

can anyone see what I'm doing wrong here?

Thanks very much

Share Improve this question asked Jul 11, 2012 at 6:31 AlexAlex 3,7915 gold badges40 silver badges60 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

You should use stroke-width

eg:

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

Check this fiddle

发布评论

评论列表(0)

  1. 暂无评论