-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathsvgDefs.jsx
70 lines (62 loc) · 1.92 KB
/
svgDefs.jsx
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
const svgDefs = (defs) => {
const hatchSize = 4;
const rotation = 45;
// Diagonal hatching
defs
.append('pattern')
.attr('id', 'hatchPatternGray')
.attr('width', hatchSize)
.attr('height', hatchSize)
.attr('patternTransform', `rotate(${rotation})`)
.attr('patternUnits', 'userSpaceOnUse')
.append('rect')
.attr('width', hatchSize / 2)
.attr('height', hatchSize)
.style('fill', '#black');
defs
.append('pattern')
.attr('id', 'plusPattern')
.attr('width', 32)
.attr('height', 32)
.attr('patternTransform', 'scale(1) rotate(0)')
.attr('patternUnits', 'userSpaceOnUse')
.append('path')
.attr('d', 'M16-8v6m0 4v6m8-8h-6m-4 0H8m8 24v6m0 4v6m8-8h-6m-4 0H8')
.attr('stroke-linecap', 'square')
.attr('stroke-width', 3)
.attr('stroke', 'black')
.attr('fill', 'black');
const stdcmFilterDefinition = defs.append('filter');
stdcmFilterDefinition.attr('id', 'stdcmFilter').attr('maskUnits', 'userSpaceOnUse');
stdcmFilterDefinition
.append('feDropShadow')
.attr('stdDeviation', '5 5')
.attr('in', 'SourceGraphic')
.attr('flood-color', 'black')
.attr('flood-opacity', '1')
.attr('result', 'dropShadowStdcm');
defs
.append('pattern')
.attr('id', 'hatchPatternDarkGray')
.attr('width', hatchSize)
.attr('height', hatchSize)
.attr('patternTransform', `rotate(${rotation})`)
.attr('patternUnits', 'userSpaceOnUse')
.append('rect')
.attr('width', hatchSize / 2)
.attr('height', hatchSize)
.style('fill', '#747678');
defs
.append('pattern')
.attr('id', 'hatchPatternBlue')
.attr('width', hatchSize)
.attr('height', hatchSize)
.attr('patternTransform', `rotate(${rotation})`)
.attr('patternUnits', 'userSpaceOnUse')
.append('rect')
.attr('width', hatchSize / 2)
.attr('height', hatchSize)
.style('fill', '#82be00')
.style('opacity', '0.1');
};
export default svgDefs;