1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict'
|
11 |
|
12 | const _svg = require('./_svg')
|
13 | const numcal = require('numcal')
|
14 |
|
15 |
|
16 | function e (width, height, color1, color2) {
|
17 | let lineWidth = numcal.min(width, height) * 0.05
|
18 |
|
19 | let r = numcal.min(height, width) * 0.2
|
20 |
|
21 | let innerWidth = width - lineWidth * 4
|
22 | let innerHeight = height - lineWidth * 4
|
23 |
|
24 | let innerR = numcal.min(innerWidth, innerHeight) * 0.2
|
25 |
|
26 | return _svg(width, height, {
|
27 | rect: [
|
28 | {
|
29 | '@': {
|
30 | x: lineWidth / 2,
|
31 | y: lineWidth / 2,
|
32 | rx: r,
|
33 | ry: r,
|
34 | width: width - lineWidth,
|
35 | height: height - lineWidth,
|
36 | fill: color2
|
37 | }
|
38 | },
|
39 | {
|
40 | '@': {
|
41 | x: lineWidth / 2,
|
42 | y: lineWidth / 2,
|
43 | width: width - lineWidth,
|
44 | height: height - lineWidth,
|
45 | rx: r,
|
46 | ry: r,
|
47 | fill: 'none',
|
48 | 'stroke-width': lineWidth,
|
49 | stroke: color1
|
50 | }
|
51 | },
|
52 | {
|
53 | '@': {
|
54 | x: lineWidth * 2,
|
55 | y: lineWidth * 2,
|
56 | width: innerWidth,
|
57 | height: innerHeight,
|
58 | fill: color1,
|
59 | rx: innerR,
|
60 | ry: innerR
|
61 | }
|
62 | }
|
63 | ]
|
64 | })
|
65 | }
|
66 |
|
67 | e.$reversed = false
|
68 |
|
69 | module.exports = e
|