Having trouble making text appear with mouse pressed command (tryed for three hours already)
in
Programming Questions
•
8 months ago
Hello, I would apprciate any hints or help that anyone can spare with this. I m still pretty new to processing but need to figure this out by tomorrow for a college digital art assignment.
I really need to have the text labeled as greetings in this program not visible until the mouse is hovered over it. Once the mouse is pressed over the greeting, the ending should appear.
I have watched many tutorials and read in forums about similar programs, I am just extremly stuck, any help or suggestions appreciated, thanks for your time.
Here is my code, it should run as is so you can see the concept at least, I took out my attempted mouse commands after no sucess:
//I am bringing into the program my image of an orange figure, I am also
//listing the greetings, responses, and amounts.
int randomNum=0;
PImage Orangeguy;
String greeting [] = {"Hi"," hey"," Hows it going"," Hello"," whatsup", "good morning"};
int greetingamount [] = {13, 16, 16, 7, 2, 1};
String ending [] = {"See You Later", "Thanks", "have a good night", "Bye", "Peace Out", "Adios"};
int endingamount [] = {12, 4, 8, 7, 3, 1};
PImage Orangeguy;
String greeting [] = {"Hi"," hey"," Hows it going"," Hello"," whatsup", "good morning"};
int greetingamount [] = {13, 16, 16, 7, 2, 1};
String ending [] = {"See You Later", "Thanks", "have a good night", "Bye", "Peace Out", "Adios"};
int endingamount [] = {12, 4, 8, 7, 3, 1};
//This math was used to determine how large to make the ellipses, the largest ellipse is one hundred.
///Math(greetings): 13/16=.8125 so hi is 81.25% of hey, 7/16 = .4375, 2/16=.125
//Math(Ending): 12=100, 8=66, 7=58, 4=33, 3=25, 1=8
///Math(greetings): 13/16=.8125 so hi is 81.25% of hey, 7/16 = .4375, 2/16=.125
//Math(Ending): 12=100, 8=66, 7=58, 4=33, 3=25, 1=8
//here I am setting up the basic settings for the document
void setup(){
size(1200,690);
background(85, 211, 247);
smooth();
stroke(50,100,150);
strokeWeight(2);
//setting font
PFont SeanFont;
SeanFont = loadFont("ARCENA-48.vlw");
textFont(SeanFont);
//loading figure that was created in illustrator
Orangeguy = loadImage("Orange_figure2.png");
//for (int i = 0; i < greeting.length; i++) greeting[i];
}
void draw() {
//I am placing the figures on the background and
//placing the ellipses in a way I find visually appealing,
//the size of the ellipses is based on the math done before setup
//and represents the amount of times the word was spken
background(85, 211, 247);
image(Orangeguy, 200, 340);
image(Orangeguy, 800, 340);
//6 Ellipses for Greetings, starting from biggest
fill(252, 252, 54);
ellipse(480, 80, 100, 100);
fill( 242, 93, 105);
ellipse(360, 70, 100, 100);
fill(85, 247, 116);
ellipse(390, 170, 81, 81);
fill(52, 60, 247);
ellipse(360, 240, 44, 44);
fill(173, 57, 237);
ellipse(340, 280, 13, 13);
fill(247, 52, 214);
ellipse(330, 300, 7, 7);
//6 ellipses for responses, starting from biggest
fill(252, 252, 54);
ellipse(700, 100, 100, 100);
fill( 242, 93, 105);
ellipse(810, 108, 66, 66);
fill(85, 247, 116);
ellipse(765, 190 , 81, 81);
fill(52, 60, 247);
ellipse(810, 255, 44, 44);
fill(173, 57, 237);
ellipse(835, 290, 13, 13);
fill(247, 52, 214);
ellipse(850, 310, 8, 8);
//Base Level for figures
fill( 85, 247, 116);
rect( 100, 654, 1000, 100);
//placing the greetings
fill(0, 96, 2);
text(greeting[0], 465, 90);
textSize(48);
text(greeting[1], 320, 80);
text(greeting[2], 280, 180);
text(greeting[3], 310, 240);
text(greeting[4], 270, 280);
text(greeting[5], 250, 320);
//placing the endings
text(ending[0],700, 80);
text(ending[1],810,130);
text(ending[2],765,190);
text(ending[3],810,230);
text(ending[4],845,270);
text(ending[5],860,310);
}
//translate(mouseX, mouseY);
Orangeguy = loadImage("Orange_figure2.png");
//for (int i = 0; i < greeting.length; i++) greeting[i];
}
void draw() {
//I am placing the figures on the background and
//placing the ellipses in a way I find visually appealing,
//the size of the ellipses is based on the math done before setup
//and represents the amount of times the word was spken
background(85, 211, 247);
image(Orangeguy, 200, 340);
image(Orangeguy, 800, 340);
//6 Ellipses for Greetings, starting from biggest
fill(252, 252, 54);
ellipse(480, 80, 100, 100);
fill( 242, 93, 105);
ellipse(360, 70, 100, 100);
fill(85, 247, 116);
ellipse(390, 170, 81, 81);
fill(52, 60, 247);
ellipse(360, 240, 44, 44);
fill(173, 57, 237);
ellipse(340, 280, 13, 13);
fill(247, 52, 214);
ellipse(330, 300, 7, 7);
//6 ellipses for responses, starting from biggest
fill(252, 252, 54);
ellipse(700, 100, 100, 100);
fill( 242, 93, 105);
ellipse(810, 108, 66, 66);
fill(85, 247, 116);
ellipse(765, 190 , 81, 81);
fill(52, 60, 247);
ellipse(810, 255, 44, 44);
fill(173, 57, 237);
ellipse(835, 290, 13, 13);
fill(247, 52, 214);
ellipse(850, 310, 8, 8);
//Base Level for figures
fill( 85, 247, 116);
rect( 100, 654, 1000, 100);
//placing the greetings
fill(0, 96, 2);
text(greeting[0], 465, 90);
textSize(48);
text(greeting[1], 320, 80);
text(greeting[2], 280, 180);
text(greeting[3], 310, 240);
text(greeting[4], 270, 280);
text(greeting[5], 250, 320);
//placing the endings
text(ending[0],700, 80);
text(ending[1],810,130);
text(ending[2],765,190);
text(ending[3],810,230);
text(ending[4],845,270);
text(ending[5],860,310);
}
//translate(mouseX, mouseY);
//void mousePressed(){
// background(85, 211, 247);
1