# aframe-canvas

> A component for putting an HTML canvas in VR

Latest version **0.0.6** (published 2016-06-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install aframe-canvas
pnpm add aframe-canvas
yarn add aframe-canvas
bun add aframe-canvas
```

## 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.6 |
| Published | 2016-06-14 |
| First published | 2016-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 28 |
| Author | Richard Anaya |
| Maintainers | richardanaya |
| Keywords | aframe, graphics, vr, 2d |

## Links

- npm: https://www.npmjs.com/package/aframe-canvas
- Repository: https://github.com/richardanaya/aframe-canvas
- Homepage: https://github.com/richardanaya/aframe-canvas#readme
- Issues: https://github.com/richardanaya/aframe-canvas/issues
- npm.io page: https://npm.io/package/aframe-canvas

## Dependencies (1)

- [aframe](https://npm.io/package/aframe.md) latest

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2016-06-14
- 0.0.5 — 2016-06-13
- 0.0.4 — 2016-06-12
- 0.0.2 — 2016-06-12
- 0.0.1 — 2016-06-12

## README

# aframe-canvas

This is a library for easily allowing canvas in aframe VR.

![hello world in aframe](http://i.imgur.com/2Fw1Ysi.png)

Features
* Transparent canvas background
* Canvas can be resized
* Easily update the 3d texture from canvas with update() function on Canvas2D context

# Installing

```
npm install aframe-canvas
```

#Example

```html 
<html>
...
<body>
<a-scene>
    <a-sky color="#6EBAA7"></a-sky>
    <a-plane id="screen" position="0 1.25 -1" color="red" scale="3 3 3" canvas-material="width:500;height:500"/>
</a-scene>
</body>
<script>
    var component = document.querySelector("#screen").components["canvas-material"];
    var ctx = component.getContext()
    function getRndColor() {
        var r = 255*Math.random()|0,
                g = 255*Math.random()|0,
                b = 255*Math.random()|0;
        return 'rgb(' + r + ',' + g + ',' + b + ')';
    }
    window.setInterval(function(){

        ctx.clearRect(0,0,500,500);
        ctx.fillStyle = getRndColor();
        ctx.fillRect(Math.random()*500,Math.random()*500,50,50);
        ctx.fillStyle = "black";
        ctx.font = "100px serif";
        ctx.fillText("Hello world", 10, 100);
        //this update function says to update the texture in aframe
        component.updateTexture();
    },100)

</script>
</html>

```

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