xxxxxxxxxx
55
let myFont;
let myImage;
let messages = ['pleasure', 'joy', 'happiness', 'excitement', 'awe', 'sadness', 'gloomy', 'lonely', 'unhappy', 'miserable', 'worried', 'anxious', 'nervous', 'panicked', 'stressed', 'bitter', 'annoyed', 'mad', 'insulted', 'frustrated', 'dislike', 'offended', 'horrified', 'revulsion', 'aversion'];
let i;
let pause = false;
//calling out the font and image
function preload(){
myFont = loadFont ('ProtestRiot-Regular.ttf');
myImage = loadImage('emojis.png');
}
//setting up the canvas with an image
function setup() {
createCanvas(400, 500);
scale(1/2);
image(myImage,0,0);
}
function draw() {
//displaying random text in random position with random color
for (i=0; i<5; i++){
frameRate(3);
let message = random(messages);
stroke(0);
fill(random(255), random(255), random(255), 220);
textFont(myFont);
textSize(50);
text(message, random(0, 300), random(0,500));
}
}
//when mouse is pressed, random display of words pause/resume
function mousePressed(){
if(pause == false){
noLoop();
pause=true;
}
else {
loop();
pause=false;
}
}