Hi, i was editing some geomerative's codes but i'm not able to line-break this. Could you help me with this example? i would like to write a sentence in the canvas and distorce it with mouse over. Thank you for your help
import processing.pdf.*;
import geomerative.*;
PGraphics pg;
RFont myFont;
RGroup myGroup;
RPoint[] myPoints;
String myText = "hello \n hello";
FontAgent[] myAgents;
int step = 0;
int dim;
boolean stopAnime = false;
void setup() {
size(1050, 1050);
background(255);
smooth();
ellipseMode(RADIUS);
RG.init(this);
myFont = new RFont("relative.ttf",100,RFont.CENTER);
RCommand.setSegmentLength(2);
RCommand.setSegmentator(RCommand.UNIFORMLENGTH);
myGroup = myFont.toGroup(myText);
myPoints = myGroup.getPoints();
myAgents = new FontAgent[myPoints.length];
for (int i=0; i<myPoints.length; i++) {
myAgents[i] = new FontAgent(new PVector(myPoints[i].x, myPoints[i].y));
}
}
void draw() {
translate(width/2, height/2);
background(0);
fill(0);
for (int i = 0; i < myPoints.length; i++) {
myAgents[i].display();
myAgents[i].motion();
}
//saveFrame("line-######.png");
}
void keyPressed() {
if (key == 'f' || key == 'F')
stopAnime = !stopAnime;
if (stopAnime == true)
noLoop();
else loop();
if (key == '+')
step++;
println(step);
if (key == '-')
step--;
}
class FontAgent {
PVector loc;
float motion;
FontAgent(PVector l) {
loc = l.get();
}
void motion() {
float noiseScale = map(mouseX, mouseY, width, 0.001, 0.01);
motion = noise(loc.x * noiseScale, loc.y * noiseScale ) * 25;
}
//-7 -16
void display() {
noStroke();
fill(255);
//noFill();
// stroke(1);
rect(loc.x, loc.y, motion+step, motion+step);
}
}