import matplotlib.pyplot as plt
import numpy as np
from matplotlib.animation import FuncAnimation
from matplotlib.colors import ListedColormap
# --- ドット文字定義(簡略版) ---
H = np.array([
[1,0,0,1],
[1,0,0,1],
[1,1,1,1],
[1,0,0,1],
[1,0,0,1],
])
E = np.array([
[1,1,1,1],
[1,0,0,0],
[1,1,1,0],
[1,0,0,0],
[1,1,1,1],
])
L = np.array([
[1,0,0,0],
[1,0,0,0],
[1,0,0,0],
[1,0,0,0],
[1,1,1,1],
])
O = np.array([
[0,1,1,0],
[1,0,0,1],
[1,0,0,1],
[1,0,0,1],
[0,1,1,0],
])
# --- 単語を結合 ---
space = np.zeros((5,1))
HELLO = np.hstack((H, space, E, space, L, space, L, space, O))
# --- 描画設定 ---
fig, ax = plt.subplots()
cmap = ListedColormap(["white", "black"])
im = ax.imshow(HELLO, cmap=cmap, interpolation='nearest')
ax.axis('off')
# --- アニメーション関数(点滅)---
def update(frame):
if frame % 2 == 0:
im.set_array(HELLO)
else:
im.set_array(np.zeros_like(HELLO))
return [im]
ani = FuncAnimation(fig, update, frames=20, interval=500, blit=True)
plt.show()
To embed this project on your website, copy the following code and paste it into your website's HTML: