rotate-canvas
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

rotate-canvas

Simple library to rotate canvas image using javascript. You can rotate image by 90, 180 or 270 degrees. Passing any other value will draw image/video without any rotation

Installation

To install run:

yarn add rotate-canvas
# or
npm i rotate-canvas

Example

import { drawRotated } from 'deviceorientation'

let video = document.querySelector('#video');
let canvas = document.querySelector('#canvas');
canvas.height = video.videoHeight;
canvas.width = video.videoWidth;
let ctx = canvas.getContext("2d");

drawRotated(video, canvas, ctx, 180);

Package Sidebar

Install

npm i rotate-canvas

Weekly Downloads

400

Version

1.0.0

License

MIT

Unpacked Size

16.1 kB

Total Files

8

Last publish

Collaborators

  • alexkratky