/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.qRLZY8Ed1J9/rev.1622
*
* authors:
* ManaT
*
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
int i, j;
int count;
int[] primes = {1,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499};
void setup() {
size(300,300);
background(255);
strokeWeight(0.4);
i = 0;
j = 0;
count = primes.length-1;
}
void draw() {
translate(-100,-100);
if (count >= 0) {
for (int k = 0; k < 20; k++) {
if (i < 2000) {
stroke(i/4, 50, 100, 60);
PVector v1 = getPVectorFromInt((i)%2000);
PVector v2 = getPVectorFromInt((i+500+primes[count])%2000);
line(v1.x, v1.y, v2.x, v2.y);
i += 25;
} else {
i = 0;
count--;
}
}
}
if (j < 1000) {
stroke(200, 200, 200, 255);
line(j,0,0,j);
line(500-j,0,500,j);
j += 20;
}
}
PVector getPVectorFromInt(int i) {
if (i < 500) return new PVector(0, i);
if (i < 1000) return new PVector(i-500, 500);
if (i < 1500) return new PVector(500, 1500-i);
if (i < 2000) return new PVector(2000-i, 0);
}