xxxxxxxxxx
243
let positives = [
"the colors in the sunset",
"going home this weekend",
"my sister",
"sadie",
"my friends",
"taking walks",
"breathing in fresh air",
"kindness",
"women",
"remember to breathe",
"listen to music",
"meditate",
"reading a book",
"lia",
"elianna",
"ev",
"sienna",
"creating art",
"visiting home",
"trying new things",
"my role models",
"milani",
"athena",
"yahir",
"my room",
"watching movies",
"my bed",
];
let negatives = [
"the election",
"what will the future bring",
"im scared for my friends",
"constant stress",
"procrastination",
"what do you want to be when you grow up?",
"volleyball",
"loss of rights",
"the future",
"trump",
"self-doubt",
"hatred",
"war",
"people in power",
];
let goodFont;
let badFont;
let calmSnd;
//good and bad - size
let goodThing;
let badThing;
let goodSize = 15;
let badSize = 100;
let sizeGrowth = true;
let goodFade = 5;
let badFade = 200;
let fadeTime = true;
//breathing circle animation
let x;
let y;
let circleWidth = 20;
let isGrowing = true; //this tracks if the circle is growing
//the drunk walk backround part
let r = 0;
let b = 255;
let g = 0;
let x1;
let y1;
let xSpeed = 2;
let ySpeed = 1;
function preload() {
goodFont = loadFont("happygood.ttf");
badFont = loadFont("badfont.ttf");
calmSnd = loadSound("calm.mp3");
}
function setup() {
createCanvas(windowWidth, windowHeight);
x = windowWidth / 2;
y = windowHeight / 2;
x1 = random(width);
y1 = random(height);
textFont(goodFont);
goodThing = random(positives);
textSize(goodSize);
print(goodThing);
textFont(badFont);
badThing = random(negatives);
textSize(badSize);
print(badThing);
textAlign(CENTER, CENTER);
ellipseMode(CENTER);
calmSnd.loop();
}
function draw() {
//the moving circle
r = map(x1, 0, windowWidth, 0, 255);
b = map(x1, 0, windowWidth, 255, 0);
g = map(y1, 0, windowHeight, 0, 255);
noStroke();
fill(r, g, b);
circle(x1, y1, circleWidth / 4);
print(circleWidth);
x1 = x1 + xSpeed;
y1 = y1 + ySpeed;
if (x1 > windowWidth || x1 < 0) {
xSpeed = xSpeed * -1;
}
if (y1 > windowHeight || y1 < 0) {
ySpeed = ySpeed * -1;
}
//if circle gets to x size it shrinks, if it gets to y size it grows
//how do I have the growth rate of the circle be different then the occurance of the words
//i want frame rate of circle to be 60
//circle growth/shrink logic
//frame rate of words 3,4,5?
//should I use the map feature?
textFont(goodFont);
fill(random(255), random(255), random(255), goodFade);
textSize(goodSize); //this is the starting size
goodThing = random(positives);
text(goodThing, random(width), random(height));
print("good text size" + goodSize);
print("good fade level" + goodFade);
textFont(badFont);
fill(0, 0, 0, badFade);
textSize(badSize); //this is the starting size
badThing = random(negatives);
text(badThing, random(width), random(height));
print("bad text size" + badSize);
print("bad fade level" + badFade);
//breathing circle animation
//noStroke();
stroke(1);
strokeWeight(1);
fill("rgb(61,61,111)");
circle(x, y, circleWidth);
print(circleWidth);
if (isGrowing) {
//isGrowing = true;
circleWidth += 1; //increase the size
} else {
//isGrowing = false;
circleWidth -= 1; //decrease the size
}
if (circleWidth >= windowWidth / 1.5) {
isGrowing = false; //starts going smaller
} else if (circleWidth <= 20) {
isGrowing = true; //starts grow
}
//remember to breathe text
if (circleWidth >= windowWidth / 4) {
textFont(goodFont);
fill(255);
textSize(24);
text("remember", windowWidth / 2 - 5, windowHeight / 2 - 9);
text("to breathe...", windowWidth / 2 + 5, windowHeight / 2 + 9);
}
//good fade
if (fadeTime) {
goodFade += 1;
} else {
goodFade -= 1;
}
if (goodFade <= 5) {
fadeTime = true;
} else if (goodFade >= 255) {
fadeTime = false;
}
//bad fade
if (fadeTime) {
badFade -= 1;
} else {
badFade += 1;
}
if (badFade >= 200) {
fadeTime = false;
} else if (badFade <= 0) {
fadeTime = true;
}
//the good text size growing/shrinking
if (sizeGrowth) {
//sizeGrowth = true;
goodSize += 0.01; //increase the size of good text
} else {
//sizeGrowth = false;
goodSize -= 0.01;
}
if (goodSize <= 20) {
sizeGrowth = true; //starts to grow??
} else if (goodSize >= 200) {
sizeGrowth = false; //starts to shrink??
}
//the bad text size growing/shrinking
if (sizeGrowth) {
badSize -= 0.01;
} else {
badSize += 0.01;
}
if (badSize <= 20) {
sizeGrowth = false; //starts to grow
} else if (badSize >= 100) {
sizeGrowth = true; //starts to shrink
}
}
//sound
//click to...