Skip to content

Instantly share code, notes, and snippets.

@roundrobin
Created February 6, 2013 08:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roundrobin/4721145 to your computer and use it in GitHub Desktop.
Save roundrobin/4721145 to your computer and use it in GitHub Desktop.
Variable Stroke width 2
{"description":"Variable Stroke width 2","endpoint":"","display":"svg","public":true,"require":[{"name":"Helpers","url":"https://raw.github.com/roundrobin/svg-path-generator/master/svg-path-generator.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"fullscreen":false,"thumbnail":"http://i.imgur.com/VJKXQdu.png"}
var svg = d3.select("svg");
function r(min, max) {
return Math.random() * (max - min) + min;
}
//Uses the svg-path-generator class
//https://github.com/roundrobin/svg-path-generator
var x=0,y=0;
for(var i=0; i < 26;i++){
var path = new Path(svg)
path.add(['m',x,y/5.12]);
path.el().attr({'stroke-width':i/2})
x = i*16;
y = i*18.12;
path.add(['L',x,y]);
path.render();
}
path.render();
path.showPoints()
console.log(path.el().node().pathSegList)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment