# canvas-simplified

> CAnvas Simplified - HTML5 Canvas abstraction layer

Latest version **0.1.0** (published 2014-12-06) · MIT license · 0 weekly downloads

## Install

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

## 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.1.0 |
| Published | 2014-12-06 |
| First published | 2014-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Rosen Stoyanov |
| Maintainers | pockata |
| Keywords | cas, canvas, html5, node, nodejs, wrapper, library, helper, tool, toolkit |

## Links

- npm: https://www.npmjs.com/package/canvas-simplified
- Repository: https://github.com/pockata/Cas
- Issues: https://github.com/pockata/Cas/issues
- npm.io page: https://npm.io/package/canvas-simplified

## Dependencies (2)

- [q](https://npm.io/package/q.md) ^1.0.1
- [request](https://npm.io/package/request.md) ^2.47.0

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-12-06

## README

# CAS - CAnvas Simplified
Cas is as an HTML5 Canvas abstraction layer for Node (and the browser) developed mainly for use on the Raspberry Pi on top of the [openvg-canvas](https://github.com/luismreis/node-openvg-canvas) module.

## Project State
The project is in alpha state. Many things can and will be updated/improved.  
Currently only Rectangle and Image abstraction objects are available, but more will come.

## Install
Fetch the source and install dependencies:
```sh
git clone https://github.com/pockata/cas.git
cd cas
npm install
```
Or use NPM instead:
```sh
npm install canvas-simplified --save
```

## Usage
```javascript
// Load the library
var Cas = require('canvas-simplified');

// Set a reference to a canvas object (the equivalent of document.getElementById('canvas'))
Cas.setCanvas(canvasObject);

// Attempt to run at 60 fps
Cas.setFPS(60);

// Create a layer (can have multiple layers)
var layer = new Cas.Layer();

// Create a rectangular shape
var rect = new Cas.Rect({
    'x': 100,
    'y': 200,
    'width': 100,
    'height': 100,
    'stroke': 'red',
    'fill': 'yellow'
});

// Add the shape to the layer
layer.addObject(rect);

// Set some animations
rect.animate({
    'props': {
        'x': 300,
        'width': 200,
        'height': 200
    },
    'duration': 1000
});

rect.animate({
    'props': {
        'y': 600,
        'width': 100,
        'height': 100,
        'angle': 45 // angle in degrees
    },
    'duration': 1000,
    'easing': 'easeInOutBack'
});

// Start the draw loop
Cas.setLoop(function () {
    Cas.drawLayers();
});
```

## License
MIT License

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