xxxxxxxxxx
107
//Spotlight
//Written by Julie Lizardo
//flags
let over1=false;
let over2=false;
let over3=false;
//fonts
let font1;
let colorArr =['#1F2421', '#216869', '#49A078', '#9CC5A1', '#DCE1DE'];
function preload()
{
font1 =loadFont("Assets/PermanentMarker-Regular.ttf");
}
function setup() {
createCanvas(600, 600);
background(colorArr[0]);
noStroke();
}
function draw() {
background(colorArr[0]);
//console.log(mouseX, mouseY);
//draw flashlight
fill(colorArr[4]);
circle(mouseX, mouseY, 100);
textSize(40);
text("Look Around!",300,590);
// update any flags
mouseOver();
//check flags for each word and display them
if (over1)
{
fill(colorArr[2]);
}
else
{
noFill()
}
textSize(60);
text("Discover",100,100);
if (over2)
{
fill(colorArr[3]);
}
else
{
noFill()
}
textFont(font1);
textSize(20);
text("Don't be afraid to explore!",20,400,10,200);
if (over3)
{
fill(colorArr[1]);
}
else
{
noFill()
}
//fill(255);
textSize(50)
text("Yourself",300,300);
}
// create and update flags that mark if mouse is over word
function mouseOver()
{
//Discover
//Points of reference: (137, 77) (304,80)
if ((mouseX>=137 && mouseX<=304)&&((mouseY>=77)&& (mouseY<=80)))
{
over1 =true;
}
//Dont be afarid to explore
//Points of reference: (41, 437) (59,507)
if ((mouseX>=41 && mouseX<=59)&&((mouseY>=437)&& (mouseY<=507)))
{
over2 =true;
}
//Yourself
//Points of reference: (336, 382) (448,281)
if ((mouseX>=336 && mouseX<=448)&&((mouseY>=281)&& (mouseY<=382)))
{
over3 =true;
}
}