2.1.0 • Published 1 month ago

react-bezier-curve-editor v2.1.0

Weekly downloads
1
License
ISC
Repository
github
Last release
1 month ago

React Bezier Curve Editor

Customizable React Bezier Curve editor for easings and more. Default styling inspired by cubic-bezier

Usage

import { BezierCurveEditor } from 'react-bezier-curve-editor`;

<BezierCurveEditor />

Props

NameDescriptionDefault value
sizeThis defines the width and the height of the control.200
The final width/height of the component will be slightly larger because of the outerAreaSize and spacings
outerAreaSizeThe extra height above and below the editor. This is necessary for creating elastic curves50
outerAreaColorThe background color of the outer area#fafafa
innerAreaColorThe background color of the actual editor area#ffffff
rowColorThe background color of the rows in the editor area#f2f2f2
strokeWidthThe width of the bezier curve stroke2
curveLineColorThe stroke color of the bezier curve#000
fixedHandleColorThe background color of the curve fixed curve handle colors (start and end point)#fff
handleLineColorThe stroke color of the handle lines. This also affects the stroke of the fixed handles#969696
startHandleColorThe color of the start point curve handle#f08
endHandleColorThe color of the end point curve handle#0ab
startHandleClassNameThe className of the start handle
startHandleActiveClassNameClass to apply for active state of start handle
endHandleClassNameThe className of the end handle
endHandleActiveClassNameClass to apply for active state of end handle
fixedPointActiveClassNameClass to apply for active state of fixed points
valueThe current bezier curve value[.4,0,1,.6]
onChangeThe onChange handler (takes bezier curve value array as parameter)
allowNodeEditingWhether or not the left and right nodes can be moved by the userfalse

Theming

Theming can be done by either overriding the class names or the CSS variables. Below is a list of the CSS variables used:

:root {
  --bce-sizes-curve-handle: 16px;
  --bce-padding-sm: 4px;
  --bce-padding-md: 8px;
  --bce-padding-lg: 12px;
  --bce-padding-xl: 16px;
  --bce-colors-handle-line: #969696;
  --bce-colors-curve-line: black;
  --bce-colors-row: #f2f2f2;
  --bce-colors-background: white;
  --bce-colors-outerarea: #fafafa;
  --bce-colors-axisline: black;
  --bce-colors-handle-fixed: white;
  --bce-colors-handle-start: #f08;
  --bce-colors-handle-end: #0ab;
  --bce-colors-preview: white;
  --bce-colors-preview-border: black;
  --bce-colors-handle-active-shadow: rgba(255, 255, 255, 0.7);
}

Accessibility

For now, this library doesn't handle the accessibility in any special way intentionally. Google Chrome has zero support for screen readers in Bezier curve editors in the developer tools, which was our only idea for how to model this component for a11y.

At present, we would suggest that you provide a toggle-able alternative experience for keyboard users as well as users who don't have access to a fine pointer device.

2.1.0-beta.0

1 month ago

2.1.0

1 month ago

2.0.0

5 months ago

1.1.1

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.0

4 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago