xxxxxxxxxx
/////DO NOT TOUCH
var x = 0,
y = 0;
var stepSize = 5.0;
/////DO NOT TOUCH
///////////////////////////////////////////////
/////WRITE YOUR POEM IN HERE (THE ORANGE TEXT)
var letters = " Can you read me? ";
/////WRITE YOUR POEM IN HERE (THE ORANGE TEXT)
///////////////////////////////////////////////
/////DO NOT TOUCH ATTRIBUTES BELOW
var fontSizeMin = 3;
var angleDistortion = 0.0;
var counter = 0;
function setup() {
createCanvas(780, 780);
background(255);
smooth();
cursor(HAND);
x = mouseX;
y = mouseY;
textAlign(LEFT);
fill(0);
}
function draw() {
if (mouseOver) {
var d = dist(x, y, mouseX, mouseY);
textFont('arial');
textSize(fontSizeMin + d / 3)
var newLetter = letters.charAt(counter);;
stepSize = textWidth(newLetter);
if (d > stepSize) {
var angle = atan2(mouseY - y, mouseX - x);
push();
translate(x, y);
rotate(angle + random(angleDistortion));
text(newLetter, 0, 0);
pop();
counter++;
if (counter > letters.length - 1) counter = 0;
x = x + cos(angle) * stepSize;
y = y + sin(angle) * stepSize;
}
}
}
function mouseOver() {
x = mouseX;
y = mouseY;
}
function keyPressed() {
// angleDistortion ctrls arrowkeys up/down
if (keyCode == DELETE || keyCode == BACKSPACE) background(255);
if (keyCode == UP_ARROW) angleDistortion += 0.1;
if (keyCode == DOWN_ARROW) angleDistortion -= 0.1;
}