react-paper-bindings
v3.0.0-beta.13
Published
Paper.js renderer for React
Readme
Paper.js bindings for React Fiber
Demo
http://react-paper.github.io/react-paper-bindings/
Similar projects
Example with Create React App
Install create-react-app
npx create-react-app my-app
cd my-appInstall react-paper-bindings
npm install paper react-reconciler react-paper-bindingsEdit src/App.js and paste:
import React, { useCallback, useState } from 'react';
import { Canvas, View, Layer, Rectangle } from 'react-paper-bindings';
function App() {
const [color, setColor] = useState('red');
const toggleColor = useCallback(() => {
setColor(color === 'red' ? 'blue' : 'red');
}, [color]);
return (
<Canvas width={400} height={300}>
<View>
<Layer>
<Rectangle
center={[100, 100]}
fillColor={color}
size={[50, 50]}
onClick={toggleColor}
/>
</Layer>
</View>
</Canvas>
);
}
export default App;Run app
npm run startDevelopment
cd react-paper-bindings
npm install
npm run watchBuild
npm run buildTest
npm run testDemo
cd demo
npm run dev