Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/delucis/pellicola
:movie_camera: Generate video files from <canvas> animations in Node.js
https://github.com/delucis/pellicola
canvas canvas-animation ffmpeg node-canvas video
Last synced: about 1 month ago
JSON representation
:movie_camera: Generate video files from <canvas> animations in Node.js
- Host: GitHub
- URL: https://github.com/delucis/pellicola
- Owner: delucis
- License: gpl-3.0
- Created: 2018-10-21T16:30:14.000Z (about 6 years ago)
- Default Branch: latest
- Last Pushed: 2024-09-06T10:16:41.000Z (2 months ago)
- Last Synced: 2024-09-30T18:43:10.450Z (about 1 month ago)
- Topics: canvas, canvas-animation, ffmpeg, node-canvas, video
- Language: JavaScript
- Homepage: https://npmjs.com/package/pellicola
- Size: 2.17 MB
- Stars: 21
- Watchers: 5
- Forks: 2
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# pellicola
[![npm version](https://img.shields.io/npm/v/pellicola.svg)](https://www.npmjs.com/package/pellicola)
[![node](https://img.shields.io/node/v/pellicola.svg)](#readme)
[![Build Status](https://github.com/delucis/pellicola/actions/workflows/test.yml/badge.svg)](https://github.com/delucis/pellicola/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/delucis/pellicola/badge.svg?branch=latest)](https://coveralls.io/github/delucis/pellicola?branch=latest)
[![Known Vulnerabilities](https://snyk.io/test/npm/pellicola/badge.svg)](https://snyk.io/test/npm/pellicola)
[![Typed with TypeScript](https://badgen.net/badge/icon/Types?icon=typescript&label&labelColor=3178c6&color=3178c6)](#readme)> Generate video files from `` animations in Node.js
## Installation
```
npm install --save pellicola
```## Usage
This package provides a lightweight framework for generating animations with `node-canvas` and saving them as video files using `ffmpeg`.
```js
const pellicola = require('pellicola')function myAnimation () {
// provide a function to draw video frames
return function ({ context, width, height, playhead }) {
context.fillStyle = '#0f0'
context.fillRect(0, 0, width * playhead, height)
}
}const settings = {
dimensions: [640, 360], // video will be 640px wide by 360px tall
duration: 2, // video will last 2 seconds
filename: 'my-sketch.mp4' // set custom filename for output video
}pellicola(myAnimation, settings)
.then(path => console.log('Done saving video file to:', path))
// => Done saving video file to: /path/to/current-dir/my-sketch.mp4
```Conceptually, `pellicola` uses the idea of the “sketch” that can be found in [Processing](https://processing.org/) and its Javascript cousin [p5.js](https://p5js.org/). The API tries to follow Matt DesLauriers’s [`canvas-sketch`](https://github.com/mattdesl/canvas-sketch) framework, which provides excellent tools for working on generative art with `` in the web browser. The aim is to permit a sketch function developed using `canvas-sketch` to be re-used with `pellicola` with minimal adaptation.
For more details, see the [**Documentation →**](docs/README.md)
## License
`pellicola` is distributed under the [GNU General Public License v3.0](LICENSE).