-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweightedLines
More file actions
29 lines (23 loc) · 830 Bytes
/
weightedLines
File metadata and controls
29 lines (23 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import processing.svg.*;
void setup() {
size(500, 750);
stroke(0);
randomSeed(millis()); // Seed the random number generator with the current time
beginRecord(SVG, getClass().getName() + "_" +year() + "_" +month() + "_" +day() + ":" +hour() + "_" +minute() + "_" +second()+".svg"); //getClass is for getting the name of the sketch
//beginRecord(SVG, "filename.svg");
noLoop();
}
void draw() {
// Draw something good here
// Set the stroke color to black
// Draw 100 random lines
for (int i = 0; i < 100; i++) {
// Choose a random start and end point for the line
float x1 = random(0, width);
float y1 = random(0, height);
float x2 = random(0, width);
float y2 = random(height - 50, height); // Weight the end point towards the bottom of the canvas
// Draw the line
line(x1, y1, x2, y2);
}
}