-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMyART.js
71 lines (57 loc) · 1.33 KB
/
MyART.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
import React, {PureComponent, Component} from 'react';
import {
StyleSheet,
View,
ART,
Dimensions,
PanResponder,
} from 'react-native';
const {
Shape,
Surface,
Group,
Path
} = ART
//获取屏幕的宽高
const {width, height} = Dimensions.get('window');
export default class MyART extends PureComponent {
constructor(props) {
super(props);
}
render() {
const path = new Path();
// path.moveTo(30, 30)
path.moveTo(30, 30) //i=0
path.lineTo(50, 50)
path.close()
path.moveTo(50, 50)
path.lineTo(50, 80)
path.close()
path.moveTo(50, 80)
path.lineTo(100, 80)
path.close()
path.moveTo(100, 80)
path.lineTo(100, 120)
path.close()
path.moveTo(200, 80)
path.lineTo(200, 120)
path.close()
// path.close();
return (
<View style={styles.container} >
<Surface width={width} height={height}>
<Group>
<Shape d={path} stroke="#000000" strokeWidth={1}/>
</Group>
</Surface>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
// width: 300,
// height: 300,
flex: 1,
},
});