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
|
func design( screen:PGScreen ) {
for _ in 0 ..< 100 {
let a = (0.0...3.0).randomize
if a < 1.0 {
PGCircle()
.color( .random )
.scale( square:(20...100).randomize )
.position( screen.randomPoint )
.angle( .random )
.alpha( .random )
}
else if a < 2.0 {
PGTriangle()
.color( .random )
.scale( square:(20...100).randomize )
.position( screen.randomPoint )
.angle( .random )
.alpha( .random )
}
else {
PGRectangle()
.color( .random )
.scale( square:(20...100).randomize )
.position( screen.randomPoint )
.angle( .random )
.alpha( .random )
}
}
}
|