Skip to content

Instantly share code, notes, and snippets.

@grifdail
Created February 20, 2018 07:12
Show Gist options
  • Save grifdail/591c816b7e398f2efe4e186890bd394e to your computer and use it in GitHub Desktop.
Save grifdail/591c816b7e398f2efe4e186890bd394e to your computer and use it in GitHub Desktop.
the template i used with processing
color black = #000000;
color darkBlue = #1D2B53;
color darkPurple = #7E2553;
color darkGreen = #008751;
color brown = #AB5236;
color darkGray = #5F574F;
color lightGray = #C2C3C7;
color white = #FFF1E8;
color red = #FF004D;
color orange = #FFA300;
color yellow = #FFEC27;
color green = #00E436;
color blue = #29ADFF;
color indigo = #83769C;
color pink = #FF77A8;
color peach = #FFCCAA;
color[] palettePico8 = {
#000000,
#1D2B53,
#7E2553,
#008751,
#AB5236,
#5F574F,
#C2C3C7,
#FFF1E8,
#FF004D,
#FFA300,
#FFEC27,
#00E436,
#29ADFF,
#83769C,
#FF77A8,
#FFCCAA
};
color[] paletteRose = {#277256, #A8D889, #F34481, #FCCBCA, #FFEFF3};
color[] paletteWatermelon = {#c36864, #ff8482, #b6c363, #cee44a, #f1ffa0};
color[] paletteSable = {#DAECF6, #E7B961, #BD7D33, #9A5F3F, #5A2C1D};
color[] paletteCandy = {#FFF7F8, #FFA69E, #FF7E6B, #8C5E58, #A9F0D1};
color[] paletteJungle = {#e2e7d8, #a7da63, #614303, #f58810, #f24513};
color[] paletteSavana = {#3b5166, #fff275, #ff8c42, #ff3c38, #a23e48};
color[] palettePortal = {#D5DBEB, #0082C4, #005DDF, #F07716, #EE7F1B};
color[] palettePeach = {#F8F4D7, #F4DEC2, #F4B36C, #E98977, #F2B4A8};
color[] palettePoppies = {#EDE8E2, #C7D477, #4A362A, #CF1717, #F97B5F, #D3D3B2};
color[] paletteOcean = {#E8DBD7, #D4D8E7, #D4D8E7, #46A4C4, #3066AC, #C24540};
color[] paletteStrawberry = {#6BB053, #185F27, #CA233D, #AE192C, #6E202E};
color[] palettePink = {#F4EBBA, #F4E0B5, #F0B5B3, #F6839C, #FE64A3};
color[] paletteCobacabana = {#A44C89, #FF4B54, #FF7F42, #FEB13B};
color[] paletteBanana = {#D1FF79, #FF2B3A, #971C30, #51132A};
color[] paletteMarine = {#F8F5E3 ,#002746 , #174E79, #E57525, #614735};
color[] paletteBaobab = {#86AC81, #FFD2B2, #D25A59, #6A2E4D};
color[] paletteJeans = {#407ba5, #253447, #e0634d, #7e462b, #fcfcfc};
color[] paletteBlue = {#edeef3, #0000c0, #333ea2, #93b3ed, #000095, #155cbd, #7db3fb, #7db3fb};
color[] paletteFlower = {#FAC6D0, #EF8C8D, #FDF494, #709255, #416D05};
color[] paletteTired = {#a76b81, #e9dde0, #a093a6, #67687e, #4a535f};
color[] paletteSumer = {#c8cf7f, #eee099, #f7efc2, #fcbf89, #ff7280};
color[] paletteBeach = {#fffacc, #ffebba, #ffd0b5, #ffb2b2, #6dc9c9, #a5d8d8}; //Oh my god
color[] paletteApple = {#c59570, #d8b39a, #efefc3, #dee58a, #c3e54a};
color[] paletteUnderwater = {#d6f6b4, #a9e899, #44a682, #467d7f, #376d6d};
color[] paletteSunset = {#ffe054, #febc68, #f18f86, #c56d9d, #9967a4};
color[] paletteSoft = {#e1f4fa, #c8edff, #d2cffe, #f0cafd, #fdd8ea};
color[] paletteQueen = {#c01820, #d83840, #f05860, #981060, #700040};
color[] paletteDecay = {#504040, #908088, #b0a8b8, #d8d0e0, #c04850, #803840};
color[] paletteUsed = {#b1b26a, #8d824a, #63382d, #d28455, #f4d5a0};
color[] palettePurple = {#6180D6, #82A4FD, #F4AFF1, #BC7CDB, #484374};
color[] paletteSnowWhite = {#681514, #921911, #C1E7F5, #72CAF1, #49B7EC};
color[] paletteSahara = {#8B2A0E, #993513, #BB5026, #F88339, #A6C6F5};
color[] paletteIsland = {#5B2A1F, #BD7050, #A5A570, #C1DDF1, #8BB2DB};
color[] paletteStaryNight = {#0F1724, #12232D, #222A37, #394144, #564D42};
color[] palettePlayfull = {#BB95B7,#E4A4B0,#FCC1AE,#F2EEAE,#6FC6CA};
color[] palettePirate = {#4E1E22, #902D23, #0D3F2D, #051E33, #000524};
color[] paletteVegas = {#271A22,#34222D,#9F9CD9,#7673C2,#26223D};
color[] paletteModernArt = {#364B6F, #3E658E, #B7AC9F, #5A4E31, #443F28};
color[] paletteSweden = {#25778D, #7DACC1, #D69037, #BD7632, #8E512A};
color[] paletteCalifornia = {#38355B, #70608B, #D8678C, #F37571, #E99687};
color[] paletteMoon = {#051E3F, #193056, #445273, #9A899A, #B9A6AA};
color[] paletteNut = {#7c6743, #ffea7c, #d0db6b, #a8bc58, #88964e};
color[] paletteNeon = {#e032a0, #ee2afd, #ba3afc, #7c62fc, #5d8afc, #50abfd};
color[] paletteAtmospher = {#F88FE8, #FE75E1, #EA31CD, #701EA4, #3D2190};
color[] paletteIce = {#008BE3, #3BA7F5, #70BFFE, #9CD1FF, #BAE1FE};
color[] paletteEmerald = {#061B11,#022601, #265902, #65A603, #97D602};
color[] paletteGeometric = {#4A4759, #D99484, #F2BC8D, #D9CC8B, #0E0E0E};
color[] paletteRoad = {#ABA9D9, #D2B7BC, #94B7B8, #44A69C, #188C77};
color[] paletteBlueberry = {#1A243F,#3C5880, #7B97BE, #836871, #7B3438};
color[] palettePride = {#750787,#004dff,#008026,#ffed00,#ff8c00,#e40303};
color[] paletteYourName = {#0C1030,#085888, #88CDE4, #38478C, #5D2C74, #8E5D87, #3B3C81};
color[] paletteUrban = {#70C3C7,#7DB3CD, #608099, #728D7C, #B4ADCC, #DCC2A7};
color[] paletteEstrella = {#3A3462,#4D577A,#6E1E53,#E8AB96,#F3C3B9,#EFA7BB};
color[] paletteRPG = {#7CB4D5,#7FC8D1,#294644,#507446,#D3BB8B,#924440};
color[] paletteFirewatch = {#FFD5A3, #FD9D33, #B44633, #6A202D, #46152A, #311126};
color[] paletteGrandBudapest = {#76504F, #E29988, #EB7D80, #B98E87, #514859, #527A86};
color[] paletteSand = {#5F6A91, #D76A54, #FCEEBC, #3B3F5A, #F6C749};
color[] paletteVenon = {#684266, #442f56, #333559, #2a354c, #434d60};
color[] paletteCeramique = {#112625, #445C56, #889F8A, #CCD6D1, #D5CFC1, #ECE2DE};
color[] paletteCherry = {#BA2F27, #441825, #6A89B1, #C5C4D6, #DDD7E3, #EAE3E4};
color[] paletteWild = {#687DB6, #46425D, #515648, #D58659, #F2C285, #E1CCDE};
color[] paletteTowel = {#D1EAAF, #CED071, #CED071, #BC92A2, #D8C3D1, #C5C5C6};
color[] paletteLavender = {#F6DBE0, #E7EEE3, #D3D3F2, #7A7AD8, #564FA7, #705E8F};
color[] paletteCacti = {#ECE2DE,#D5CFC1, #CCD6D1, #889F8A, #445C56, #112625};
color[] paletteSucculent = {#D58568, #DCE0C3, #BCD0B3, #9CB6A8, #577160, #30402F};
color[] paletteViolet = {#F3F1EF, #DAE2F8, #7AB799,#324942, #593071,#CA74BB};
color[] paletteDust = {#687DB6,#46425D,#515648,#D58659,#F2C285,#E1CCDE};
color[] paletteLimon = {#87B083, #2E503D, #DFAC5A, #EBD175, #F0EEA5, #F1F9CF};
color[] paletteCoton = {#98B686, #786A73, #AB80B0, #C6B0E4, #DFCEF7, #F1F0EC};
color[] paletteHoney = {#F7F6F3, #EFECE6, #EEC791, #CB7046, #624F48, #BCA994};
color[] paletteHolliday = {#B2EEEE, #7ED6DA, #3682BC, #243C5C, #324E51, #B8AC7F};
color[] paletteSurreal = {#7567B8, #142235, #31448F, #468598, #79C5C3, #C5F7DE};
color[] paletteSweat = {#B9D4F5, #4E4689, #D24B63, #F4B698, #EAE69E, #E4E2E2};
color[] paletteSummerSky = {#3062B8,#589FC0, #3A7EC9, #78C5DB, #E2DED9, #DCDCDC};
color[] paletteSignal = {#0A1D3B, #132F56, #E5376A, #F87B9B, #F2F9FF};
color[] paletteSugar = {#F1E3D2, #FE97BE, #E65B51, #2A5F9E, #6FB882};
color[][] palettes = {
paletteRose,
paletteWatermelon,
paletteSable,
paletteCandy,
paletteJungle,
paletteSavana, //5
palettePortal,
palettePeach,
palettePoppies,
paletteOcean,
paletteStrawberry,//10
palettePink,
paletteCobacabana,
paletteBanana,
paletteMarine,
paletteBaobab,//15
paletteJeans,
paletteBlue,
paletteFlower,
paletteTired,
paletteSumer,//20
paletteBeach,
paletteApple,
paletteUnderwater,
paletteSunset,
paletteSoft,//25
paletteQueen,
paletteDecay,
paletteUsed,
palettePurple,
paletteSnowWhite,//30
paletteSahara,
paletteIsland,
paletteStaryNight,
palettePlayfull,
palettePirate,
paletteVegas,
paletteModernArt,
paletteSweden,
paletteCalifornia,
paletteMoon,
paletteNut,
paletteNeon,
paletteAtmospher,
paletteIce,
paletteEmerald,
paletteGeometric,
paletteRoad,
paletteBlueberry,
palettePride,
paletteYourName,
paletteUrban,
paletteEstrella,
paletteRPG,
paletteFirewatch,
paletteGrandBudapest,
paletteSand,
paletteVenon,
paletteCeramique,
paletteCherry,
paletteWild,
paletteTowel,
paletteLavender,
paletteCacti,
paletteSucculent,
paletteViolet,
paletteDust,
paletteLimon,
paletteCoton,
paletteHoney,
paletteHolliday,
paletteSurreal,
paletteSweat,
paletteSummerSky,
paletteSignal,
paletteSugar
};
String[] palettesName = {
"Rose",
"Watermelon",
"Sable",
"Candy",
"Jungle",
"Savana",
"Portal",
"Peach",
"Poppies",
"Ocean",
"Strawberry",
"Pink",
"Cobacabana",
"Banana",
"Marine",
"Baobab",
"Jeans",
"Blue",
"Flower",
"Tired",
"Sumer",
"Beach",
"Apple",
"Underwater",
"Sunset",
"Soft",
"Queen",
"Decay",
"Used",
"Purple",
"SnowWhite",
"Sahara",
"Island",
"StaryNight",
"Playfull",
"Pirate",
"Vegas",
"ModernArt",
"Sweden",
"California",
"Moon",
"Nut",
"Neon",
"Atmospher",
"Ice",
"Emerald",
"Geometric",
"Road",
"Blueberry",
"Pride",
"YourName",
"Urban",
"Estrella",
"RPG",
"Firewatch",
"GrandBudapest",
"Sand",
"Venon",
"Ceramique",
"Cherry",
"Wild",
"Towel",
"Lavender",
"Cacti",
"Succulent",
"Violet",
"Dust",
"Limon",
"Coton",
"Honey",
"Holliday",
"Surreal",
"Sweat",
"SummerSky",
"Signal",
"Sugar"
};
color colorLerpArray(color[] pixels, float t) {
int currentMode = g.colorMode;
colorMode(RGB);
t*=pixels.length;
color tMin = pixels[max(min(int(t),pixels.length-1),0)];
color tMax = pixels[min(int(t+1),pixels.length-1)];
color result = lerpColor(tMin, tMax, t%1);
colorMode(currentMode);
return result;
}
color colorLerpArrayLinear(color[] pixels, float t) {
t*=pixels.length;
return pixels[max(min(int(t),pixels.length-1),0)];
}
color changeColor(color base, float deltaHue, float scaleSaturation, float deltaSaturation, float scaleBrightness, float deltaBrightness, float scaleAlpha, float deltaAlpha) {
return color(mod(hue(base)+deltaHue,360), saturation(base)*scaleSaturation + deltaSaturation, brightness(base) * scaleBrightness + deltaBrightness, alpha(base) * scaleAlpha + deltaAlpha);
}
color softColor(color base) {
return changeColor(base, 0, 0.3, 0, 0, 100, 1, 0);
}
color setAlpha(color base, float set) {
return changeColor(base, 0, 1, 0, 1, 0, 0, set);
}
float easingLinear(float t) { return t; }
float easingInBack(float t, float s) { return t * t * ((s + 1) * t - s);}
float easingInCirc(float t) { return -(sqrt(1 - t * t) - 1); }
float easingInCubic(float t) { return t * t * t; }
float easingInElastic(float t) { return easingInElastic(t, 1.70158); }
float easingInExpo(float t) { return (t == 0) ? 0 : pow(2, 10 * (t - 1));}
float easingInQuad(float t) { return t * t;}
float easingInQuart(float t) { return t * t * t * t;}
float easingInQuint(float t) { return t * t * t * t * t; }
float easingInSine(float t) { return -cos(t * (PI / 2)) + 1.0;}
float easingOutBack(float t, float s) {--t; return t * t * ((s + 1.0) * t + s) + 1.0;}
float easingOutCirc(float t) {--t; return sqrt(1 - t * t);}
float easingOutElastic(float t) {return easingOutElastic(t, 1.70158);}
float easingOutExpo(float t) {return (t == 1.0)? 1.0 : (-pow(2, -10 * t) + 1);}
float easingOutQuad(float t) {return -t * (t - 2);}
float easingOutQuart(float t) {--t;return 1.0 - t * t * t * t;}
float easingOutQuint(float t) {--t;return t * t * t * t * t + 1;}
float easingOutSine(float t) {return sin(t * (PI / 2));}
float easingInOutBounce(float t) {return (t < 0.5)? (easingInBounce(t * 2) * 0.5) : (easingOutBounce(t * 2 - 1.0) * 0.5 + 0.5);}
float easingInOutElastic(float t) {return easingInOutElastic(t, 1.70158);}
float easingInOutSine(float t) {return -0.5 * (cos(PI * t) - 1);}
float easingOutCubic(float t) {--t;return t * t * t + 1;}
float easingOutBack(float t) { return easingOutBack(t, 1.70158); }
float easingInBounce(float t) {
t = 1.0 - t;
if (t < 1 / 2.75) {
return 1.0 - (7.5625 * t * t);
}
if (t < 2 / 2.75) {
t -= 1.5 / 2.75;
return 1.0 - (7.5625 * t * t + 0.75);
}
if (t < 2.5 / 2.75) {
t -= 2.25 / 2.75;
return 1.0 - (7.5625 * t * t + 0.9375);
}
t -= 2.625 / 2.75;
return 1.0 - (7.5625 * t * t + 0.984375);
}
float easingInElastic(float t, float s) {
float p = 0.3;
float a = 1.0;
if (t == 0) {
return 0;
}
if (t == 1.0) {
return 1.0;
}
if (a < 1.0) {
a = 1.0;
s = p / 4;
} else {
s = p / (2 * 3.1419) * asin(1.0 / a);
}
--t;
return -(a * pow(2, 10 * t) * sin((t - s) * (2 * 3.1419) / p));
}
float easingOutBounce(float t) {
if (t < 1 / 2.75) {
return 7.5625 * t * t;
}
if (t < 2 / 2.75) {
t -= 1.5 / 2.75;
return 7.5625 * t * t + 0.75;
}
if (t < 2.5 / 2.75) {
t -= 2.25 / 2.75;
return 7.5625 * t * t + 0.9375;
}
t -= 2.625 / 2.75;
return 7.5625 * t * t + 0.984375;
}
float easingOutElastic(float t, float s) {
float p = 0.3;
float a = 1.0;
if (t == 0) {
return 0;
}
if (t == 1.0) {
return 1.0;
}
if (a < 1.0) {
a = 1.0;
s = p / 4;
} else {
s = p / (2 * 3.1419) * asin(1.0 / a);
}
return a * pow(2, -10 * t) * sin((t - s) * (2 * 3.1419) / p) + 1.0;
}
float easingInOutBack(float t, float s) {
float k = 1.525;
t *= 2;
s *= k;
if (t < 1) {
return 0.5 * (t * t * ((s + 1) * t - s));
}
t -= 2;
return 0.5 * (t * t * ((s + 1) * t + s) + 2);
}
float easingInOutBack(float t) {
return easingInOutBack(t, 1.70158);
}
float easingInOutCirc(float t) {
t *= 2;
if (t < 1) {
return -0.5 * (sqrt(1 - t * t) - 1);
}
t -= 2;
return 0.5 * (sqrt(1 - t * t) + 1);
}
float easingInOutCubic(float t) {
t *= 2;
if (t < 1) {
return 0.5 * t * t * t;
}
t -= 2;
return 0.5 * (t * t * t + 2);
}
float easingInOutElastic(float t, float s) {
float p = 0.3 * 1.5;
float a = 1.0;
if (t == 0) {
return 0;
}
if (t == 1.0) {
return 1.0;
}
if (a < 1.0) {
a = 1.0;
s = p / 4;
} else {
s = p / (2 * 3.1419) * asin(1.0 / a);
}
if (t < 1) {
--t;
return -0.5 * (a * pow(2, 10 * t) * sin((t - s) * (2 * 3.1419) / p));
}
--t;
return a * pow(2, -10 * t) * sin((t - s) * (2 * 3.1419) / p) * 0.5 + 1.0;
}
float easingInOutExpo(float t) {
if (t == 0) {
return 0;
}
if (t == 1.0) {
return 1.0;
}
t *= 2;
if (t < 1) {
return 0.5 * pow(2, 10 * (t - 1));
}
--t;
return 0.5 * (-pow(2, -10 * t) + 2);
}
float easingInOutQuad(float t) {
t *= 2;
if (t < 1) {
return 0.5 * t * t;
}
--t;
return -0.5 * (t * (t - 2) - 1);
}
float easingInOutQuart(float t) {
t *= 2;
if (t < 1) {
return 0.5 * t * t * t * t;
}
t -= 2;
return -0.5 * (t * t * t * t - 2);
}
float easingInOutQuint(float t) {
t *= 2;
if (t < 1) {
return 0.5 * t * t * t * t * t;
}
t -= 2;
return 0.5 * (t * t * t * t * t + 2);
}
float clamp(float min, float max, float v) {
return min(max(v, min), max);
}
float clamp01(float v) {
return clamp(0,1,v);
}
float mod(float a, float n){
return a<0 ? (a%n + n)%n : a%n;
}
void resetSeed() {
noiseSeed(int(random(10000000)));
}
PVector delta (PVector from, PVector to) {
return new PVector(to.x-from.x, to.y-from.y);
}
float random() {
return random(1);
}
int randomSide() {
return random()<0.5 ? -1 : 1;
}
float sign(float a) {
return a==0 ? 0 : a<0 ? -1 : 1;
}
boolean randomBool() {
return random() < 0.5;
}
float onesToOne(float t) {
return t*0.5+0.5;
}
float oneToOnes(float t) {
return t*2-1;
}
float discretise(float t, float outOf, float n) {
return floor(t/outOf*n)/n;
}
float discretise(float t, float n) {
return discretise(t,1,n);
}
boolean isFirstDraw = true;
void setup() {
fullScreen();
//size(1000,1000);
colorMode(HSB, 360, 100, 100, 1);
}
void keyPressed() {
if (key == 's') {save("screenshot/image_"+day()+"-"+month()+"-"+year()+"_"+hour()+"-"+minute()+"-"+second()+".png");}
if (key == 'r') {isFirstDraw = true;}
}
void draw() {
if (isFirstDraw) {
firstDraw();
isFirstDraw = false;
}
onLoop();
}
void firstDraw() {
}
void onLoop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment