Hello Processors (Processees?, Processians?, Processants?) !
My name is Justin Couch and I am getting my Masters Degree in Industrial Design at RISD. I am enamored with and fascinated by Computational Design in all of its forms, but I am obviously particularly interested in its use in Industrial Design (i.e. product design). It is currently being used by only a select few object makers and one of my goals during my time here at RISD is to a) explore my own personal use of Computational Design in the design of products and b) show that it is a powerful tool that more IDers should be figuring out how to use.
So I'm going to be posting a lot of my experiments and work here and I would love anyone and everyone's feedback. If you know of people I should check out, if you have ideas on what I should try, or if you have suggestions on how I can improve my code, etc., please let me know.
So basically I'm just a designer who knows a tiny bit about coding and I'm trying to make cool things.
Here's to something cool happening!
Justin Couch
So my first examination of the topic is based on Experimentation. I want to see if I can quickly generate an idea, prototype something in code, get something that is just decent enough to call a result, and then move on. I'm not looking to make finished products or elegant code (for now). So here goes:
First experiment: Keyboard Morphing
What would it look like if your keyboard changed as you typed? What if the keys you used got bigger and stronger and the ones you didn't got smaller and weaker? What if you could type on a keyboard that represented the works of Shakespeare or Dickens?
So, a quick exploration of text and shape change.
This sketch uses the traer physics library found
here.
The program reads a text file and changes the key sizes accordingly.
Shakespeare's Sonnets
Moby Dick
Nervous System's Cell Cycle Code
And here's the code.
- import traer.physics.*;
- import processing.pdf.*;
- boolean saveOneFrame = false;
- String [] lines;
- PFont font;
- ParticleSystem psys = new ParticleSystem(0, 0.95);
- int rows = 5;
- int cols = 14;
- int numbut = rows*cols;
- int numspr = 173;
- Particle [] parts = new Particle[numbut];
- Button [] buttons = new Button[numbut];
- Spring [] springs = new Spring[numspr];
- float rad0 = 20;
- float dia0 = rad0*2;
- float xshift, yshift;
- float sprStrength = 0.05;
- String fileName;
- float buttonChange = 0.000001;
- float numLines;
- float numLinesDiv=35;
- void setup(){
- size(700,400);
- textMode(SHAPE);
- smooth();
- //frameRate(2);
- font = loadFont("Inconsolata-48.ttf");
- textFont(font);
- textAlign(CENTER);
- fileName = "NervousSystemCellCycleCode";
- lines = loadStrings(fileName+".txt");
- numLines = lines.length;
- //println(lines[1].length());
- // for (int i=0; i<numbut; i++){
- // float randx = random(width);
- // float randy = random(height);
- // parts[i] = psys.makeParticle(1, randx, randy, 0);
- // buttons[i] = new Button(randx, randy, rad0, i);
- // }
- xshift = (width-((cols-1)*dia0))/2;
- yshift = (height-((rows-1)*dia0))/2;
- for (int j=0; j<rows; j++){
- for (int i=0; i<cols; i++){
- parts[cols*j + i] = psys.makeParticle(5, i*dia0+xshift, j*dia0+yshift, 0);
- buttons[cols*j + i] = new Button(i*dia0+xshift, j*dia0+yshift, rad0, cols*j + i);
- }
- }
- //parts[0].makeFixed();
- for (int i=0; i<numspr; i++){
- //springs[i] = psys.makeSpring(parts
- }
- makeSprings();
- setLetters();
- // springs[0] = psys.makeSpring(parts[0], parts[1], sprStrength, 0.9, rad0*2);
- // buttons[0].addConn(new PVector(0,1));
- // buttons[1].addConn(new PVector(0,0));
- // springs[1] = psys.makeSpring(parts[1], parts[2], sprStrength, 0.9, rad0*2);
- // buttons[1].addConn(new PVector(1,2));
- // buttons[2].addConn(new PVector(1,1));
- // springs[2] = psys.makeSpring(parts[2], parts[0], sprStrength, 0.9, rad0*2);
- // buttons[2].addConn(new PVector(2,0));
- // buttons[0].addConn(new PVector(2,2));
- }
- int jLine = 0;
- int iChar = 0;
- void draw(){
- psys.tick();
- if(saveOneFrame == true) {
- String DatePDF = fileName + year() + "-" + month() + "-" + day() + "-" + hour() + "-" + minute() + "-" + second() + ".pdf";
- beginRecord(PDF, DatePDF);
- }
- background(200);
- if(jLine<lines.length){
- String lin = lines[jLine];
- //if (lin.length() > 0){
- for (int i=0; i<lin.length(); i++){
- char ltr = lin.charAt(i);
- chkLtr(ltr);
- }
- //}
- }
- for (int i=0; i<numbut; i++){
- buttons[i].update();
- buttons[i].render();
- }
- jLine++;
- if (frameCount%5==0){
- //println("save!");
- String Date = fileName + year() + "-" + month() + "-" + day() + "-" + hour() + "-" + minute() + "-" + second() + ".tiff";
- save(Date);
- }
- if(saveOneFrame == true) {
- endRecord();
- saveOneFrame = false;
- }
- }
- void keyPressed() {
- if (key == 's' || key == 'S'){
- saveOneFrame = true;
- println("pdf saved at frame " + frameCount);
- }
- }
- class Button{
- float x;
- float y;
- float rad;
- int index;
- ArrayList conns = new ArrayList();
- String ltr;
- Button(float posx, float posy, float r, int i0){
- x = posx;
- y = posy;
- rad = r;
- index = i0;
- }
- void setLtr(String s){
- ltr = s;
- }
- void update(){
- x = parts[index].position().x();
- y = parts[index].position().y();
- for(int i=0; i<conns.size(); i++){
- PVector connI = (PVector) conns.get(i);
- float r0 = buttons[int(connI.y)].getRadius();
- float newRLen = r0 + rad;
- springs[int(connI.x)].setRestLength(newRLen);
- }
- }
- void render(){
- fill(255, 200);
- stroke(0);
- ellipse(x, y, rad*2, rad*2);
- //stroke(200,0,0);
- //ellipse(x, y, 2, 2);
- fill(0);
- textMode(SHAPE);
- textSize(rad*.75);
- text(ltr, x, y+rad/3);
- }
- float xposition(){
- return x;
- }
- float yposition(){
- return y;
- }
- float getRadius(){
- return rad;
- }
- void getBigger(float scayl){
- float rplus = 0;
- for (int i=0; i<numbut; i++){
- if (i!=index){
- float rother = buttons[i].getRadius();
- rplus += scayl*rother*rother*buttonChange/numLines;
- buttons[i].getSmaller(scayl);
- }
- }
- //println(rplus);
- //println(sqrt(rplus));
- rad += sqrt(rplus);
- }
- void getSmaller(float scayl){
- float rminus = scayl*rad*rad*buttonChange/numLines/numLinesDiv;
- rad -= sqrt(rminus);
- }
- void addConn(PVector connInd){
- conns.add(connInd);
- }
- }
- void makeSprings(){
- for (int i=0; i<13; i++){
- springs[i] = psys.makeSpring(parts[i], parts[i+1], sprStrength, 0.9, dia0);
- buttons[i].addConn(new PVector(i, i+1));
- buttons[i].addConn(new PVector(i, i));
- int j = i+13;
- springs[j] = psys.makeSpring(parts[j+1], parts[j+2], sprStrength, 0.9, dia0);
- buttons[j+1].addConn(new PVector(j, j+2));
- buttons[j+2].addConn(new PVector(j, j+1));
- int k = j+13;
- springs[k] = psys.makeSpring(parts[k+2], parts[k+3], sprStrength, 0.9, dia0);
- buttons[k+2].addConn(new PVector(k, k+3));
- buttons[k+3].addConn(new PVector(k, k+2));
- int l = k+13;
- springs[l] = psys.makeSpring(parts[l+3], parts[l+4], sprStrength, 0.9, dia0);
- buttons[l+3].addConn(new PVector(l, l+4));
- buttons[l+4].addConn(new PVector(l, l+3));
- int m = l+13;
- springs[m] = psys.makeSpring(parts[m+4], parts[m+5], sprStrength, 0.9, dia0);
- buttons[m+4].addConn(new PVector(m, m+5));
- buttons[m+5].addConn(new PVector(m, m+4));
- }
- for (int j=0; j<4; j++){
- for (int i=65; i<79; i++){
- int ind = i+(j*14);
- springs[ind] = psys.makeSpring(parts[ind-65], parts[ind-51], sprStrength, 0.9, dia0);
- buttons[ind-65].addConn(new PVector(ind, ind-51));
- buttons[ind-51].addConn(new PVector(ind, ind-65));
- }
- }
- for (int i0=0; i0<13; i0++){
- int i = i0+121;
- springs[i] = psys.makeSpring(parts[i-120], parts[i-107], sprStrength, 0.9, dia0);
- buttons[i-120].addConn(new PVector(i, i-107));
- buttons[i-107].addConn(new PVector(i, i-120));
- int j = i+13;
- springs[j] = psys.makeSpring(parts[j-120], parts[j-105], sprStrength, 0.9, dia0);
- buttons[j-120].addConn(new PVector(j, j-105));
- buttons[j-105].addConn(new PVector(j, j-120));
- int k = j+13;
- springs[k] = psys.makeSpring(parts[k-118], parts[k-105], sprStrength, 0.9, dia0);
- buttons[k-118].addConn(new PVector(k, k-105));
- buttons[k-105].addConn(new PVector(k, k-118));
- int l = k+13;
- springs[l] = psys.makeSpring(parts[l-118], parts[l-103], sprStrength, 0.9, dia0);
- buttons[l-118].addConn(new PVector(l, l-103));
- buttons[l-103].addConn(new PVector(l, l-118));
- }
- //PVector (spring index, other particle index)
- // springs[0] = psys.makeSpring(parts[0], parts[1], sprStrength, 0.9, dia0);
- // buttons[0].addConn(new PVector(0,1));
- // buttons[1].addConn(new PVector(0,0));
- // springs[1] = psys.makeSpring(parts[1], parts[2], sprStrength, 0.9, dia0);
- // buttons[1].addConn(new PVector(1,2));
- // buttons[2].addConn(new PVector(1,1));
- // springs[2] = psys.makeSpring(parts[2], parts[3], sprStrength, 0.9, dia0);
- // buttons[2].addConn(new PVector(2,3));
- // buttons[3].addConn(new PVector(2,2));
- // springs[13] = psys.makeSpring(parts[0], parts[14], sprStrength, 0.9, dia0);
- // buttons[0].addConn(new PVector(13,14));
- // buttons[14].addConn(new PVector(13,0));
- // springs[14] = psys.makeSpring(parts[1], parts[14], sprStrength, 0.9, dia0);
- // buttons[1].addConn(new PVector(14,14));
- // buttons[14].addConn(new PVector(14,1));
- // springs[15] = psys.makeSpring(parts[1], parts[15], sprStrength, 0.9, dia0);
- // buttons[1].addConn(new PVector(15,15));
- // buttons[15].addConn(new PVector(15,1));
- // springs[40] = psys.makeSpring(parts[14], parts[15], sprStrength, 0.9, dia0);
- // buttons[14].addConn(new PVector(40,15));
- // buttons[15].addConn(new PVector(40,14));
- }
- void setLetters(){
- buttons[0].setLtr(str('`'));
- buttons[1].setLtr(str('1'));
- buttons[2].setLtr(str('2'));
- buttons[3].setLtr(str('3'));
- buttons[4].setLtr(str('4'));
- buttons[5].setLtr(str('5'));
- buttons[6].setLtr(str('6'));
- buttons[7].setLtr(str('7'));
- buttons[8].setLtr(str('8'));
- buttons[9].setLtr(str('9'));
- buttons[10].setLtr(str('0'));
- buttons[11].setLtr(str('-'));
- buttons[12].setLtr(str('='));
- buttons[13].setLtr(str('d')+str('e')+str('l'));
- buttons[14].setLtr(str('t')+str('a')+str('b'));
- buttons[15].setLtr(str('q'));
- buttons[16].setLtr(str('w'));
- buttons[17].setLtr(str('e'));
- buttons[18].setLtr(str('r'));
- buttons[19].setLtr(str('t'));
- buttons[20].setLtr(str('y'));
- buttons[21].setLtr(str('u'));
- buttons[22].setLtr(str('i'));
- buttons[23].setLtr(str('o'));
- buttons[24].setLtr(str('p'));
- buttons[25].setLtr(str('['));
- buttons[26].setLtr(str(']'));
- buttons[27].setLtr(str('|'));
- buttons[28].setLtr(str('c')+str('a')+str('p')+str('s'));
- buttons[29].setLtr(str('a'));
- buttons[30].setLtr(str('s'));
- buttons[31].setLtr(str('d'));
- buttons[32].setLtr(str('f'));
- buttons[33].setLtr(str('g'));
- buttons[34].setLtr(str('h'));
- buttons[35].setLtr(str('j'));
- buttons[36].setLtr(str('k'));
- buttons[37].setLtr(str('l'));
- buttons[38].setLtr(str(';'));
- buttons[39].setLtr(str('"'));
- buttons[40].setLtr(str('r')+str('e')+str('t'));
- buttons[41].setLtr(str('r')+str('e')+str('t'));
- buttons[42].setLtr(str('s')+str('h')+str('f')+str('t'));
- buttons[43].setLtr(str('s')+str('h')+str('f')+str('t'));
- buttons[44].setLtr(str('z'));
- buttons[45].setLtr(str('x'));
- buttons[46].setLtr(str('c'));
- buttons[47].setLtr(str('v'));
- buttons[48].setLtr(str('b'));
- buttons[49].setLtr(str('n'));
- buttons[50].setLtr(str('m'));
- buttons[51].setLtr(str(','));
- buttons[52].setLtr(str('.'));
- buttons[53].setLtr(str('/'));
- buttons[54].setLtr(str('s')+str('h')+str('f')+str('t'));
- buttons[55].setLtr(str('s')+str('h')+str('f')+str('t'));
- buttons[56].setLtr(str('f')+str('n'));
- buttons[57].setLtr(str('c')+str('t')+str('r')+str('l'));
- buttons[58].setLtr(str('o')+str('p')+str('t'));
- buttons[59].setLtr(str('c')+str('m')+str('d'));
- buttons[60].setLtr(str('s')+str('p'));
- buttons[61].setLtr(str('s')+str('p'));
- buttons[62].setLtr(str('s')+str('p'));
- buttons[63].setLtr(str('s')+str('p'));
- buttons[64].setLtr(str('c')+str('m')+str('d'));
- buttons[65].setLtr(str('o')+str('p')+str('t'));
- buttons[66].setLtr(str('l'));
- buttons[67].setLtr(str('u'));
- buttons[68].setLtr(str('d'));
- buttons[69].setLtr(str('r'));
- }
- void chkLtr(char LTR){
- println(LTR);
- if (LTR == '`' || LTR == '~'){buttons[0].getBigger(1);}
- if (LTR == '1' || LTR == '!'){buttons[1].getBigger(1);}
- if (LTR == '2' || LTR == '@'){buttons[2].getBigger(1);}
- if (LTR == '3' || LTR == '#'){buttons[3].getBigger(1);}
- if (LTR == '4' || LTR == '$'){buttons[4].getBigger(1);}
- if (LTR == '5' || LTR == '%'){buttons[5].getBigger(1);}
- if (LTR == '6' || LTR == '^'){buttons[6].getBigger(1);}
- if (LTR == '7' || LTR == '&'){buttons[7].getBigger(1);}
- if (LTR == '8' || LTR == '*'){buttons[8].getBigger(1);}
- if (LTR == '9' || LTR == '('){buttons[9].getBigger(1);}
- if (LTR == '0' || LTR == ')'){buttons[10].getBigger(1);}
- if (LTR == '-' || LTR == '_'){buttons[11].getBigger(1);}
- if (LTR == '+' || LTR == '='){buttons[12].getBigger(1);}
- if (LTR == BACKSPACE){buttons[13].getBigger(1);}
- if (LTR == TAB){buttons[14].getBigger(1);}
- if (LTR == 'q' || LTR == 'Q'){buttons[15].getBigger(1);}
- if (LTR == 'w' || LTR == 'W'){buttons[16].getBigger(1);}
- if (LTR == 'e' || LTR == 'E'){buttons[17].getBigger(1);}
- if (LTR == 'r' || LTR == 'R'){buttons[18].getBigger(1);}
- if (LTR == 't' || LTR == 'T'){buttons[19].getBigger(1);}
- if (LTR == 'y' || LTR == 'Y'){buttons[20].getBigger(1);}
- if (LTR == 'u' || LTR == 'U'){buttons[21].getBigger(1);}
- if (LTR == 'i' || LTR == 'I'){buttons[22].getBigger(1);}
- if (LTR == 'o' || LTR == 'O'){buttons[23].getBigger(1);}
- if (LTR == 'p' || LTR == 'P'){buttons[24].getBigger(1);}
- if (LTR == '[' || LTR == '{'){buttons[25].getBigger(1);}
- if (LTR == ']' || LTR == '}'){buttons[26].getBigger(1);}
- if (LTR == 92 || LTR == '|'){buttons[27].getBigger(1);}
- //if (keyPressed && key == ){buttons[28].getBigger(1);}
- if (LTR == 'a' || LTR == 'A'){buttons[29].getBigger(1);}
- if (LTR == 's' || LTR == 'S'){buttons[30].getBigger(1);}
- if (LTR == 'd' || LTR == 'D'){buttons[31].getBigger(1);}
- if (LTR == 'f' || LTR == 'F'){buttons[32].getBigger(1);}
- if (LTR == 'g' || LTR == 'G'){buttons[33].getBigger(1);}
- if (LTR == 'h' || LTR == 'H'){buttons[34].getBigger(1);}
- if (LTR == 'j' || LTR == 'J'){buttons[35].getBigger(1);}
- if (LTR == 'k' || LTR == 'K'){buttons[36].getBigger(1);}
- if (LTR == 'l' || LTR == 'L'){buttons[37].getBigger(1);}
- if (LTR == ';' || LTR == ':'){buttons[38].getBigger(1);}
- if (LTR == 39 || LTR == '"'){buttons[39].getBigger(1);}
- if (LTR == ENTER || LTR == RETURN){buttons[40].getBigger(.5);}
- if (LTR == ENTER || LTR == RETURN){buttons[41].getBigger(.5);}
- //if (keyPressed && key == '`'){buttons[42].getBigger(1);}
- //if (keyPressed && key == 'a'){buttons[43].getBigger(1);}
- if (LTR == 'z' || LTR == 'Z'){buttons[44].getBigger(1);}
- if (LTR == 'x' || LTR == 'X'){buttons[45].getBigger(1);}
- if (LTR == 'c' || LTR == 'C'){buttons[46].getBigger(1);}
- if (LTR == 'v' || LTR == 'V'){buttons[47].getBigger(1);}
- if (LTR == 'b' || LTR == 'B'){buttons[48].getBigger(1);}
- if (LTR == 'n' || LTR == 'N'){buttons[49].getBigger(1);}
- if (LTR == 'm' || LTR == 'M'){buttons[50].getBigger(1);}
- if (LTR == ',' || LTR == '<'){buttons[51].getBigger(1);}
- if (LTR == '.' || LTR == '>'){buttons[52].getBigger(1);}
- if (LTR == '/' || LTR == '?'){buttons[53].getBigger(1);}
- //if (keyPressed && key == ']'){buttons[54].getBigger(1);}
- //if (keyPressed && key == '|'){buttons[55].getBigger(1);}
- if (LTR == CODED){
- if (LTR == UP){buttons[68].getBigger(1);}
- }
- if (LTR == 32){buttons[60].getBigger(.05);
- buttons[61].getBigger(.05);
- buttons[62].getBigger(.05);
- buttons[63].getBigger(.05);
- }
- if (LTR=='A'||LTR=='B'||LTR=='C'||LTR=='D'||LTR=='E'||LTR=='F'||LTR=='G'||LTR=='H'||LTR=='I'||
- LTR=='J'||LTR=='K'||LTR=='L'||LTR=='M'||LTR=='N'||LTR=='O'||LTR=='P'||LTR=='Q'||LTR=='R'||
- LTR=='S'||LTR=='T'||LTR=='U'||LTR=='V'||LTR=='W'||LTR=='X'||LTR=='Y'||LTR=='Z'||
- LTR=='!'||LTR=='@'||LTR=='#'||LTR=='$'||LTR=='%'||LTR=='^'||LTR=='&'||LTR=='*'||LTR=='('||LTR==')'
- ){
- float roll = random(1);
- if (roll>0.5){
- buttons[42].getBigger(.5);
- buttons[43].getBigger(.5);
- } else {
- buttons[54].getBigger(.5);
- buttons[55].getBigger(.5);
- }
- }
- }
It's not optimized or pretty, but again, that's the point. Quick and dirty idea generation. Next one soon!
justin
ps - is there a better way to upload code?
1