导入库
```python
import turtle
import random
import time
```
画蛋糕底座
```python
def draw_cake_base():
t = turtle.Turtle()
t.hideturtle()
t.speed(0)
t.fillcolor("FFE4E1")
t.begin_fill()
t.circle(100)
t.end_fill()
```
画奶油层
```python
def add_decorations():
t = turtle.Turtle()
t.hideturtle()
t.speed(0)
t.penup()
t.goto(0, 20)
t.pendown()
t.fillcolor("FFC0CB")
t.begin_fill()
t.circle(80)
t.end_fill()
```
画小花装饰
```python
def add_flowers():
colors = ["FF69B4", "87CEEB", "98FB98"]
for _ in range(8):
t = turtle.Turtle()
t.hideturtle()
t.speed(0)
t.penup()
angle = random.randint(0, 360)
t.setheading(angle)
t.forward(60)
t.fillcolor(random.choice(colors))
t.begin_fill()
for _ in range(5):
t.forward(15)
t.right(144)
t.end_fill()
```
画蜡烛和火焰
```python
def draw_candles():
t = turtle.Turtle()
t.hideturtle()
t.speed(0)
t.penup()
t.goto(150, 100)
t.pendown()
t.fillcolor("FFA500")
t.begin_fill()
t.circle(10)
t.end_fill()
t.penup()
t.goto(160, 100)
t.pendown()
t.fillcolor("FFA500")
t.begin_fill()
t.circle(10)
t.end_fill()
```
画波浪线装饰
```python
def add_waves():
t = turtle.Turtle()
t.hideturtle()
t.speed(0)
t.penup()
t.goto(50, 150)
t.pendown()
t.pencolor("87CEEB")
for i in range(100):
t.forward(10)
t.left(5)
```
画蛋糕层
```python
def draw_cake_layers():
for i in range(2):
t = turtle.Turtle()
t.hideturtle()
t.speed(0)
t.penup()
t.goto(0, 0)
t.pendown()
t.fillcolor("FFFACD")
t.begin_fill()
t.circle(150)
t.end_fill()
t.penup()
t.goto(0, 0)
t.pendown()
t.fillcolor("FFFACD")
t.begin_fill()
t.circle(100)
t.end_fill()
```