案例:通义千问生成的生命游戏代码     状态:可编辑再运行    进入竖版
 运行结果 
x
            container.children[i].style.animationIterationCount = aliveCount;
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <title>生命游戏</title>
5
    <style>
6
        body {
7
    background-color: #333;
8
    font-family: Arial, sans-serif;
9
}
10
11
#container {
12
    position: relative;
13
    width: 600px;
14
    height: 400px;
15
    border: 1px solid black;
16
}
17
18
.cell {
19
    position: absolute;
20
    width: 50px;
21
    height: 50px;
22
    border: 1px solid gray;
23
    font-size: 24px;
24
}
25
26
.alive {
27
    position: absolute;
28
    width: 0;
29
    height: 0;
30
    background-color: white;
31
    border: 1px solid gray;
32
    cursor: pointer;
33
}
34
35
.alive.alive-front {
36
    animation: pulse 2s infinite;
37
}
38
39
.alive.alive-rear {
40
    animation: pulse 1s infinite;
41
}
42
43
@keyframes pulse {
44
    0% {
45
        width: 100%;
46
        height: 100%;
47
        background-color: white;
48
        border: 1px solid gray;