Serhat4838 / simple-rain-Animation-Code-in-termux-

0 stars 0 forks source link

Code #1

Open Serhat4838 opened 1 month ago

Serhat4838 commented 1 month ago

import os import random import time import curses

def start_blue_rain(stdscr): curses.start_color() curses.init_pair(1, curses.COLOR_BLUE, curses.COLOR_BLACK)

sh, sw = stdscr.getmaxyx()
drops = [random.randint(0, sw - 1) for _ in range(100)]

stdscr.clear()
while True:
    stdscr.clear()
    for i in range(100):
        x = drops[i]
        y = random.randint(0, sh - 1)
        stdscr.addstr(y, x, "|", curses.color_pair(1))
        drops[i] = (x + random.randint(-1, 1)) % sw

    stdscr.refresh()
    time.sleep(0.1)

def main(): curses.wrapper(start_blue_rain)

if name == "main": main()

Serhat4838 commented 1 month ago

To Stop IT: Ctrl+c