This week we had to experiment with text and how we can manipulate them and I thought the best way to do so was to illustrate it in the form of a word game. And so I created this word game which involves both geomerative points as the backdrop of the text behind and the original text which can be manipulated by the use of a house causing the characters to move up and down. It was not what I had in mind as my first idea for the project but since I was late and couldn’t bring my first idea to fruition I thought of settling for this.
In this project, other than the regular Rfunctions we learned in class, I learned about RShape and how they can be used to identify letters in a text.
import geomerative.*; RFont font; RPoint[] points; String phrase = "Word Game!"; float xOffset; RShape shp; float letter_x =0; float letter_y = 0; int random_letter = -1; int speed = 10; void setup() { size(800, 800); RG.init(this); font = new RFont("Franklin Goth Ext Condensed.ttf", 160, RFont.CENTER); RCommand.setSegmentLength(int(random(10))); RCommand.setSegmentator(RCommand.UNIFORMLENGTH); RGroup grp; grp = font.toGroup(phrase); grp = grp.toPolygonGroup(); points = grp.getPoints(); //for points shp = RG.getText(phrase, "Franklin Goth Ext Condensed.ttf", 150, RFont.CENTER); xOffset = width - grp.getBottomRight().x - grp.getBottomLeft().x; letter_x = xOffset/2; letter_y = height/2; //for letters } void draw() { background(0); for (int i =0; i<points.length; i++) { float x = points[i].x + xOffset/2; float y = points[i].y + height/2; fill(random(255), random(255), random(255)); rect(x, y, random(5), random(5)); //to create dotted background } for (int j =0; j<shp.children.length; j++) { if(j != random_letter){ pushMatrix(); translate(letter_x, letter_y); shp.children[j].draw(); popMatrix(); //to create letters } } if(mouseX > 0 && mouseX < width){ random_letter = int(map(mouseX,0,width,0,shp.children.length)); println(random_letter); translate(letter_x, random(2*letter_y)); shp.children[random_letter].draw(); //to move them acc to cursor } }
Glad to see you looking a little bit deeper into the geomerative library. But this isn’t a really great use of it, I’m not sure what it adds. The overuse of random throughout the sketch really detracts from what, with just a little bit more effort, could’ve been something cool. It comes off as tacky.