Skip to content

Instantly share code, notes, and snippets.

@behreajj
behreajj / clrGrad_1_1.pde
Created June 25, 2017 14:48
Color Gradients 1-1
color red = 0xffff0000;
println(red);
println(hex(red));
@behreajj
behreajj / clrGrad_1_2.pde
Last active June 25, 2017 23:17
Color Gradients 1-2
color red = color(255, 0, 0);
color blue = color(0, 0, 255);
int margin = 64;
int left = margin;
int top = margin;
int right = width - margin;
int bottom = height - margin;
size(512, 256);
@behreajj
behreajj / clrGrad_1_3.pde
Last active June 25, 2017 23:18
Color Gradients 1-3
for (int i = left; i <= right; ++i) {
stroke(lerpColor(red, blue, (i - left) / float(right - left)));
line(i, top, i, bottom);
}
@behreajj
behreajj / clrGrad_1_4.pde
Last active June 25, 2017 23:22
Color Gradients 1-4
color blue = 0xff0000ff;
color magenta = 0xffff00ff;
color red = 0xffff0000;
color yellow = 0xffffff00;
color startc;
color stopc;
float margin = 32;
float left = margin;
float right;
@behreajj
behreajj / clrGrad_1_5.pde
Last active June 27, 2017 14:11
Color Gradients 1-5
color red = 0xffff0000;
color yellow = 0xffffff00;
float centerX = 256;
float centerY = 128;
float innerDiam = 32;
float outerDiam = 512;
size(512, 256);
background(255);
@behreajj
behreajj / clrGrad_1_6.pde
Last active June 25, 2017 23:23
Color Gradients 1-6
color green = 0x3f00ff00;
color red = 0x3fff0000;
float centerXStart = 256;
float centerYStart = 128;
float centerXStop = 128;
float centerYStop = 64;
float innerDiam = 32;
float outerDiam = 512;
float detail = 30;
@behreajj
behreajj / clrGrad_1_7.pde
Created June 25, 2017 15:25
Color Gradients 1-7
size(512, 256);
loadPixels();
int len = pixels.length;
float h = float(height);
float w = float(width);
float diamonds = TWO_PI * 8;
float red;
float green;
@behreajj
behreajj / clrGrad_1_8.pde
Created June 25, 2017 15:50
Color Gradients 1-8
PImage bkg;
color px;
float centerX;
float centerY;
float run;
float rise;
float distSq;
float invDist;
@behreajj
behreajj / clrGrad_1_9.pde
Created June 25, 2017 16:02
Color Gradients 1-9
size(512, 256, P2D);
color start = 0xff00ffff;
color stop = 0xffff00ff;
color clear = 0x00ffff00;
float count = 64;
float centerX = width * 0.5;
float centerY = height * 0.5;
float stopRad = max(centerX, centerY) - 2.5;
@behreajj
behreajj / clrGrad_2_1.pde
Created June 25, 2017 16:40
Color Gradients 2-1
class ColorStop implements Comparable<ColorStop> {
float percent;
color clr;
ColorStop(float prc, float v1, float v2, float v3) {
this(prc, color(v1, v2, v3));
}
ColorStop(float prc, float v1, float v2, float v3, float al) {
this(prc, color(v1, v2, v3, al));