Skip to content

Commit d9eb7b1

Browse files
-o
Ujh
1 parent 46f34fc commit d9eb7b1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Rt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import numpy as np
2+
import matplotlib.pyplot as plt
3+
from matplotlib.animation import FuncAnimation
4+
5+
# إعداد الرسم
6+
fig, ax = plt.subplots(figsize=(6,6))
7+
ax.axis('equal')
8+
ax.axis('off') # إخفاء المحاور
9+
10+
# نقاط القلب الأساسية
11+
t = np.linspace(0, 2*np.pi, 1000)
12+
x = 16 * np.sin(t)**3
13+
y = 13*np.cos(t) - 5*np.cos(2*t) - 2*np.cos(3*t) - np.cos(4*t)
14+
15+
line, = ax.plot([], [], color='red', linewidth=2)
16+
17+
# تحديث كل إطار
18+
def update(frame):
19+
line.set_data(x[:frame], y[:frame])
20+
return line,
21+
22+
# إعداد الحركة
23+
ani = FuncAnimation(fig, update, frames=len(t), interval=5) # interval=5ms => سريع جدًا
24+
25+
# حفظ GIF
26+
ani.save("heart_fast.gif", dpi=200, writer='pillow')
27+
28+
plt.show()
29+
print("تم إنشاء قلب متحرك بسرعة وحفظه باسم 'hea

0 commit comments

Comments
 (0)