/** * Text on a Curve! * *

Elie Zananiri
* silentlyCrashing::net
* Feb 2010

*

Drag the mouse horizontally to set the letter spacing.
* Drag the mouse vertically to set the arc radius.
* Type to edit the text.

*/ PFont font; TextOnCurve textOnCurve; void setup() { size(400, 400); smooth(); noStroke(); font = createFont("Targa MS.ttf", 24); textFont(font); textAlign(CENTER); textOnCurve = new TextOnCurve("Drag the mouse or type to edit!", width/2, height/2, 150, 0, 10); } void draw() { background(255); fill(0); textOnCurve.draw(); } void mouseDragged() { textOnCurve.setRadius((int)map(mouseY, 0, height, 0, 180)); textOnCurve.setOffset((int)map(mouseX, 0, width, 0, 20)); } void keyPressed() { if (key == BACKSPACE || key == DELETE) { if (textOnCurve.txt.length() > 0) { textOnCurve.txt = textOnCurve.txt.substring(0, textOnCurve.txt.length()-1); } } else if (key >= 32 && key <= 126) { textOnCurve.txt += key; } }