xxxxxxxxxx
72
let words = [
"Anxiety",
"Pressure",
"Tension",
"Overwhelmed",
"Stress",
"Worry",
"Panic",
"Fear",
"Nervous",
"Chaos",
"Rushed",
"Restless",
"Doubt",
"Unease",
"Frantic",
"Frustration",
"Fatigue",
"Hurry",
"Jittery",
"Numb",
];
let wordObjects = [];
let timer = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
textSize(30);
textAlign(CENTER, CENTER);
// the words
for (let i = 0; i < 5; i++) {
wordObjects.push({
word: random(words),
x: random(width),
y: random(height),
color: color(random(100, 150), random(100, 150), random(100, 150)),
});
}
}
function draw() {
background(180, 200, 230);
for (let wordObj of wordObjects) {
fill(wordObj.color);
text(wordObj.word, wordObj.x, wordObj.y);
}
// timer
if (millis() - timer > 500) {
updateWordsAndPositions();
timer = millis();
}
}
// randomize everything
function updateWordsAndPositions() {
for (let wordObj of wordObjects) {
wordObj.word = random(words);
wordObj.x = random(width);
wordObj.y = random(height);
}
}
function mousePressed() {
if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
let fs = fullscreen();
fullscreen(!fs);
}
}