function random(no) {
var dots = [
[0, 0],
[0, height],
[width, 0],
[width, height]
];
for (var i = 0; i < no / 20; i++) {
dots.push([0, Math.random() * height]);
dots.push([Math.random() * width, height]);
dots.push([width, Math.random() * height]);
dots.push([Math.random() * width, 0]);
}
for (var i = 0; i < no - no / 20; i++) {
dots.push([Math.random() * width, Math.random() * height]);
}
return dots;
}
function spiral(no, factor) {
var dots = [];
no = no || 1000;
factor = factor || 1;
for (i = 0; i < no; i++) {
angle = factor * i;
x = (20 + angle) * Math.cos(angle);
y = (40 + angle) * Math.sin(angle);
dots.push([x + width / 2, y + height / 2]);
}
return dots;
};
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.