# threeact

> A simple React wrapper for THREE.js

Latest version **1.0.1** (published 2020-08-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install threeact
pnpm add threeact
yarn add threeact
bun add threeact
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-08-29 |
| First published | 2019-06-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 2 |
| Unpacked size | 60.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | gpascale |
| Maintainers | gpascale |

## Links

- npm: https://www.npmjs.com/package/threeact
- Repository: https://github.com/gpascale/threeact
- Homepage: https://github.com/gpascale/threeact#readme
- Issues: https://github.com/gpascale/threeact/issues
- npm.io page: https://npm.io/package/threeact

## Dependencies (2)

- [stats-js](https://npm.io/package/stats-js.md) ^1.0.1
- [@xailabs/three-renderer-stats](https://npm.io/package/@xailabs/three-renderer-stats.md) ^1.0.4

## Recent versions

- 1.0.1 (latest) — 2020-08-29
- 0.3.0 — 2019-06-19
- 0.2.0 — 2019-06-19
- 0.1.1 — 2019-06-19
- 0.1.0 — 2019-06-19

## README

# threeact

> Threeact is a dead simple React component for hosting a THREE.js scene. Threeact
> is not for creating actual scenes using React components, a la react-webgl. It simply
> takes care of some of the boilerplate around creating your canvas and THREE.js scene
> and wrapping it in a React component.

[![NPM](https://img.shields.io/npm/v/threeact.svg)](https://www.npmjs.com/package/threeact) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save threeact
```

## Usage

```jsx
import React from 'react';
import * as THREE from 'three';
import Threeact from 'threeact';

const Example = () => (
  <Threeact
    onReady={({ scene }) => {
      // Set up your scene, add geometry, etc...
      this.cube = new THREE.Mesh(
        new THREE.CubeGeometry(2, 2, 2),
        new THREE.MeshNormalMaterial()
      );
      scene.add(this.cube);
    }}
    beforeRenderFrame={({ renderer, scene, camera }) => {
      // make any updates before each frame is rendered
      this.cube.rotation.x += 0.02;
      this.cube.rotation.y -= 0.01;
      this.cube.rotation.z += 0.03;
    }}
    afterRenderFrame={({ renderer, scene, camera }) => {
      // make any updates after each frame is rendered
    }}
    showStats={true /* optionally show diagnostic and perf overlays */}
  />
);
```

## License

MIT © [gpascale](https://github.com/gpascale)

---
_Source: https://npm.io/package/threeact · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
