0.1.2 • Published 8 years ago
react-native-art-extra v0.1.2
ART Extra for react native
Install
npm install --save react-native-art-extraUsage
import 'react-native-art-extra';
import { ART } from 'react-native';
const {Surface, Group, Shape, ...} = ART;or
import ART from 'react-native-art-extra';
const {Surface, Group, Shape, ...} = ART;Doc and Example
Notation: All example with props
```
const style = {
fill: 'red' ,
stroke: 'blue' ,
strokeWidth: 5,
strokeCap: 'square',
strokeJoin: 'miter',
};
```Line
x1y1x2y2<Surface width={100} height={100}> <Line {...style} x1={25} y1={50} x2={75} y2={50}/> </Surface>
Rect
xywidthheightrxry
<Surface width={100} height={100}> <Rect {...style} x='5' y='5' width='60' height='90' rx='30' ry='20'/> </Surface>Ellipse
cxcyrxry
<Surface width={100} height={100}> <Ellipse {...style} cx={50} cy={50} rx={40} ry={20} transform={new Transform().skewX(30, 300, 100)}/> </Surface>
Circle
cxcyr<Surface width={100} height={100}> <Circle {...style} cx={50} cy={50} r={40} transform={new Transform().skewX(30, 300, 100)}/> </Surface>
Wedge
cxcyorirsaea<Surface width={100} height={100}> <Wedge {...style} cx={50} cy={100} or={70} ir={30} sa={-30} ea={30} /> </Surface>
Polyline
pointsneed at least 3 points<Surface width={100} height={100}> <Polyline {...style} points={[10, 10, 0, 30, 50,0,50,100,100, 50, 0, 50]} /> </Surface>
Polygon
pointsneed at least 3 points<Surface width={100} height={100}> <Polygon {...style} points={[10, 10, 0, 30, 50,0,50,100,100, 50, 0, 50]} /> </Surface>
Transform
scale
scaletype scale = (sx, sy, x, y)=> TransformscaleToscaleXscaleYscaleXToscaleYTo
skew
skewtype skew = (dx, dy, x, y)=> TransformskewToskewXskewYskewXToskewYTo