Compare commits

..

12 Commits
v2.0.0 ... main

Author SHA1 Message Date
AngelJumbo
8a78d224f3
Merge pull request #8 from luvth/patch-1
Added sudo for creating the file in /bin
2025-04-19 13:56:39 -05:00
luvth
5d64841acc
Update README.md 2025-04-19 16:36:27 +02:00
AngelJumbo
76142a8031
Update README.md 2025-04-18 23:34:33 -05:00
AngelJumbo
8c27f06ffd
Merge pull request #7 from AngelJumbo/gradient
Gradient options
2025-04-18 18:56:51 -05:00
AngelJumbo
a8b09e8b8a merge gradient colors into the -c and -k options 2025-04-18 18:53:01 -05:00
AngelJumbo
79f1857781 gradient test 2025-03-25 07:41:23 -05:00
AngelJumbo
1a7b55d715 Cross-platform install 2025-03-23 07:33:31 -05:00
AngelJumbo
cfed09d5ba
Merge pull request #5 from sheeeng/fix/return-type-warning
fix: return type warning
2024-10-11 19:22:49 -05:00
Leonard Sheng Sheng Lee
3fc48166fb
fix: return type warning
Signed-off-by: Leonard Sheng Sheng Lee <leonard.sheng.sheng.lee@gmail.com>
2024-10-11 10:34:31 +02:00
AngelJumbo
560d2533f3 in runtime change colors and the party mode 2024-01-24 22:07:35 -05:00
AngelJumbo
3e5a023ee8 typo 2023-01-14 11:48:37 -05:00
AngelJumbo
c43c401594 updated -h option 2023-01-14 09:39:46 -05:00
3 changed files with 312 additions and 118 deletions

View File

@ -9,7 +9,7 @@ Requirements: A Unix-like system, a C compiler and make.
``` ```
git clone https://github.com/AngelJumbo/lavat git clone https://github.com/AngelJumbo/lavat
cd lavat cd lavat
make install sudo make install
``` ```
### Arch Linux ### Arch Linux
@ -22,23 +22,50 @@ $ paru -S lavat-git
``` ```
Usage: lavat [OPTIONS] Usage: lavat [OPTIONS]
OPTIONS: OPTIONS:
-c <COLOR> Set color. Available colours: red, blue, yellow, green, cyan and magenta. -g Enable gradient mode with truecolor support.
Besides those colors the default one is the normal foreground of your terminal. Changes how -c and -k options work.
-c <COLOR> Set color. In normal mode, available colors are: red, blue, yellow, green, cyan, magenta, white, and black.
In gradient mode (-g), use hex format: RRGGBB (e.g., FF0000 for red).
-k <COLOR> Set the rim color. Same format options as -c.
In gradient mode, this sets the second color for the gradient.
-s <SPEED> Set the speed, from 1 to 10. (default 5) -s <SPEED> Set the speed, from 1 to 10. (default 5)
-r <RADIUS> Set the radius of the metaballs, from 1 to 10. (default: 5) -r <RADIUS> Set the radius of the metaballs, from 1 to 10. (default: 5)
-R <RIM> Set a rim for each metaball, sizes from 1 to 5.(default: none) -R <RIM> Set a rim for each metaball, sizes from 1 to 5.(default: none)
This option does not work with the default color. This option does not work with the default color
-k <COLOR> Set the color of the rim if there is one. Available colours: red, blue, yellow, green, cyan and magenta. If you use Kitty or Alacritty you must use it with the -k option to see the rim.
-b <NBALLS> Set the number of metaballs in the simulation, from 2 to 20. (default: 10) -b <NBALLS> Set the number of metaballs in the simulation, from 5 to 20. (default: 10)
-F <CHARS> Allows for a custom set of chars to be used -F <CHARS> Allows for a custom set of chars to be used
Only ascii symbols are supported for now, wide/unicode characters may appear broken. Only ascii symbols are supported for now, wide/unicode chars may appear broken.
-C Retain the entire lava inside the terminal. -C Retain the entire lava inside the terminal.
It may not work well with a lot of balls or with a bigger radius than the default one. It may not work well with a lot of balls or with a bigger radius than the default one.
-p <MODE> PARTY!! THREE MODES AVAILABLE (p1, p2 and p3).
-h Print help. -h Print help.
RUNTIME CONTROLS:
i Increase radius of the metaballs.
d Decrease radius of the metaballs.
shift i Increase rim of the metaballs.
shift d Decrease rim of the metaballs.
m Increase the number of metaballs.
l Decrease the number metaballs.
c Change the color of the metaballs.
k Change the rim color of the metaballs.
+ Increase speed.
- Decrease speed.
p TURN ON THE PARTY AND CYCLE THROUGH THE PARTY MODES (it can also turns off the party).
(Tip: Zoom out in your terminal before running the program to get a better resolution of the lava).
EXAMPLES:
lavat -c green -k red Use named colors in normal mode
lavat -g -c 00FF00 -k FF0000 Use hex colors in gradient mode
``` ```
## Demo ## Demo
`lavat -p3`
![demo 1](https://github.com/AngelJumbo/demos/blob/main/lavat/6.gif?raw=true)
PARTY MODE!!!
`lavat -c red -R 1` `lavat -c red -R 1`
![demo 1](https://github.com/AngelJumbo/demos/blob/main/lavat/1.gif?raw=true) ![demo 1](https://github.com/AngelJumbo/demos/blob/main/lavat/1.gif?raw=true)

299
lavat.c
View File

@ -1,4 +1,6 @@
#define TB_IMPL #define TB_IMPL
#define TB_LIB_OPTS
#define TB_OPT_TRUECOLOR
#include "termbox.h" #include "termbox.h"
#include <stdio.h> #include <stdio.h>
@ -6,6 +8,7 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <float.h>
#define MIN_NBALLS 5 #define MIN_NBALLS 5
#define MAX_NBALLS 20 #define MAX_NBALLS 20
@ -17,15 +20,22 @@ typedef struct {
int dy; int dy;
} Ball; } Ball;
uintattr_t pallete[11];
int baseColor[3];
int baseColor2[3];
short gradient1=0;
short gradient2=0;
static char *custom = NULL; static char *custom = NULL;
static char *custom2 = NULL; static char *custom2 = NULL;
static short color = TB_DEFAULT; static short color = TB_WHITE;
static short color2 = TB_DEFAULT; static short color2 = TB_WHITE;
static short party = 0;
static int nballs = 10; static int nballs = 10;
static short speedMult = 5; static short speedMult = 5;
static short rim = 0; static short rim = 1;
static short contained = 0; static short contained = 0;
static float radiusIn = 100; static float radiusIn = 110;
static float radius; static float radius;
static int margin; static int margin;
static float sumConst; static float sumConst;
@ -34,24 +44,63 @@ static int maxX,maxY;
static int speed; static int speed;
static Ball balls[MAX_NBALLS] = {0}; static Ball balls[MAX_NBALLS] = {0};
static struct tb_event event = {0}; static struct tb_event event = {0};
static short colors[]={TB_WHITE, TB_RED, TB_YELLOW, TB_BLUE, TB_GREEN, TB_MAGENTA, TB_CYAN, TB_BLACK };
void init_params(); void init_params();
void event_handler(); void event_handler();
int parse_options(int argc, char *argv[]); int parse_options(int argc, char *argv[]);
void print_help(); void print_help();
short next_color(short current);
void fix_rim_color();
void set_random_colors(short level);
void set_pallete();
uintattr_t get_color(float val);
void set_pallete2();
int set_color(short *var, int *baseColor, char *optarg, short useGradient) {
if (useGradient) {
// Parse hex color
if (sscanf(optarg, "%02x%02x%02x", &baseColor[0], &baseColor[1], &baseColor[2]) == 3) {
return 1;
} else {
printf("Invalid hex color format. Use format: RRGGBB\n");
return 0;
}
} else {
// Parse named color
if (strcmp(optarg, "red") == 0) {
*var = TB_RED;
} else if (strcmp(optarg, "yellow") == 0) {
*var = TB_YELLOW;
} else if (strcmp(optarg, "blue") == 0) {
*var = TB_BLUE;
} else if (strcmp(optarg, "green") == 0) {
*var = TB_GREEN;
} else if (strcmp(optarg, "magenta") == 0) {
*var = TB_MAGENTA;
} else if (strcmp(optarg, "cyan") == 0) {
*var = TB_CYAN;
} else if (strcmp(optarg, "black") == 0) {
*var = TB_BLACK;
} else if (strcmp(optarg, "white") == 0) {
*var = TB_WHITE;
} else {
printf("Unknown color: %s\n", optarg);
return 0;
}
return 1;
}
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (!parse_options(argc, argv)) if (!parse_options(argc, argv))
return 0; return 0;
if (color == TB_DEFAULT && !custom)
rim = 0;
time_t t; time_t t;
// Ball *balls = malloc(sizeof(Ball) * nballs); // Ball *balls = malloc(sizeof(Ball) * nballs);
srand((unsigned)time(&t)); srand((unsigned)time(&t));
tb_init(); tb_init();
@ -60,6 +109,7 @@ int main(int argc, char *argv[]) {
init_params(); init_params();
while (1) { while (1) {
// move balls // move balls
@ -87,13 +137,28 @@ int main(int argc, char *argv[]) {
for (int k = 0; k < nballs; k++) { for (int k = 0; k < nballs; k++) {
int y = j * 2 + j2; int y = j * 2 + j2;
sum[j2] += (radius * radius) / float dist_squared = (i - balls[k].x) * (i - balls[k].x) + (y - balls[k].y) * (y - balls[k].y);
((float)((i - balls[k].x) * (i - balls[k].x) + if (dist_squared == 0) {
(y - balls[k].y) * (y - balls[k].y))); sum[j2] += FLT_MAX;
} else {
sum[j2] += (radius * radius) / dist_squared;
}
} }
} }
if (!custom) { if (!custom) {
if(gradient1){
if (sum[0] > sumConst) {
if (sum[1] > sumConst) {
tb_printf(i, j, get_color( sum[0]), get_color(sum[1]), "");
} else {
tb_printf(i, j, get_color( sum[0]), TB_TRUECOLOR_DEFAULT, "");
}
} else if (sum[1] > sumConst) {
tb_printf(i, j,get_color( sum[1]),TB_TRUECOLOR_DEFAULT, "");
}
}else{
if (sum[0] > sumConst) { if (sum[0] > sumConst) {
if (sum[1] > sumConst) { if (sum[1] > sumConst) {
tb_printf(i, j, color2, 0, ""); tb_printf(i, j, color2, 0, "");
@ -115,6 +180,7 @@ int main(int argc, char *argv[]) {
tb_printf(i, j, color2, color, ""); tb_printf(i, j, color2, color, "");
} }
} }
}
} else { } else {
if (sum[0] > sumConst) { if (sum[0] > sumConst) {
tb_printf(i, j, color2, 0, custom2); tb_printf(i, j, color2, 0, custom2);
@ -128,6 +194,9 @@ int main(int argc, char *argv[]) {
} }
} }
} }
if (party>0){
set_random_colors(party);
}
tb_present(); tb_present();
usleep(speed); usleep(speed);
tb_clear(); tb_clear();
@ -135,7 +204,6 @@ int main(int argc, char *argv[]) {
tb_peek_event(&event, 10); tb_peek_event(&event, 10);
event_handler(); event_handler();
} }
tb_shutdown(); tb_shutdown();
@ -185,38 +253,46 @@ void event_handler(){
} }
break; break;
case 'i': case 'i':
if(radiusIn+10<=150){ if (radiusIn + 5 <= 150) {
radiusIn+=10; radiusIn += 5;
radius = (radiusIn * radiusIn + (float)(maxX * maxY)) / 15000; radius = (radiusIn * radiusIn + (float)(maxX * maxY)) / 15000;
margin = contained ? radius * 10 : 0; margin = contained ? radius * 10 : 0;
} }
break; break;
case 'd': case 'd':
if(radiusIn-10>=50){ if (radiusIn - 5 >= 100) {
radiusIn-=10; radiusIn -= 5;
radius = (radiusIn * radiusIn + (float)(maxX * maxY)) / 15000; radius = (radiusIn * radiusIn + (float)(maxX * maxY)) / 15000;
margin = contained ? radius * 10 : 0; margin = contained ? radius * 10 : 0;
} }
break; break;
case 'I': case 'I':
if (color != TB_DEFAULT || custom) if (color != TB_WHITE || custom || gradient1 )
if (rim + 1 <= 5) { if (rim + 1 <= 5) {
rim++; rim++;
sumConst2 = sumConst * (1 + (float)(0.25 * rim)); sumConst2 = sumConst * (1 + (float)(0.25 * rim));
} }
break; break;
case 'D': case 'D':
if (color != TB_DEFAULT || custom) if (color != TB_WHITE || custom || gradient1)
if (rim - 1 >= 0) { if (rim - 1 >= 0) {
rim--; rim--;
sumConst2 = sumConst * (1 + (float)(0.25 * rim)); sumConst2 = sumConst * (1 + (float)(0.25 * rim));
} }
break; break;
case 'c':
color = next_color(color);
fix_rim_color();
break;
case 'k':
color2 = next_color(color2);
fix_rim_color();
break;
case 'p':
party = (party+1)%4;
break;
case 'q': case 'q':
case 'Q': case 'Q':
tb_shutdown(); tb_shutdown();
@ -226,7 +302,6 @@ void event_handler(){
} }
} }
void init_params() { void init_params() {
maxX = tb_width(); maxX = tb_width();
@ -242,7 +317,7 @@ void init_params(){
custom2 = custom; custom2 = custom;
if (color2 == TB_DEFAULT || !rim) if (color2 == TB_WHITE || !rim)
color2 = color | TB_BOLD; color2 = color | TB_BOLD;
if (custom && strlen(custom) > 1 && rim) { if (custom && strlen(custom) > 1 && rim) {
@ -255,42 +330,65 @@ void init_params(){
balls[i].dx = (rand() % 2 == 0) ? -1 : 1; balls[i].dx = (rand() % 2 == 0) ? -1 : 1;
balls[i].dy = (rand() % 2 == 0) ? -1 : 1; balls[i].dy = (rand() % 2 == 0) ? -1 : 1;
} }
if(gradient1){
tb_set_output_mode(TB_OUTPUT_TRUECOLOR);
tb_set_clear_attrs(TB_TRUECOLOR_DEFAULT, TB_TRUECOLOR_DEFAULT);
if(gradient2) set_pallete2();
else set_pallete();
}
} }
int set_color(short *var, char *optarg) { short next_color(short current){
for(int i = 0; i<8; i++){
if (strcmp(optarg, "red") == 0) { if((current == colors[i])||(current == (colors[i] | TB_BOLD ))){
*var = TB_RED; return colors[(i+1)%8];
} else if (strcmp(optarg, "yellow") == 0) {
*var = TB_YELLOW;
} else if (strcmp(optarg, "blue") == 0) {
*var = TB_BLUE;
} else if (strcmp(optarg, "green") == 0) {
*var = TB_GREEN;
} else if (strcmp(optarg, "magenta") == 0) {
*var = TB_MAGENTA;
} else if (strcmp(optarg, "cyan") == 0) {
*var = TB_CYAN;
} else {
printf("Unknown color: %s\n", optarg);
return 0;
} }
return 1; }
return colors[0];
}
void fix_rim_color(){
if(color2 == color){
color2 = color2 | TB_BOLD;
}
}
void set_random_colors( short level){
if(level==1 || level==3) color = colors[ rand() % 7];
if(level==2 || level==3) color2 = colors[ rand() % 7];
fix_rim_color();
} }
int parse_options(int argc, char *argv[]) { int parse_options(int argc, char *argv[]) {
if (argc == 1) if (argc == 1)
return 1; return 1;
int c; int c;
while ((c = getopt(argc, argv, ":c:k:s:r:R:b:F:Ch")) != -1) { // First pass to check for gradient mode
optind = 1; // Reset getopt
while ((c = getopt(argc, argv, ":c:k:s:r:R:b:F:Cp:hg")) != -1) {
if (c == 'g') {
gradient1 = 1;
if (!tb_has_truecolor()) {
fprintf(stderr, "The terminal does not support truecolor\n");
return 0;
}
break;
}
}
// Reset getopt for second pass
optind = 1;
while ((c = getopt(argc, argv, ":c:k:s:r:R:b:F:Cp:hg")) != -1) {
switch (c) { switch (c) {
case 'c': case 'c':
if (!set_color(&color, optarg)) if (!set_color(&color, baseColor, optarg, gradient1))
return 0; return 0;
break; break;
case 'k': case 'k':
if (!set_color(&color2, optarg)) if (!set_color(&color2, baseColor2, optarg, gradient1))
return 0; return 0;
gradient2 = gradient1; // If we're using gradient, enable the second gradient too
break; break;
case 's': case 's':
speedMult = atoi(optarg); speedMult = atoi(optarg);
@ -307,19 +405,18 @@ int parse_options(int argc, char *argv[]) {
} }
break; break;
case 'r': case 'r':
radiusIn = 50 + atoi(optarg) * 10; radiusIn = 100 + atoi(optarg) * 5;
if (radiusIn > 150 || radiusIn < 50) { if (radiusIn > 150 || radiusIn < 100) {
printf("Invalid radius, only values between 1 and 10 are allowed\n"); printf("Invalid radius, only values between 1 and 10 are allowed\n");
return 0; return 0;
} }
break; break;
case 'b': case 'b':
nballs = atoi(optarg); nballs = atoi(optarg);
if (nballs > MAX_NBALLS || nballs < MIN_NBALLS) { if (nballs > MAX_NBALLS || nballs < MIN_NBALLS) {
printf("Invalid number of metaballs, only values between %i and %i are " printf("Invalid number of metaballs, only values between %i and %i are "
"allowed\n", MIN_NBALLS,MAX_NBALLS); "allowed\n",
MIN_NBALLS, MAX_NBALLS);
return 0; return 0;
} }
break; break;
@ -329,11 +426,21 @@ int parse_options(int argc, char *argv[]) {
case 'C': case 'C':
contained = 1; contained = 1;
break; break;
case 'p':
party = atoi(optarg);
if (party < 0 || party > 3) {
printf("Invalid party mode, only values between 1 and 3 are allowed\n");
return 0;
}
break;
case 'h': case 'h':
print_help(); print_help();
return 0; return 0;
break; break;
case ':': /* -f or -o without operand */ case 'g':
// Already handled in first pass
break;
case ':':
fprintf(stderr, "Option -%c requires an operand\n", optopt); fprintf(stderr, "Option -%c requires an operand\n", optopt);
return 0; return 0;
break; break;
@ -349,40 +456,98 @@ void print_help() {
printf( printf(
"Usage: lavat [OPTIONS]\n" "Usage: lavat [OPTIONS]\n"
"OPTIONS:\n" "OPTIONS:\n"
" -c <COLOR> Set color. Available colours: red, blue, yellow, " " -g Enable gradient mode with truecolor support.\n"
"green, cyan and magenta. \n" " Changes how -c and -k options work.\n"
" Besides those colors the default one is the normal" " -c <COLOR> Set color. In normal mode, available colors are: red, blue, yellow, "
" foreground of your terminal.\n" "green, cyan, magenta, white, and black.\n"
" In gradient mode (-g), use hex format: RRGGBB (e.g., FF0000 for red).\n"
" -k <COLOR> Set the rim color. Same format options as -c.\n"
" In gradient mode, this sets the second color for the gradient.\n"
" -s <SPEED> Set the speed, from 1 to 10. (default 5)\n" " -s <SPEED> Set the speed, from 1 to 10. (default 5)\n"
" Change the speed while the program runs "
"with the - and + keys.\n"
" -r <RADIUS> Set the radius of the metaballs, from 1 to 10. " " -r <RADIUS> Set the radius of the metaballs, from 1 to 10. "
"(default: 5)\n" "(default: 5)\n"
" Increase and decrease the radius in runtime with"
"the i and d keys.\n"
" -R <RIM> Set a rim for each metaball, sizes from 1 to 5." " -R <RIM> Set a rim for each metaball, sizes from 1 to 5."
"(default: none)\n" "(default: none)\n"
" This option does not work with the default " " This option does not work with the default "
"color\n" "color\n"
" If you use Kitty or Alacritty you must use it " " If you use Kitty or Alacritty you must use it "
"with the -k option to see the rim.\n" "with the -k option to see the rim.\n"
" Increase and decrease the rim in runtime with "
"shift+i and shift+d."
" -k <COLOR> Set the color of the rim if there is one."
" Available colours: red, blue, yellow, green, cyan and magenta. \n"
" -b <NBALLS> Set the number of metaballs in the simulation, " " -b <NBALLS> Set the number of metaballs in the simulation, "
"from %i to %i. (default: 10)\n" "from %i to %i. (default: 10)\n"
" Increase or decrease the number of balls in run"
"time with the m and l keys.\n"
" -F <CHARS> Allows for a custom set of chars to be used\n" " -F <CHARS> Allows for a custom set of chars to be used\n"
" Only ascii symbols are supported for now, " " Only ascii symbols are supported for now, "
"wide/unicode chars may appear broken.\n" "wide/unicode chars may appear broken.\n"
" -C Retain the entire lava inside the terminal.\n" " -C Retain the entire lava inside the terminal.\n"
" It may not work well with a lot of balls or with" " It may not work well with a lot of balls or with"
" a bigger radius than the default one.\n" " a bigger radius than the default one.\n"
" -p <MODE> PARTY!! THREE MODES AVAILABLE (p1, p2 and p3).\n"
" -h Print help.\n" " -h Print help.\n"
"RUNTIME CONTROLS:\n"
" i Increase radius of the metaballs.\n"
" d Decrease radius of the metaballs.\n"
" shift i Increase rim of the metaballs.\n"
" shift d Decrease rim of the metaballs.\n"
" m Increase the number of metaballs.\n"
" l Decrease the number metaballs.\n"
" c Change the color of the metaballs.\n"
" k Change the rim color of the metaballs.\n"
" + Increase speed.\n"
" - Decrease speed.\n"
" p TURN ON THE PARTY AND CYCLE THROUGH THE PARTY MODES "
"(it can also turns off the party).\n"
"(Tip: Zoom out in your terminal before running the program to get a " "(Tip: Zoom out in your terminal before running the program to get a "
"better resolution of the lava).\n",MIN_NBALLS,MAX_NBALLS); "better resolution of the lava).\n"
"EXAMPLES:\n"
" lavat -c green -k red Use named colors in normal mode\n"
" lavat -g -c 00FF00 -k FF0000 Use hex colors in gradient mode\n",
MIN_NBALLS, MAX_NBALLS);
}
void set_pallete(){
int avgColor= (baseColor[0] + baseColor[1] + baseColor[2])/3;
int blackfactor[5];
int whitefactor[5];
for(int i=1 ;i<6;i++){
blackfactor[i-1]=(6-i)*avgColor/5;
whitefactor[i-1]=i*(255-avgColor)/5;
}
for(int i=0 ;i<5;i++){
int r, g, b;
float factor = (1 - ((float)blackfactor[i]/(avgColor)));
r = baseColor[0]*factor;
g = baseColor[1]*factor;
b = baseColor[2]*factor;
pallete[i]= (r << 16) | (g << 8) | b;
r = baseColor[0] + (255-baseColor[0])*whitefactor[i]/(255-avgColor);
g = baseColor[1] + (255-baseColor[1])*whitefactor[i]/(255-avgColor);
b = baseColor[2] + (255-baseColor[2])*whitefactor[i]/(255-avgColor);
pallete[i+6] = (r << 16) | (g << 8) | b;
}
pallete[5]= (baseColor[0] << 16) | (baseColor[1] << 8) | baseColor[2];
}
void set_pallete2() {
for (int i = 0; i < 11; i++) {
float t = (float)i / (11 - 1);
int r = (1 - t) * baseColor[0] + t * baseColor2[0];
int g = (1 - t) * baseColor[1] + t * baseColor2[1];
int b = (1 - t) * baseColor[2] + t * baseColor2[2];
pallete[i] = (r << 16) | (g << 8) | b;
}
}
uintattr_t get_color(float val) {
val = (val - sumConst)/(0.001*(rim+1));
if (val > 10) {
return pallete[10];
} else if (val < 0) {
return pallete[0];
}
return pallete[(int)val];
} }

View File

@ -9,8 +9,10 @@ clean:
.PHONY: install .PHONY: install
install: lavat install: lavat
install -D lavat $(DESTDIR)$(PREFIX)/bin/lavat mkdir -p $(PREFIX)/bin
install lavat $(PREFIX)/bin/lavat
.PHONY: uninstall
uninstall:
$(RM) $(PREFIX)/bin/lavat
.PHONY: unistall
unistall:
$(RM) $(DESTDIR)$(PREFIX)/bin/lavat