kglobe/kglobe.py

27 lines
656 B
Python

#!/usr/bin/env python3
from kitty import draw_to_terminal, get_position, set_position, hide_cursor, show_cursor #, draw_animation
from PIL import Image
import pyvista as pv
sphere = pv.Tetrahedron()# Sphere()
pl=pv.Plotter(off_screen=True)
pl.add_mesh(sphere, color='tan', show_edges=False)
hide_cursor()
y, x = get_position()
print('\n' * 25, end='')
frames = []
try:
while True:
pl.camera.Azimuth(1)
image = pl.screenshot(transparent_background=True, window_size=(512, 512))
frames.append(Image.fromarray(image))
set_position(y-25, x)
draw_to_terminal(Image.fromarray(image))
finally:
show_cursor()