Skip to content

Instantly share code, notes, and snippets.

@anotherjesse
Created July 3, 2019 16:11
Show Gist options
  • Select an option

  • Save anotherjesse/a17f50dc4cc27e892ba601649692805c to your computer and use it in GitHub Desktop.

Select an option

Save anotherjesse/a17f50dc4cc27e892ba601649692805c to your computer and use it in GitHub Desktop.
var width, height, center;
var points = 10;
var smooth = true;
initializePath(500, 100, 200);
function initializePath(num_rays, radius, length) {
center = view.center;
width = view.size.width;
height = view.size.height/2;
for (var i=0; i<num_rays; i++) {
var theta = (i/num_rays)*3.14*2;
console.log(theta)
var path = new Path();
path.strokeColor = 'black';
path.add(new Point(center.x + radius*Math.sin(theta),
center.y + radius*Math.cos(theta)));
var outerRadius = radius+length*(Math.random()+1.0)
path.add(new Point(center.x + outerRadius*Math.sin(theta),
center.y + outerRadius*Math.cos(theta)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment