This week assignment was to create a generative text. So what I did, taking inspiration by the movement of objects underwater, was to create a type of bubbles with random colors that have a smooth and random motion through the environment. The idea is that some of these bubbles randomly contain the letters and when the mouse is on the screen these bubbles will align to make a word. Some of the features of this art are that it shows deepness, the smaller the bubble is the lighter color it will have, in order to create an illusion that some objects are closer than others.
Potential improvements for this art, is add to the bubbles with letters the methods to allow to show the path of movement when these moves from its original position to the position to generate the code.
class FarCircles{ float x,y,xSpeed,ySpeed,size; PVector loc; int R,G,B; FarCircles(int r,int g, int b, float SIZE){ x = random(0+SIZE, width - SIZE); y = random(0-SIZE, height - SIZE); loc = new PVector(x,y); xSpeed = random(-.1,.1); ySpeed = random(-.1,.1); R=r; G=g; B=b; size = SIZE; }//Far circles void update(){ loc.x+=xSpeed; loc.y+=ySpeed; } void display(){ pushMatrix(); fill(R,G,B); circle(loc.x, loc.y, size); fill(255); circle(loc.x, loc.y, size-5); popMatrix(); } //size = diameter void checkEdges() { if (loc.x+(size/2)>=width || loc.x-(size/2)<=0){ xSpeed*=-1; ySpeed*=-1; } if (loc.y+(size/2)>height || loc.y-(size/2)<0) { ySpeed*=-1; xSpeed*=-1; } if(loc.x+(size/2) == (width/2)-150 && loc.y>(height/2)-50 && loc.y<(height/2) + 50){ xSpeed*=-1; ySpeed*=-1; } if(loc.x-(size/2) == (width/2)+150 && loc.y>(height/2)-50 && loc.y<(height/2) + 50){ xSpeed*=-1; ySpeed*=-1; } if(loc.y+(size/2) == (height/2)-50 && loc.x>(width/2)-150 && loc.x<(width/2) + 150){ ySpeed*=-1; xSpeed*=-1; } if(loc.y-(size/2) == (height/2)+50 && loc.x>(width/2)-150 && loc.x<(width/2) + 150){ ySpeed*=-1; xSpeed*=-1; } } void textCircles(char character){ for(int i=0; i<word.length();i++){ pushMatrix(); fill(R,G,B); circle(loc.x, loc.y, size); fill(255); circle(loc.x, loc.y, size-5); pushMatrix(); translate(loc.x,loc.y); fill(0); textSize(76); text(character,-26,32); popMatrix(); popMatrix(); } } // textCircles void centerCircle(float newX, float newY){ loc.x = newX; loc.y = newY; xSpeed = 0; ySpeed = 0; } }//class ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// String word = "HOLA"; FarCircles[] circles = new FarCircles[35]; FarCircles[] letters = new FarCircles[word.length()]; void setup() { size(640,480); noStroke(); for (int i=0;i<circles.length; i++){ float size = random(0,84); if(size>0 && size<14){ int array[] = {204, 229,255}; int R =int( random(0,3)); int G = int(random(0,3)); int B = int(random(0,3)); circles[i] = new FarCircles(array[R],array[G],array[B], size); } if(size>14 && size<28){ int array[] = {153, 204,255}; int R = int( random(0,3)); int G = int(random(0,3)); int B = int(random(0,3)); circles[i] = new FarCircles(array[R],array[G],array[B], size); } if(size>28 && size<42){ int array[] = {102, 178,255}; int R = int(random(0,3)); int G = int(random(0,3)); int B = int(random(0,3)); circles[i] = new FarCircles(array[R],array[G],array[B], size); } if(size>42 && size<56){ int array[] = {51, 153,255}; int R = int(random(0,3)); int G = int(random(0,3)); int B = int(random(0,3)); circles[i] = new FarCircles(array[R],array[G],array[B], size); } if(size>56 && size<70){ int array[] = {0, 128,255}; int R = int(random(0,3)); int G = int(random(0,3)); int B = int(random(0,3)); circles[i] = new FarCircles(array[R],array[G],array[B], size); } if(size>70 && size<84){ int array[] = {0, 102,204}; int R = int(random(0,3)); int G = int(random(0,3)); int B = int (random(0,3)); circles[i] = new FarCircles(array[R],array[G],array[B], size); } }//loop for(int p =0; p<word.length();p++){ int array2[] = {0, 102,204}; int R = int(random(0,3)); int G = int(random(0,3)); int B = int (random(0,3)); letters[p] = new FarCircles(array2[R],array2[G],array2[B],84); } } void draw() { background(255); for (int i=0; i<circles.length; i++){ circles[i].update(); circles[i].checkEdges(); circles[i].display(); }//loop for (int j=0; j<letters.length; j++){ letters[j].update(); letters[j].checkEdges(); if(mouseOn()==true){ float w = word.length()*84 + word.length()*2; float separation = w/word.length(); //pushMatrix(); //translate(width/2, height/2); //fill(255); //rect( - w/2, -44, w, 84); //popMatrix(); letters[j].centerCircle(width/2-w/2+42+(separation*j),height/2); } //else{ // letters[j].xSpeed = random(-.1,.1); // letters[j].ySpeed = random(-.1,.1); // letters[j].update(); //} letters[j].textCircles(word.charAt(j)); }//loop } boolean mouseOn(){ if(mouseX>0 && mouseX< width && mouseY>0 && mouseY<height){ return true; } else { return false; } } //void mouseOn(){ // float w = word.length()*84 + word.length()*2; // float separation = w/word.length() -42; // if(mouseX>0 && mouseX< width && mouseY>0 && mouseY<height/2){ // pushMatrix(); // translate(width/2, height/2); // fill(255); // rect( - w/2, -44, w, 84); // popMatrix(); // pushMatrix(); // translate(width/2 - w/2 + 42, height/2); // for(int i = 0; i<word.length();i++){ // letters[i].centerCircle(separation*i,0); // } // popMatrix(); // } //} //void checkClashes(){ // FarCircles[] temp = new FarCircles[circles.length]; // for (int k=0; k<circles.length;k++){ // circles[k] = temp[k]; // } // for(int i =0; i<circles.length; i++){ // for(int j =0; j<circles.length; j++){ // if(i !=j){ // if( circles[i].loc.x + circles[i].size == circles[j].loc.x - circles[j].size){ // circles[i].xSpeed*=-1; // }//if first x // else if( circles[i].loc.x -circles[i].size == circles[j].loc.x + circles[j].size){ // circles[i].xSpeed*=-1; // }//if second x // else if( circles[i].loc.y +circles[i].size == circles[j].loc.y - circles[j].size){ // circles[i].ySpeed*=-1; // }//if first y // else if( circles[i].loc.x -circles[i].size == circles[j].loc.y +circles[j].size){ // circles[i].ySpeed*=-1; // }//if second y // }//if i =j // }// j loop // }// i loop //} //checkclashes