Hello guys,
I’m trying to create something relatively simple based on some studies that I made but now I’m facing an issue I don’t know enough about to solve.
My idea is to change the font from light to regular and then to bold based on MouseX position. I thought using If clause and adding all 3 fonts with PFont could be enough but don’t work, do you have any clue about how to do it?
Now my sketch is just using the last font added and the If clauses are not being used.
Here is my sketch:
void setup ()
{
size (1000, 700);
PFont light;
light = createFont ("PPNeueMachina-Ultralight.ttf", 40);
textFont (light);
PFont regular;
regular = createFont ("PPNeueMachina-Regular.ttf", 40);
textFont (regular);
PFont bold;
bold = createFont ("PPNeueMachina-Ultrabold.ttf", 40);
textFont (bold);
}
String theText = "A";
void draw () {
background (255, 241, 209);
int i = 0;
textAlign(CENTER, CENTER);
int stepSize = mouseX/20+5;
for (int x=0; x<width+20; x=x+20+stepSize)
for (int y=0; y<height+20; y=y+20+stepSize)
{
char t = theText.charAt(i);
fill (196, 88, 108);
text (t, x, y);
if (y < 350) {
PFont light;
}
if (350 > y && y < 650) {
PFont regular;
}
if (y < 650) {
PFont bold;
}
i=i+1;
if (i>theText.length()-1)
{
i=0;
}
}
}
I really appreciate your help, will help me a lot!
Thanks!
Always peruse the Processing resources (tutorials, references, examples, etc.) related to your code and you will glean lots of insight. You will benefit in the long run.
In the end the end the best solutions are the ones you work through and find yourself.