1.0.3 • Published 10 months ago

p5-react v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

p5-react

P5 wrapper for React.js application

NPM Version NPM License npm downloads example workflow

Installation

For npm users:

npm i p5-react

For yarn users:

yarn add p5-react

Quick Start

import P5 from "p5";
import Sketch from "p5-react";

const setup = (p5: P5, canvasRef: HTMLDivElement) => {
  p5.createCanvas(500, 500).parent(canvasRef);
};

const sketch = (p5: P5) => {
  p5.draw = () => {
    // Draw
  };
};

const App = () => {
  return <Sketch setup={setup} sketch={sketch} />;
};

export default App;

Note: You can access p5 globally from other modules

1.0.3

10 months ago

1.0.2

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago