forked from magicismight/react-native-svg-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMask.js
88 lines (83 loc) · 2.14 KB
/
Mask.js
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
import React, {
Component
} from 'react';
import Svg, {
Mask,
Circle,
Defs,
Rect,
LinearGradient,
Text,
Use,
Stop
} from 'react-native-svg';
class MaskExample extends Component {
static title = 'Mask';
render() {
<Svg width="100%" height="400" viewBox="0 0 800 300" >
<Defs>
<LinearGradient
id="Gradient"
gradientUnits="userSpaceOnUse"
x1="0"
y1="0"
x2="800"
y2="0"
>
<Stop offset="0" stopColor="white" stopOpacity="0" />
<Stop offset="1" stopColor="white" stopOpacity="1" />
</LinearGradient>
<Rect
id="Rect"
x="0"
y="0"
width="800"
height="300"
fill="url(#Gradient)"
/>
<Mask
id="Mask"
maskUnits="userSpaceOnUse"
x="0"
y="0"
width="800"
height="300"
>
<Rect
x="0"
y="0"
width="800"
height="300"
fill="url(#Gradient)"
/>
</Mask>
<Text
id="Text"
x="400"
y="200"
fontFamily="Verdana"
fontSize="100"
textAnchor="middle"
>
Masked text
</Text>
</Defs>
<Rect x="0" y="0" width="800" height="300" fill="#FF8080" />
<Use href="#Text" fill="blue" mask="url(#Mask)" />
<Use href="#Text" fill="none" stroke="black" stroke-width="2" />
</Svg>
}
}
const icon = <Svg
height="20"
width="20"
>
// new icon needed
</Svg>;
const samples = [
MaskExample
];
export {
icon,
samples
};