Skip to content

Instantly share code, notes, and snippets.

@jgwhite
Created April 1, 2011 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgwhite/897940 to your computer and use it in GitHub Desktop.
Save jgwhite/897940 to your computer and use it in GitHub Desktop.
float afmin = 75;
float afmax = 25 ;
float maxOmin = 8;
float maxOmax = 28;
float blobalphamin = 0;
float blobalphamax = 30;
float scoopamin = 0;
float scoopamax = 22;
float discamin = 0;
float discamax = 30;
float ripplemin = 50;
float ripplemax = 255;//...
float swarmamin = 7;
float swarmamax = 47;
//float rimin = -0.05;
//float rimax = 0.05;
float ssmin = 0.23;
float ssmax = 0.6;
float rsmin = 1.7;
float rsmax = 0.1;
float orbitmin = 0;
float orbitmax = 10;
float starfreqmin = 20;
float starfreqmax = 1;
float sexfreqmin = 20;
float sexfreqmax = 250;
float noWispsmin = 0;
float noWispsmax = 30;
float bubblefreqmin = 12;
float bubblefreqmax = 1;
float ripplefreqmin = 90;
float ripplefreqmax = 5;
float bubblebmin = 0;
float bubblebmax = 300;
float escapermin = 8;
float escapermax = 1.4;
float magicwispamin = 0;
float magicwispamax = 10;
float flyerlengthmin = 1;
float flyerlengthmax = 25;
float framesizemin = 1;
float framesizemax = 1.5;
float frameamin = 120;
float frameamax = 255;
float flyerfreqmin = 40;
float flyerfreqmax = 8;
float nodomin = 10;
float nodomax = 30;
float clothsmin = 1;
float clothsmax = 0.1;
float clothamin = 3;
float clothamax = 9;
float punchsmin = 0.1;
float punchsmax = 8;
float nocmin = 1;
float nocmax = 10;
float yrotsmin = 0.0001;
float yrotsmax = 0.06;
//float bubblebmin = 0;
//float bubblebmax = 255;
void Resonance(float val) {
userTasteData.put("resonance", val);
//fruits & creams
if (flava == CHOCS) backalpha = 255;
else backalpha = map(val, 0, controllermax, afmin, afmax);
//chocs
// flyerlength = map(val, 0, controllermax, flyerlengthmin, flyerlengthmax);
bubbleb = map(val, 0, controllermax, bubblebmin, bubblebmax);
}
void Sharpness(float val) {
userTasteData.put("sharpness", val);
//fruits
maxO = map(val, 0, controllermax, maxOmin, maxOmax);
//r
escaper = map(val, 0, controllermax, escapermin, escapermax);
//chocs
framesize = map(val, 0, controllermax, framesizemin, framesizemax);
//dulces
punchmaxsize = map(val, 0, controllermax, punchsmin, punchsmax);
punchsep = map(val, 0, controllermax, punchsmin, punchsmax);
}
void Sweetness(float val) {
userTasteData.put("sweetness", val);
// blobalpha = val/3;
//fruits
if(theflavour == 17) blobalpha = map(val, 0, controllermax, blobalphamin, blobalphamax*0.75); //adjust for lemon
else blobalpha = map(val, 0, controllermax, blobalphamin, blobalphamax);
//creams
orbitalpha = map(val, 0, controllermax, orbitmin, orbitmax);
//chocs
bubblefreq = map(val, 0, controllermax, bubblefreqmin, bubblefreqmax);
//dulces
yrotspeed = map(val, 0, controllermax, yrotsmin, yrotsmax);
}
void Intensity(float val) {
userTasteData.put("intensity", val);
//fruits
sexfreq = map(val, 0, controllermax, sexfreqmin, sexfreqmax);
//creams
discalpha = map(val, 0, controllermax, discamin, discamax);
//chocs
ripplealpha = map(val, 0, controllermax, ripplemin, ripplemax);
//dulces
noCloths = map(val, 0, controllermax, nocmin, nocmax);
}
void Juiciness(float val) {
userTasteData.put("juiciness", val);
// swarmalpha = map(val, 0, controllermax, jumin, jumax);
swarmalpha = map(val, 0, controllermax, swarmamin, swarmamax);
//chocs
flyerfreq = map(val, 0, controllermax, flyerfreqmin, flyerfreqmax);
//creams
starfreq = map(val, 0, controllermax, starfreqmin, starfreqmax);
//dulces
noDulceOrbit = map(val, 0, controllermax, nodomin, nodomax);
}
void Richness(float val) {
userTasteData.put("richness", val);
swarmsize = map(val, 0, controllermax, ssmin, ssmax);
//chocs
ripplefreq = map(val, 0, controllermax, ripplefreqmin, ripplefreqmax);
//creams
magicwispalpha = map(val, 0, controllermax, magicwispamin, magicwispamax);
//dulces
clothalpha = map(val, 0, controllermax, clothamin, clothamax);
}
void Creaminess(float val) {
userTasteData.put("creaminess", val);
//fruits
scoopalpha = map(val, 0, controllermax, scoopamin, scoopamax);
//creams
noWisps = (int) map(val, 0, controllermax, noWispsmin, noWispsmax);
//chocs
framealpha = map(val, 0, controllermax, frameamin, frameamax);
//dulces
clothspeed = map(val, 0, controllermax, clothsmin, clothsmax);
}
void Zoom(float val) {
ztrans = (int) val;
}
void gotoData(float cr, float in, float sw, float ju, float sh, float ri, float af) {
switch (theflavour) {
case MALBEC:
case PASSION:
backalpha = map(af, 0, controllermax, afmin, afmax);
maxO = map(sh, 0, controllermax, maxOmin, maxOmax);
blobalpha = map(sw, 0, controllermax, blobalphamin, blobalphamax);
sexfreq = map(in, 0, controllermax, sexfreqmin, sexfreqmax);
swarmalpha = map(ju, 0, controllermax, swarmamin, swarmamax);
swarmsize = map(ri, 0, controllermax, ssmin, ssmax);
scoopalpha = map(cr, 0, controllermax, scoopamin, scoopamax);
break;
case BSPLIT:
backalpha = map(af, 0, controllermax, afmin, afmax);
escaper = map(sh, 0, controllermax, escapermin, escapermax);
orbitalpha = map(sw, 0, controllermax, orbitmin, orbitmax);
discalpha = map(in, 0, controllermax, discamin, discamax);
starfreq = map(ju, 0, controllermax, starfreqmin, starfreqmax);
magicwispalpha = map(ri, 0, controllermax, magicwispamin, magicwispamax);
noWisps = map(cr, 0, controllermax, noWispsmin, noWispsmax);
break;
case CHOC:
flyerlength = map(af, 0, controllermax, flyerlengthmin, flyerlengthmax);
framesize = map(sh, 0, controllermax, framesizemin, framesizemax);
bubblefreq = map(sw, 0, controllermax, bubblefreqmin, bubblefreqmax);
ripplealpha = map(in, 0, controllermax, ripplemin, ripplemax);
flyerfreq = map(ju, 0, controllermax, flyerfreqmin, flyerfreqmax);
ripplefreq = map(ri, 0, controllermax, ripplefreqmin, ripplefreqmax);
framealpha = map(cr, 0, controllermax, frameamin, frameamax);
break;
case DULCE:
backalpha = map(af, 0, controllermax, afmin, afmax);
punchmaxsize = map(sh, 0, controllermax, punchsmin, punchsmax);
yrotspeed = map(sw, 0, controllermax, yrotsmin, yrotsmax);
noCloths = map(in, 0, controllermax, nocmin, nocmax);
noDulceOrbit = map(ju, 0, controllermax, nodomin, nodomax);
clothalpha = map(ri, 0, controllermax, clothamin, clothamax);
clothspeed = map(cr, 0, controllermax, clothsmin, clothsmax);
break;
}
creaminess.setValue(cr); userTasteData.put("creaminess", cr);
sharpness.setValue(sh); userTasteData.put("sharpness", in);
sweetness.setValue(sw); userTasteData.put("sweetness", sw);
intensity.setValue(in); userTasteData.put("intensity", ju);
juiciness.setValue(ju); userTasteData.put("juiciness", sh);
richness.setValue(ri); userTasteData.put("richness", ri);
resonance.setValue(af); userTasteData.put("resonance", af);
}
//-------- FLAVOUR BUTTONS -----------
void Malbec(float v) {
flava = FRUITS;
theflavour = MALBEC;
updateSettings();
malbec.setColorBackground(color(120));
scoopimg = berryimg1;
blobimg = berryimg2;
}
void Passion(float v) {
flava = FRUITS;
theflavour = PASSION;
updateSettings();
passion.setColorBackground(color(120));
scoopimg = passionimg3;
blobimg = passionimg3;
}
void SBerry(float v) {
flava = FRUITS;
theflavour = SBERRY;
updateSettings();
sberry.setColorBackground(color(120));
scoopimg = strawimg1;
blobimg = strawimg2;
}
void Lemon(float v) {
flava = FRUITS;
theflavour = LEMON;
updateSettings();
lemon.setColorBackground(color(120));
scoopimg = strawimg1;
blobimg = strawimg2;
}
void Rberry(float v) {
flava = FRUITS;
theflavour = RBERRY;
updateSettings();
rberry.setColorBackground(color(120));
scoopimg = strawimg1;
blobimg = strawimg2;
}
// ------------ CREAMS -----------
void BSplit(float v) {
flava = CREAMS;
theflavour = BSPLIT;
updateSettings();
bsplit.setColorBackground(color(120));
discimg = bsplitring;
}
void Berries(float v) {
flava = CREAMS;
theflavour = BERRIES;
updateSettings();
berries.setColorBackground(color(120));
discimg = berryring;
}
void Vanilla(float v) {
flava = CREAMS;
theflavour = VANILLA;
updateSettings();
vanilla.setColorBackground(color(120));
discimg = vanillaring;
}
void Irish(float v) {
flava = CREAMS;
theflavour = IRISH;
updateSettings();
vanilla.setColorBackground(color(120));
discimg = irishring;
}
// --------- CHOCS -----------
void Choc(float v) {
flava = CHOCS;
theflavour = CHOC;
updateSettings();
choc.setColorBackground(color(120));
// hint(ENABLE_OPENGL_4X_SMOOTH);
spawnBuds();
}
void White(float v) {
flava = CHOCS;
theflavour = WHITECHOC;
updateSettings();
white.setColorBackground(color(120));
// hint(ENABLE_OPENGL_4X_SMOOTH);
spawnBuds();
}
void Almond(float v) {
flava = CHOCS;
theflavour = ALMONDCHOC;
updateSettings();
almond.setColorBackground(color(120));
// hint(ENABLE_OPENGL_4X_SMOOTH);
spawnBuds();
}
// ---------- DULCES ------------
void Dulce(float v) {
flava = DULCES;
theflavour = DULCE;
updateSettings();
dulce.setColorBackground(color(120));
resetCloths();
}
void Temp(float v) {
flava = DULCES;
theflavour = TEMPTATION;
updateSettings();
temp.setColorBackground(color(120));
resetCloths();
}
void Dulcechoc(float v) {
flava = DULCES;
theflavour = DULCECHOC;
updateSettings();
dulcechoc.setColorBackground(color(120));
resetCloths();
}
// ---- misc
void updateSettings() {
if (!isReading) Setuser(1);
switch (theflavour) {
case BSPLIT: flavourKey = "Banana Split"; break;
case BERRIES: flavourKey = "Berries"; break;
case IRISH: flavourKey = "Irish"; break;
case VANILLA: flavourKey = "Vanilla"; break;
case CHOC: flavourKey = "Chocolate"; break;
case WHITECHOC: flavourKey = "White Chocolate"; break;
case ALMONDCHOC: flavourKey = "Almond"; break;
case DULCE: flavourKey = "Dulce"; break;
case TEMPTATION: flavourKey = "Temptation"; break;
case DULCECHOC: flavourKey = "Dulce Choc"; break;
case SBERRY: flavourKey = "Strawberry"; break;
case LEMON: flavourKey = "Lemon"; break;
case MALBEC: flavourKey = "Malbec"; break;
case PASSION: flavourKey = "Passion Fruit"; break;
case RBERRY: flavourKey = "Raspberry"; break;
}
flavourDefaults = (Map) (new Defaults().get(flavourKey));
Zoom(Float.valueOf((String) flavourDefaults.get("zoom")).floatValue());
zoom.setValue(Float.valueOf((String) flavourDefaults.get("zoom")).floatValue());
blending = (String) flavourDefaults.get("blending");
if (blending.equals("normal")) backalpha = 255;
cp5.setColorBackground(color(0, 54, 82));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment