macOS ◆ xterm-256color ◆ zsh 136 views

A python script that makes the circles go in circles. At the end you see the whole script, but just in case here it is:

#!/usr/local/bin/python

import subprocess
import math
import time
import sys

lines=int(subprocess.check_output(['tput', 'lines']))
cols=int(subprocess.check_output(['tput', 'cols']))

def coords(t):
    t = t / 100.0
    x = int(0.75 * cols * math.cos(2 * math.pi * t) / 2 + cols / 2)
    y = int(0.75 * lines * math.sin(2 * math.pi * t) / 2 + lines / 2)
    return (x,y)


def putCursorAt(t):
    x,y = coords(t)
    print (u"\u001b[" + str(y) + ";" + str(x) + "H"),

trail = [' ', '.', '-', '=', 'o']

print u"\u001bc"

while True:
    for t in xrange(0, 100):
        for tp in xrange(5, 0, -1):
            putCursorAt(t-tp)
            print trail[5-tp],
        putCursorAt(t)
        print "#"
        time.sleep(0.05)