0.3.6 • Published 4 years ago

react-canvas-progress v0.3.6

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

react-canvas-process

React process component drawn by canvas 2d with simple config🎨

Installation

npm install react-canvas-process
# or
yarn add react-canvas-process

Basic Usage

import React from 'react';
import ReactDOM from 'react-dom';
import ReactCanvasProcess from 'react-canvas-process';

ReactDOM.render(
  <ReactCanvasProcess
    percentage={80}
    startAngle={4 / 5 * Math.PI}
    endAngle={1 / 5 * Math.PI}
  />,
  document.querySelector('#app'),
);

Click to see more usage🖱

Props options

OptionTypeRequiredDescription
percentagenumbertruePercentage value, range 0, 100
unitstringfalseUnit of canvas size, default is vw
startAnglenumberfalseRadian of start angle(not degree), default is π
endAnglenumberfalseRadian of end angle(not degree), default is 0
speednumberfalseSpeed of animation, default increase 1% per frame
animationbooleanfalseWhether show animation, default is true
widthnumberfalseWidth of canvas, default is 100vw
heightnumberfalseHeight of canvas, default ratio of width / height is 3 / 2
lineWidthnumberfalseWidth of progress bar, default is 1vw
textstringfalseText of process bar, default show curren percentage
fontstringfalseFont family of text, default is serif
fontSizenumberfalseSize of text, default is 8vw
fontColorstringfalseColor of text
withBaseProgressColorbooleanfalseWhether show base progress, default is true
baseProgressColorstringfalseColor of base progress
progressColorstringfalseColor of progress
bgColorstringfalseColor of background, default is #fff
styleReact.CSSPropertiesfalseStyle of the wrapper of canvas
classNamestringfalseClassname of the wrapper of canvas
onAnimationStart() => voidfalseCall this hook when animation start
onAnimationEnd() => voidfalseCall this hook when animation end

Description

description

The angles of start and end are the same as arc function in canvas 2d. And now is version 0.1.0, there are still many features to be developed.

Todo

  • Support line progress bar.
  • Support gradient color of progress bar.
  • Support description text.
  • Support dynamic percentage.
  • Support lifecycle callback.
  • Support padding style of canvas.
0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago