IIAB - Circular/Aperta Principium #2
This NFT includes the code for running the program that created it, in the description. The program generates random 1/1 circular line art.
Owners can use this code to experience a unique digital creation. Download Processing at https://processing.org/download to run the code.
________________
// Circular Aperta Principium
int numLines; // maximum number of lines to draw
float lineLength; // initial line length
boolean saved = false; // flag to track whether the image has been saved
void setup() {
size(800, 800);
numLines = int(random(50, 100)); // random number of lines
lineLength = random(100, 300); // random line length
}
void draw() {
if (!saved) { // only draw and save the image once
background(0);
stroke(random(0, 255), random(0, 255), random(0, 255), random(100, 255)); // random color with opacity
strokeWeight(2);
translate(width/2, height/2);
float angleStep = TWO_PI / numLines; // angle increment for each line
float lineStep = random(5, 20); // random length increment for each line
float lineThickness = random(1, 5); // random initial line thickness
float thicknessStep = lineThickness / numLines; // thickness increment for each line
for (int i = 0; i < numLines; i++) {
float angle = i * angleStep + random(-0.1, 0.1); // add a small random angle variation
float x1 = lineLength * cos(angle);
float y1 = lineLength * sin(angle);
float x2 = (lineLength - lineStep * i) * cos(angle);
float y2 = (lineLength - lineStep * i) * sin(angle);
line(x1, y1, x2, y2);
strokeWeight(max(0, lineThickness - thicknessStep * i));
}
saved = true;
selectOutput("Save image as:", "saveImage");
}
}
void saveImage(File selectedFile) {
if (selectedFile != null) {
save(selectedFile.getAbsolutePath());
}
saved = false; // reset the flag so that the image can be saved again in the next run
}
There are 1 token holders
Rich List