Files
Zoetrope/run.py
2021-09-15 15:29:10 +02:00

49 lines
797 B
Python
Executable File

#!/usr/bin/env python3
from time import sleep
import numpy as np
from zoetrope import aniplot as plt
def noise(arr):
rand = np.random.random(arr.shape) - 0.5
return arr * rand
x = np.arange(0.0, 2.0, 0.01)
y = 1 + np.sin(2 * np.pi * x)
xdim = ydim = 10
img = np.arange(0, xdim *ydim, 1).reshape(xdim, ydim)
plt.subplot(121)
pln1 = plt.plot(x, noise(y)+1)
pln2 = plt.plot(x, noise(y)+2)
pln3, pln4 = plt.plot(x, noise(y)+3, x, noise(y)+4)
plt.subplot(122)
pimg = plt.imshow(noise(img))
plt.show()
for i in plt.show():
print(i)
pln1.set(x, noise(y)+1)
pln2.set(x, noise(y)+2)
pln3.set(x, noise(y)+3)
pln4.set(x, noise(y)+4)
pimg.set(noise(img))
# if i % 500 == 250:
# plt.disable_blit()
# if i % 500 == 350:
# plt.enable_blit()