@psychobolt/react-regl

0.0.4 • Public • Published

React Regl

Stability npm Build Status codecov

Dependencies Status Dev Dependencies Status Peer Dependencies Status

React fiber renderer and custom container for regl

Install

Recommended: (react|react-dom) @ 16.13.x and regl @ 1.6.x.

npm install @psychobolt/react-regl
# or
yarn add @psychobolt/react-regl

Example

There are several demos. Also check out their sources. Here is one to get you started:

import React from 'react';

import { ReglContainer, Drawable } from '@psychobolt/react-regl';

import frag from './Basic.frag';
import vert from './Basic.vert';

const clear = ({ regl }) => regl.clear({
  color: [0, 0, 0, 1],
  depth: 1,
});

const attributes = {
  position: [[-1, 0], [0, -1], [1, 1]],
};

const uniforms = {
  color: [1, 0, 0, 1],
};

export default () => (
  <ReglContainer onMount={clear}>
    <Drawable
      frag={frag}
      vert={vert}
      attributes={attributes}
      uniforms={uniforms}
      count={3}
    />
  </ReglContainer>
);

Please see API Documentation for more details.

Extensions

See packages.

Readme

Keywords

none

Package Sidebar

Install

npm i @psychobolt/react-regl

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

3.15 MB

Total Files

46

Last publish

Collaborators

  • psychobolt