summaryrefslogtreecommitdiff
path: root/congrats_animation.c
diff options
context:
space:
mode:
authorloshprung <lshprung@scu.edu>2020-02-27 18:59:22 -0800
committerloshprung <lshprung@scu.edu>2020-02-27 18:59:22 -0800
commitff323cdde3148a51321685e353a40a270f7795ea (patch)
treec0b7e82092b15becbf57529fc9573ff4945dbf0f /congrats_animation.c
parent28425a3b9177749b2650a5e9c70043287a58f5bc (diff)
added basic color changingHEADmaster
Diffstat (limited to 'congrats_animation.c')
-rw-r--r--congrats_animation.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/congrats_animation.c b/congrats_animation.c
index 34a1905..67c3d0b 100644
--- a/congrats_animation.c
+++ b/congrats_animation.c
@@ -1,19 +1,31 @@
#include <stdio.h>
+#include <time.h>
#include <unistd.h>
#define DISTANCE 10
#define DOWNTIME 100000
int main(){
int i, j;
+ int num_rand; //for random color
+ int counter = 1; //change color when hits 5
+
+ srand(time(NULL));
while(1){
for(i = 0; i < DISTANCE; i++){
+ counter++;
+
for(j = 0; j < 15+i+1; j++){
printf("\b \b"); //backspace
}
for(j = 0; j < i; j++){
printf(" ");
}
+ if(counter == 5){
+ num_rand = (rand() % 7) + 1;
+ printf("\e[0;3%dm", num_rand);
+ counter = 1;
+ }
printf("Congratulations");
fflush(stdout);
usleep(DOWNTIME);