The time mode doesn't run in this method!
in
Programming Questions
•
2 years ago
Hi y'all. Here's my code:
Texto timeFly;
void setup() {
size(300, 300);
background(0);
color tempColore = color(255, 0, 0);
int tempH = hour();
int tempM = minute();
int tempS = second();
timeFly = new Texto(tempColore, tempH, tempM, tempS);
}
void draw() {
background(0);
timeFly.display();
timeFly.follow();
}
// Texto Class Block
class Texto { // class name
color colore; // data fields
float x;
float y;
int h;
int m;
int s;
Texto(color tempColore, int tempH, int tempM, int tempS) { // constructor
colore = tempColore;
h = tempH;
m = tempM;
s = tempS;
}
void display() { // method #1
PFont font;
font = loadFont("Helvetica-Bold-48.vlw");
textFont(font);
textSize(48);
text(h + ":" + m + ":" + s, x, y);
}
void follow() { // method #2
float easing = 0.2;
float targetX = mouseX;
float targetY = mouseY;
x = x + (targetX - x) * easing;
y = y + (targetY - y) * easing;
}
}
//-------------------------------------------------//
Below is what it looks like:
I created the font using Helvetica-Bold-48 type. When run, the time display hour:minute:second and follows mouseX and mouseY loosely with easing, but the time does not "tick". It just freezes like a normal line of typefaces.
Any help would be really appreciated. Thanks.
1