# jaxcore-virtualspin

> A virtual wheel/gear physics simulation for use with Jaxcore Spin

Latest version **0.0.4** (published 2020-01-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install jaxcore-virtualspin
pnpm add jaxcore-virtualspin
yarn add jaxcore-virtualspin
bun add jaxcore-virtualspin
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2020-01-15 |
| First published | 2018-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 904.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jaxcore |
| Maintainers | dsteinman |
| Keywords | Jaxcore, Spin, Remote, Controls |

## Links

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

## Dependencies (3)

- [jaxcore](https://npm.io/package/jaxcore.md) 0.0.1
- [matter-js](https://npm.io/package/matter-js.md) ^0.14.2
- [poly-decomp](https://npm.io/package/poly-decomp.md) ^0.3.0

## Recent versions

- 0.0.4 (latest) — 2020-01-15
- 0.0.2 — 2018-08-16
- 0.0.1 — 2018-08-14

## README

Jaxcore VirtualSpin
--------

VirtualSpin is a low-level Matter.js-based physics simulation of a [Jaxcore Spin](https://jaxcore.com/spin) device, exposed as a shared JavaScript library that is used between multiple projects, such as the [Jaxcore Spin Simulator](https://github.com/jaxcore/jaxcore-spin-simulator) and [Spin-A-Sketch](https://github.com/jaxcore/spin-a-sketch).

**Install and Build**

```
git clone https://github.com/jaxcore/jaxcore-virtualspin.git
cd jaxcore-virtualspin
npm install
npm run build
```

**Run web visualization**

Serve ./build/ with any web server.  On Mac/Linux if [Python](https://www.python.org/downloads/) is installed type:

```
cd build
python -m SimpleHTTPServer
```

For Windows:

```
cd build
python -m http.server
```

Then visit [http://localhost:8000](http://localhost:8000) to see the Matter.js visualization.  Open the web console to view the simulated [Jaxcore Spin](https://github.com/jaxcore/jaxcore-spin) events (spin, button, knob).

**Node Module**

The library can be imported into other projects:

```
npm install jaxcore-virtualspin --save
```

Capture spin, button, and knob events:

```
import VirtualSpin from 'jaxcore-virtualspin';

let vspin = new VirtualSpin({
    friction: 0.1
});

vspin.on('spin', direction, position) {
    console.log('spin', direction, 'position', position);
});

vspin.on('button', pushed) {
    console.log('button', pushed);
});

vspin.on('knob', pushed) {
    console.log('knob', pushed);
});

vspin.on('rotate', function(angle) {
    // precise angle in radians generated by Matter.js
    console.log('angle = '+angle);
});

vspin.startSimulation();

```

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