[Geomerative library] Parkinson text editor
in
Contributed Library Questions
•
5 months ago
I'm trying to make a simplified "parkinson" text editor. I used two snippets to build it but I have two main issues :
- the return button doesn't work, only makes a space
- there are lines between letters that I'd like to remove, but I can't figure this out.
I use geomerative library. Could you please help me ? Here's my code :
- /*
- ///////////////////////////////////////////////
- --------- GEOMERATIVE EXAMPLES ---------------
- //////////////////////////////////////////////
- Title : TypoGeo_Wiggle
- Date : 01/03/2011
- Version : v0.5
- More motion but this time with a random movement
- to make the text wiggle. Again key'A' to freeze.
- Licensed under GNU General Public License (GPL) version 3.
- http://www.gnu.org/licenses/gpl.html
- A series of tutorials for using the Geomerative Library
- developed by Ricard Marxer.
- http://www.ricardmarxer.com/geomerative/
- More info on these tutorial and workshops at :
- www.freeartbureau.org/blog
- */
- //////////////////////////////////////////////
- import geomerative.*;
- boolean record;
- RFont font;
- String typedText = "Helvetikinson";
- //COULD USE A NOISE FUNCTION HERE FOR WIGGLE.
- float wiggle = 3.7;
- boolean stopAnime = false;
- //----------------SETUP---------------------------------
- void setup() {
- size(1280,800);
- background(255);
- smooth();
- RG.init(this);
- font = new RFont("HelveNeuCEBol.ttf", 100, CENTER);
- }
- //----------------DRAW---------------------------------
- void draw() {
- background(255);
- stroke(255, 0, 0);
- noFill();
- translate(width/2, height/4);
- RCommand.setSegmentLength(5);
- RCommand.setSegmentator(RCommand.UNIFORMLENGTH);
- RGroup myGroup = font.toGroup(typedText);
- RPoint[] myPoints = myGroup.getPoints();
- beginShape(TRIANGLE_STRIP);
- for (int i=0; i<myPoints.length; i++) {
- myPoints[i].x += random(-wiggle, wiggle);
- myPoints[i].y += random(-wiggle, wiggle);
- vertex(myPoints[i].x, myPoints[i].y);
- }
- endShape();
- text(typedText+(frameCount/10 % 2 == 0 ? "_" : ""), 35, 45);
- }
- //----------------KEYS---------------------------------
- void keyReleased() {
- if (key == '&')
- stopAnime = !stopAnime;
- if (stopAnime == true)
- noLoop();
- else loop();
- if (key != CODED) {
- switch(key) {
- case BACKSPACE:
- typedText = typedText.substring(0,max(0,typedText.length()-1));
- break;
- case TAB:
- typedText += " ";
- break;
- case ENTER:
- case RETURN:
- // comment out the following two lines to disable line-breaks
- typedText += "\n";
- break;
- case ESC:
- case DELETE:
- break;
- default:
- typedText += key;
- }
- }
- }
- //////////////////////////////////////////////
- void mousePressed() {
- save("pic.tif");
- }
1