Skip to content

Instantly share code, notes, and snippets.

@moziauddin
Created April 5, 2020 02:22
Show Gist options
  • Save moziauddin/afa64c58504c186234967f4a44baa723 to your computer and use it in GitHub Desktop.
Save moziauddin/afa64c58504c186234967f4a44baa723 to your computer and use it in GitHub Desktop.
Processing curves examples
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