Skip to content
Sign upLog in
← Back to Community

β¬œβ¬› Color Fading Animation 🎬πŸŽ₯

Profile icon

β¬œβ¬› Color Fading Animation 🎬πŸŽ₯

Hope everyone is doing well >:)

In this tutorial, I will teach you how to do a color fading animation. It's very simple.


You need to import these modules:

import os # for clearing the screen from time import sleep # for waiting

That's all the modules!


We don't need to import colors because we could just defined some colors:

black = "\033[0;30m" white = "\033[0;37m" gray = "\x1b[90m" bright_white = "\033[0;97m"

These colors because they go well with each other in the fading animation.

Actual Code

First we need to print the brightest, darker, more darker, darkest. In this case:

print(f"{bright_white}Hello World") print(f"{white}Hello World") print(f"{gray}Hello World") print(f"{black}Hello World")

This is a mistake

because there is waiting in between so each frame looks terrible. And we didn't clear the screen every time so it just printed it all out at once.

FIRST, we need to define the clear screen. (it's up to you if you want to do it, if you don't want to define it, just do:)


If you want to defined it, just do:

def clear(): os.system("clear")

Then, you need to sleep in between each frame. I recommend sleeping 0.05 seconds.'s up to you.

FINALLY: finaly code:

print(f"{bright_white}Hello World") sleep(0.05) os.system("clear") print(f"{white}Hello World") sleep(0.05) os.system("clear") print(f"{gray}Hello World") sleep(0.05) os.system("clear") print(f"{black}Hello World")

If you liked this tutorial, slamπŸ”¨ that upvote button and make sure to check out my other tutorials too:

Python- The Basics Tutorial:

Getkey Function tutorial:

Data Base Tutorial:

>That's it! πŸ‘‹

The project is down below πŸ‘‡. A PEACE! πŸ‘‹ πŸ‘‹ πŸ‘‹ πŸ‘‹

Profile icon
Profile icon
Profile icon
Profile icon
Profile icon

suggest you add a while loop so it goes on forever :D

Profile icon

while True:


Profile icon