canvas-image-scrubber React component
npm install canvas-image-scrubber
*Currently under heavy development. API will probably change
A react component to render video-like playback for image sequences 🎥.
Via NPM:
npm install canvas-image-scrubber
or Yarn:
yarn add canvas-image-scrubber
webpack and file-loaderframes is a required prop which must be an array of valid image paths to each frame of your image sequence.
render is also a required prop. It is a render-prop which allows you to render the image sequence player, controls, playback progress bar, and audio controls however you wish. See below for basic usage, and ./demo/src/index.js for more advanced usage with prop getters getViewerControlsProps and getViewerProgressProps.
More robust documentation will hopefully be coming soon.. ðŸ¤
``js./frames/Frame-${i}.jpg
import React from 'react';
import CanvasImageScrubber from 'canvas-image-scrubber';
export function getFrames() {
let i = 1;
const frames = [];
while (i < 39) {
frames.push(require());
i++;
}
return frames;
}
const frames = getFrames();
function MyApp() {
render() {
render={({ renderViewer }) => {
return (
Optionally render your own canvas element
The render props provided in the
render prop callback provide a getCanvasRef which will allow you to render your own canvas element should you need to do so. Use getCanvasRef as the value for the prop ref on your canvas element, this way canvas-image-scrubber can get a dom reference to your canvas element. Usage example:``jsfunction MyApp() {
render() {
render={({ getCanvasRef }) => {
return (
[npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square
[npm]: https://www.npmjs.com/package/canvas-image-scrubber