Created
March 16, 2024 13:57
-
-
Save Wisdawms/7c87f44a46c4de0bd48e09ea7fcf0ea7 to your computer and use it in GitHub Desktop.
kinda cool moving words effect in python along the employment of bcode colors.
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
import os, time | |
clear = lambda: os.system("clear") | |
# credits to tuvokki on github for this | |
class bcolors: | |
HEADER = "\033[95m" | |
OKBLUE = "\033[94m" | |
OKGREEN = "\033[92m" | |
WARNING = "\033[93m" | |
FAIL = "\033[91m" | |
BOLD = "\033[1m" | |
UNDERLINE = "\033[4m" | |
ENDC = "\033[0m" | |
# init indexed colors | |
colors = { | |
key: value | |
for key, value in vars(bcolors).items() | |
if not key.startswith("__") and type(value) is str | |
} | |
# consts | |
repeat_word_in_row = 10 | |
def moving_words(array): | |
for j in range((len(array) + 1) * 10): | |
time.sleep(0.07) | |
clear() | |
for row in range(5): | |
print(list(colors.values())[(row + j) % len(colors)]) | |
print( | |
"".join( | |
str(num) | |
for num in list( | |
array[(row + j) % len(array) :] | |
+ array[: (row + j) % len(array)] | |
) | |
) | |
* repeat_word_in_row | |
) | |
moving_words("HELLO WORLD ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment