String[] poem = {
"L'art web, l'art au bout des doigts",
};
//gets the number of lines
int numLines = poem.length;
//declare a 2D array, one element (x,y) for ach letter
Letter[][] p1 = new Letter[numLines][];
void setup() {
size(1056,706);
f = createFont("Helvetica", 12, true);
textFont(f);
// loop over each line
for (int y = 0; y < p1.length; y++)
{
//loop over the letters in that line
p1[y] = new Letter[poem[y].length()];
for (int x = 0; x < p1[y].length; x++) {
// create a new letter in each spot
p1[y][x] = new Letter();
// set the letter, x and y
p1[y][x].ch = poem[y].charAt(x);
p1[y][x].x = 50 + x*7;
p1[y][x].y = 50 + y*30;
}
}
}
void draw() {
background(255);
// draw each letter
for (int y= 0; y < p1.length; y++) {
for (int x = 0; x < p1[y].length; x++) {
p1[y][x].display();
}
}
//when mouse is released the letters shake randomly
if (!mousePressed) {
for (int y= 0; y < p1.length; y++) {
for (int x = 0; x < p1[y].length; x++) {
p1[y][x].shake();
}
}
}
//when mouse is pressed the letters form a text
else if (mousePressed) {
for (int y= 0; y < p1.length; y++) {
for (int x = 0; x < p1[y].length; x++) {
p1[y][x].home(pmouseX + x*6.6, pmouseY + y*15); // the letters follow the mouse
}
}
}
}
void shake() {
x += random(-1, 1);
y += random(-1, 1);
}
void home(float homeX, float homeY) {
x = lerp(x, homeX, .02);
y = lerp(y, homeY, .02);
}
}
and I want to know if it's possible to joint the letters together like in this the picture below and I want to know if it's possible to make them moved with the mousemoved and not the mousepressed ?
Thank you!!
I want to know if it's possible to save what I draw with Tuiodemo into files once every minute so that they get printed out as I'm drawing. The thing is I'm automatically printing files with the application Automator. But Automator needs to get the pdfs, jpeg or tif files from the Tuiodemo sketch folder.
On
processing.org I only found ways to save the files in the sketch folder by mouse clicking wich causes the program to end. Is there a code that would allow me to save without ending the program or using the mouse?