xxxxxxxxxx
var thetext; // the words we are gonna work with
var fonts = []; // an array of fonts
var fadespeed = 100; // frames to fade in and out
var theline; // the current line of text
var tw, th;
function preload(){
thetext = loadStrings('talesofpassedtime.txt');
fonts[0] = loadFont('youmurdererbb_reg.ttf');
fonts[1] = loadFont('Autumn in November.ttf');
fonts[2] = loadFont('Housttely Signature.otf');
fonts[3] = loadFont('Hello Alexandria Demo.otf');
}
function setup() {
createCanvas(windowWidth, windowHeight);
rectMode(CENTER);
theline = random(thetext);
textFont(random(fonts));
for(let i = thetext.length-1;i>=0;i--)
{
if(thetext[i]=='') thetext.splice(i, 1);
}
}
function draw() {
background(230,230,250);
textSize(50);
textAlign(CENTER, CENTER);
rect(0,0,100,100);
push();
translate(100,100);
fill(139,0,0)
rotate( radians(frameCount) );
text('talesofpassedtime', 0,0);
pop(); //top left
push();
translate(100,500);
fill(30,144,255)
rotate( radians(frameCount) );
text('talesofpassedtime', 0,0);
pop(); // bottom left
push();
translate(500,100);
fill(255,140,0)
rotate( radians(frameCount) );
text('talesofpassedtime', 0,0);
pop(); //second to the left
push();
translate(500,500);
fill(0,0,139)
rotate( radians(frameCount) );
text('talesofpassedtime', 0,0);
pop(); //second bottom left
push();
translate(900,100);
fill(255,215,0)
rotate( radians(frameCount) );
text('talesofpassedtime', 0,0);
pop();// third from top left
push();
translate(900,500);
fill(123,104,238)
rotate( radians(frameCount) );
text('talesofpassedtime', 0,0);
pop(); //bottom third from left
push();
translate(1300, 100);
fill(60,179,113)
rotate( radians(frameCount) );
text('talesofpassedtime', 0,0);
pop();
push();
translate(1300,500);
fill(75,0,130)
rotate( radians(frameCount) );
text('talesofpassedtime', 0,0);
pop();
if(frameCount%fadespeed==0)
{
textFont(random(fonts));
theline = random(thetext);
tw = textWidth(theline);
th = textAscent()+textDescent();
}
// fade in the box and get to full opacity halfway in:
let alpha = frameCount%fadespeed/fadespeed/2*255.
noFill();
//stroke(70, 70, 32, alpha);
rect(width/2, height/2, tw, th); // draw a box!
noStroke();
fill(0, 0, 0, alpha);
text(theline, width/2, height/2); // draw the text!
}