Created
April 5, 2020 02:22
-
-
Save moziauddin/afa64c58504c186234967f4a44baa723 to your computer and use it in GitHub Desktop.
Processing curves examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float rate = 2; // Change pow to int and fraction | |
void setup() { | |
size(400,400); | |
} | |
void draw() { | |
for(int x = 0; x< width; x++) { | |
float n = norm(x, 0, width); // Create a Range | |
float c = n * 255; | |
stroke(c); | |
line(x, 0, x, height / 2); | |
float cSq = pow(c, rate) * 255; | |
stroke(cSq); | |
line(x, height / 2, x, height); | |
} | |
} | |
float rate = 4; // Change pow to int and fraction | |
void setup() { | |
size(400,400); | |
noFill(); | |
} | |
void draw() { | |
for(int x = 0; x< width; x+=5) { | |
float n = norm(x, 0, width); // Create a Range | |
float y = pow(n, rate); // Compute curve | |
y*=height; // Scalte to height | |
strokeWeight(n * 5); | |
ellipse(x, y, width + rate * 100, height + rate * 100); | |
} | |
} | |
float rate = 2; // Change pow to int and fraction | |
void setup() { | |
size(400,400); | |
} | |
void draw() { | |
for(int x = 0; x< width; x++) { | |
float n = norm(x, 0, width); | |
float y = pow(n, rate); | |
y*=height; | |
point(x, y); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment