Hi. I am a total noob to object classes. I do not know what I am doing wrong. Here’s an image of the prototype:
I am trying to create an object class for the encircled cards.
I have saved the class on a separate page.
I don’t know which piece of code is causing the problem in this case. The main page or the class page.
Here’s the main code where I call the function:
void setup() {
size(1200, 750);
background(bg);
montserratExtraBold = createFont("montserratExtraBold.ttf", headingSize);
montserratRegular = createFont("montserratRegular.ttf", callToActionSize);
y1 = new Timeline_Years();
y1.display();
}
Here’s the code for the class
//constructor
Timeline_Years(){
//text
yearOriginX = 132;
yearOriginY = 171;
year = "1900";
yearColor = #FEFEFE;
//background
boxOriginX = 163;
boxOriginY = 124;
boxColor = #ffffff;
boxWidth = 74;
boxHeight = 45;
}
//functions
void display(){
//bg
fill(boxColor);
rect(boxOriginX, boxOriginY, boxWidth, boxHeight);
//text
int yearSize;
yearSize = 20;
PFont montserratBold;
montserratBold = createFont("montserratBold.ttf", yearSize);
fill(yearColor);
textFont(montserratBold);
text(year, yearOriginX, yearOriginY);
}
}
Here’s a link to the zipped version of the file in case that helps:
Thanks in advance.