/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.j4bC2DYMPlQ/rev.367
*
* authors:
* andrea volpini
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// This sketch builds on a prior work, "P5CwB", created by caleb mascarenhas & vrsck & [unnamed author]
// http://studio.sketchpad.cc/sp/pad/view/ro.9q1c4ubUSz-1o/rev.445
/* @pjs font="http://calebav.com/droid.otf"; */
import processing.opengl.*;
String [] colorlist;
float ang,ang2, ang3, ver, ved, azu, alf=0;
int nq = 20;
float vel = 0.008;
Pfont texto;
//usamos Pfont minusculo ao invé de PFont;
int[] chooseRandomColor() {
String[] colors = new String[7];
// color palette - change here to try different palette
colors[0] = "242,15,98";
colors[1] = "255,154,46";
colors[2] = "249,248,30";
colors[3] = "143,210,42";
colors[4] = "100,41,148";
colors[5] = "255,255,255";
colors[7] = "25,24,24";
float q = random(6);
int c = int(q);
String[] colorlist = split(colors[c], ',');
int[] colorlist_ = int(colorlist);
return colorlist_;
}
void setup() {
size(600, 600, OPENGL);
frameRate(8);
smooth();
//aqui usamos createFont ao invés de loadFont
texto = createFont("http://calebav.com/droid.otf", 60);
colorMode(RGB);
}
void draw() {
background(#ffffff);
noStroke();
lights();
//pointLight(255,255,255,100,0,0);
alf=230;
directionalLight(51, 102, 126, width/2,height/3, 0);
//ambientLight(51, 102, 126, width/2,height/3, 0);
for (int i=0;i<nq;i++) {
//ver = i*30;
//ved = i*10;
//azu = i*100;
// coloring the bounding box using a random color from the palette
colorlistRect = chooseRandomColor();
fill(colorlistRect[0],colorlistRect[1],colorlistRect[2]);
//fill(ver, ved,azu ,alf);
pushMatrix();
translate(width/2, height/3, -20);
rotateX(ang+i);
rotateY(ang2-i);
rotateZ(ang-i);
box(120,120,120);
popMatrix();
}
ang+=vel*3;
ang2-=vel*1.5;
stroke(0);
fill(0);
textFont(texto, 70);
textAlign(CENTER);
text("Interact Egypt & Insideout10", width/2, 370);
text("Wish You Happy Holidays!", width/2, 435);
textFont(texto, 35);
text("2012 - 2013", width/2, 480);
}
void mousePressed()
{
redraw();
noLoop();
}
void mouseReleased()
{
redraw();
loop();
}