Last active
February 26, 2020 12:35
-
-
Save paradigm/d8375630f0119fe8931697d16c035c91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
# | |
# Full Bedrock logo draw in animation | |
# | |
function draw_char(x, y, char, color) { | |
printf(cursor_restore) | |
if (x > 1) { | |
printf("\033["(x-1)"C") | |
} | |
if (y > 1) { | |
printf("\033["(y-1)"B") | |
} | |
printf(color "" char) | |
} | |
BEGIN { | |
drawing[1] = "__ __ __ " | |
drawing[2] = "\\ \\_________\\ \\____________\\ \\___ " | |
drawing[3] = " \\ _ \\ _\\ _ \\ _\\ __ \\ __\\ / " | |
drawing[4] = " \\___/\\__/\\__/ \\_\\ \\___/\\__/\\_\\_\\ " | |
drawing[5] = " Bedrock Linux 0.7 Poki" | |
paths["bedrock linux"] = "14,5;15,5;16,5;17,5;18,5;19,5;20,5;22,5;23,5;24,5;25,5;26,5" | |
paths["version"] = "28,5;29,5;30,5;32,5;33,5;34,5;35,5" | |
paths["dots"] = "5,3;10,3;13,3;22,3;23,3;27,3;28,3" | |
paths["b"] = "1,1;2,1;3,2;4,2;5,2;6,2;7,3;7,4;6,4;5,4;4,4;3,4;2,3;1,2" | |
paths["e"] = "7,2;8,2;9,2;10,2;11,3;11,4;10,4;9,4;8,4" | |
paths["d"] = "11,2;12,2;13,2;13,1;14,1;15,2;16,3;15,4;14,4;13,4;12,4" | |
paths["r"] = "16,2;17,2;18,2;19,2;20,3;19,3;19,4;18,4;17,4" | |
paths["o"] = "20,2;21,2;22,2;23,2;24,2;25,3;25,4;24,4;23,4;22,4;21,4" | |
paths["c"] = "25,2;26,2;27,2;29,3;29,4;28,4;27,4;26,4" | |
paths["k"] = "28,2;28,1;29,1;30,2;31,2;32,2;33,2;33,3;34,4;33,4;32,4;31,4;30,4" | |
color_write_head = "\033[28m\033[0;97m" | |
color_body_head = "\033[28m\033[2;97m" | |
color_erase = "\033[8m" | |
color_norm = "\033[28m\033[0m" | |
heads["write"] = "0,"color_write_head | |
heads["norm"] = "-3,"color_body_head | |
#heads["clear"] = "-10,"color_erase | |
cursor_hide = "\033[?25l" | |
cursor_show = "\033[?25h" | |
cursor_save = "\033[s" | |
cursor_restore = "\033[u" | |
cursor_left = "\033[1D" | |
printf(cursor_hide) | |
printf(cursor_save) | |
for (p in paths) { | |
len = split(paths[p], a, ";") | |
if (len > max_path) { | |
max_path = len | |
} | |
} | |
for (h in heads) { | |
split(heads[h], a, ",") | |
offset = a[1] * -1 | |
if (offset > max_offset) { | |
max_offset = offset | |
} | |
} | |
for (i = 1; i <= (max_path + max_offset); i++) { | |
for (h in heads) { | |
split(heads[h], a, ",") | |
offset = a[1] | |
color = a[2] | |
for (p in paths) { | |
split(paths[p], a, ";") | |
if (!((i + offset) in a)) { | |
continue | |
} | |
split(a[i + offset], b, ",") | |
x = b[1] | |
y = b[2] | |
char = substr(drawing[y], x, 1) | |
draw_char(x, y, char, color) | |
} | |
} | |
system("sleep 0.08") | |
} | |
printf(cursor_restore) | |
printf(color_body_head) | |
for (d in drawing) { | |
print drawing[d] | |
} | |
printf(color_norm) | |
printf(cursor_show) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment