react-paperjs-experiment
Caution: This library only supports first time rendering at this moment, so any re-rendering behavior with react will not work.
Installation
npm i --save react-paperjs-experiment
or
yarn add react-paperjs-experiment
Usage
const React = ;const paper = ; const Group PointText Shape Path Raster Svg = ;const renderToPNG = ; const svg = '<svg width="100" height="100"><circle cx="220" cy="250" r="40" stroke="green" stroke-width="4" /></svg>'; const App = <Group> <Raster ="http://assets.paperjs.org/images/marilyn.jpg" /> <PointText = ="Hello" = /> <Shape.Rectangle = = ="black" /> <Path.Rectangle = = ="black" /> <Svg = /> </Group>; const canvas = paper; ;
See the basic example at examples folder.
API
renderToPNG(element, canvas, path, callback)
const React = ;const paper = ;const Group Path = ;const renderToPNG = ; const canvas = paper;
renderToBuffer(element, canvas, callback)
const React = ;const paper = ;const Group Path = ;const renderToBuffer = ; const canvas = paper;
Components
- Item
- Layer
- Group
- Raster
- Shape.Circle
- Shape.Rectangle
- Shape.Ellipse
- Path.Line
- Path.Circle
- Path.Rectangle
- Path.Ellipse
- Path.Arc
- Path.RegularPolygon
- Path.Star
- PointText
- Svg