Tweak the animation and placement

* Move the animation between the logo and the text
* Move text further below
* Change circles to 3 (like ...) and increase speed to 5
* Change circles radius, distance, amplitude
* Draw empty circles instead of full circles, to be used with a logo
  that also has an outline
This commit is contained in:
Oliver Smith 2022-07-31 21:10:04 +02:00 committed by Caleb Connolly
parent 817f988022
commit 2d79d8ad6a
No known key found for this signature in database
GPG key ID: 0583312B195F64B6
3 changed files with 12 additions and 11 deletions

View file

@ -10,6 +10,6 @@ struct col {
}; };
}; };
void animate_frame(int frame, int w, int h, long dpi); void animate_frame(int frame, int w, int y_off, long dpi);
#endif #endif

View file

@ -8,18 +8,18 @@ struct col color = { .r = 255, .g = 255, .b = 255, .a = 255 };
#define PI 3.1415926535897932384626433832795 #define PI 3.1415926535897932384626433832795
#define n_circles 5 #define n_circles 3
#define speed 3 #define speed 5
void circles_wave(int frame, int w, int y_off, long dpi) void circles_wave(int frame, int w, int y_off, long dpi)
{ {
unsigned int t_col = tfb_make_color(color.r, color.g, color.b); unsigned int t_col = tfb_make_color(color.r, color.g, color.b);
int f = frame * speed; int f = frame * speed;
int rad = (int)(dpi * 4 / 96.0); int rad = (int)(dpi * 3 / 96.0);
int dist = rad * 4; int dist = rad * 3;
int amplitude = rad * 2; int amplitude = rad * 1;
int left = (w / 2) - (dist * (n_circles - 1) / 2.0); int left = (w / 2) - (dist * (n_circles - 1) / 2.0);
for (unsigned int i = 0; i < n_circles; i++) { for (unsigned int i = 0; i < n_circles; i++) {
@ -28,11 +28,11 @@ void circles_wave(int frame, int w, int y_off, long dpi)
int y = y_off + offset * amplitude; int y = y_off + offset * amplitude;
tfb_fill_rect(x - rad - 1, y_off - amplitude - rad, rad * 2 + 2, tfb_fill_rect(x - rad - 1, y_off - amplitude - rad, rad * 2 + 2,
amplitude * 2 + rad * 2 + 1, tfb_black); amplitude * 2 + rad * 2 + 1, tfb_black);
tfb_fill_circle(x, y, rad, t_col); tfb_draw_circle(x, y, rad, t_col);
} }
} }
void animate_frame(int frame, int w, int h, long dpi) void animate_frame(int frame, int w, int y_off, long dpi)
{ {
circles_wave(frame, w, h * 0.75, dpi); circles_wave(frame, w, y_off, dpi);
} }

View file

@ -364,7 +364,7 @@ int main(int argc, char **argv)
&textHeight); &textHeight);
int tx = screenWidth / 2.f - textWidth / 2.f; int tx = screenWidth / 2.f - textWidth / 2.f;
int ty = y + image_h + textHeight * 0.5f + MM_TO_PX(dpi, 2); int ty = y + image_h + textHeight * 0.5f + MM_TO_PX(dpi, 20);
draw_text(font, message, tx, ty, textWidth, textHeight, fontsz, draw_text(font, message, tx, ty, textWidth, textHeight, fontsz,
tfb_gray); tfb_gray);
@ -375,8 +375,9 @@ int main(int argc, char **argv)
int frame = 0; int frame = 0;
int tty = open(active_tty, O_RDWR); int tty = open(active_tty, O_RDWR);
float y_off = y + image_h + MM_TO_PX(dpi, 5);
while (!terminate) { while (!terminate) {
animate_frame(frame++, screenWidth, screenHeight, dpi); animate_frame(frame++, screenWidth, y_off, dpi);
tfb_flush_fb(); tfb_flush_fb();
} }