-
Notifications
You must be signed in to change notification settings - Fork 0
/
animation3.py
126 lines (122 loc) · 2.04 KB
/
animation3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
from vector import Vector
from engine import run
from ball import Ball
from wall import Wall
from random import uniform
width = 100
height = 50
unit_length = 10
objects = [
Wall(
Vector(-40, -20),
Vector(-40, 0),
),
Wall(
Vector(40, 20),
Vector(40, 0),
),
Wall(
Vector(-30, 15),
Vector(-5, 15),
),
Wall(
Vector(5, -15),
Vector(30, -15),
),
Wall(
Vector(-10, -20),
Vector(-10, -5),
),
Wall(
Vector(10, 20),
Vector(10, 5),
),
Wall(
Vector(-5, -20),
Vector(5, -20),
),
Wall(
Vector(-5, 20),
Vector(5, 20),
),
Wall(
Vector(-20, 5),
Vector(-20, -5),
),
Wall(
Vector(20, 5),
Vector(20, -5),
),
Wall(
Vector(-3, -5),
Vector(3, -5),
),
Wall(
Vector(-3, 5),
Vector(3, 5),
),
Wall(
Vector(-5, 3),
Vector(-5, -3),
),
Wall(
Vector(5, 3),
Vector(5, -3),
),
Ball(
2,
Vector(-35, -20),
Vector(uniform(-5,5), uniform(-5,5)),
4
),
Ball(
2,
Vector(-30, -20),
Vector(uniform(-5,5), uniform(-5,5)),
4
),
Ball(
2,
Vector(-25, -20),
Vector(uniform(-5,5), uniform(-5,5)),
4
),
Ball(
2,
Vector(-20, -20),
Vector(uniform(-5,5), uniform(-5,5)),
4
),
Ball(
2,
Vector(35, 20),
Vector(uniform(-5,5), uniform(-5,5)),
4
),
Ball(
2,
Vector(30, 20),
Vector(uniform(-5,5), uniform(-5,5)),
4
),
Ball(
2,
Vector(25, 20),
Vector(uniform(-5,5), uniform(-5,5)),
4
),
Ball(
2,
Vector(20, 20),
Vector(uniform(-5,5), uniform(-5,5)),
4
),
]
run(
objects,
"Animation3",
(height * unit_length, width * unit_length, 3),
10.0,
120,
unit_length,
)