-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsalvo.groovy
37 lines (32 loc) · 1.22 KB
/
salvo.groovy
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
def salvo = [xSSD: 0, ySSD: 0, arcs: ['5', '0', '1']]
def magazine = [capacity: 8]
x = 30
y = 0
def ttf = 0
def size = 15
if (salvo) ttf = size * 0.70
circle(cx: x + size, cy: y + size, radius: size * 0.70, fill: 'white')
triangle(x: x + size * 0.65, y: y + size * 0.75 + ttf, width: size * 0.70, height: size, fill: 'black')
group(id: 'magazine') {
rect(x: x, y: y, id: 'mbox', width: size * magazine.capacity / 2 + size * 0.30, height: size * 2)
(0..magazine.capacity / 2 - 1).each {
triangle(x: (it * size) + (x + (size * 0.15)), y: y + size * 2 - (size * 0.15), width: size, height: size * 1.70, fill: 'white')
transformations {
translate(x: 0, y: size)
}
}
}
if (salvo.arcs) {
salvo.arcs.each { seg ->
intersect(fill: java.awt.Color.white) {
subtract() {
circle(cx: x + size, cy: y + size + ttf, radius: size * 3)
circle(cx: x + size, cy: y + size + ttf, radius: size * 1.35)
}
arc(x: x, y: y, close: 'pie', width: size * 2, height: size * 2, extent: 60, start: 60)
transformations {
rotate(angle: Integer.parseInt(seg) * 60, x: x + size, y: y + size)
}
}
}
}