使用Python的turtle库
```python
import turtle
import math
def draw_heart_and_gradient():
t = turtle.Turtle()
t.speed(5)
turtle.colormode(255)
t.begin_fill()
for angle in range(0, 360):
r = 150 - 150 * math.sin(math.radians(angle))
t.color(255 - (255 * angle / 360)) 渐变颜色
t.forward(r)
t.right(140)
t.end_fill()
turtle.done()
draw_heart_and_gradient()
```
使用Python的matplotlib库
```python
import numpy as np
import matplotlib.pyplot as plt
def draw_heart():
t = np.linspace(0, 2 * np.pi, 1000)
x = 16 * np.sin(t)3
y = 13 * np.cos(t) - 5 * np.cos(2*t) - 2 * np.cos(3*t) - np.cos(4*t)
plt.figure(figsize=(8, 6))
plt.plot(x, y, color='red')
plt.fill(x, y, color='red', alpha=0.6)
plt.title('Python Heart', fontsize=18)
plt.axis('equal')
plt.grid(True)
plt.show()
draw_heart()
```
使用HTML和CSS
```html