Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liammartens/react-bezier-curve-editor
Simple bezier curve editor built with React
https://github.com/liammartens/react-bezier-curve-editor
Last synced: 7 days ago
JSON representation
Simple bezier curve editor built with React
- Host: GitHub
- URL: https://github.com/liammartens/react-bezier-curve-editor
- Owner: LiamMartens
- Created: 2019-08-16T00:09:53.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-07T13:23:35.000Z (7 months ago)
- Last Synced: 2024-10-18T16:13:11.124Z (18 days ago)
- Language: TypeScript
- Size: 2.45 MB
- Stars: 14
- Watchers: 4
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# React Bezier Curve Editor
Customizable React Bezier Curve editor for easings and more. Default styling inspired by [cubic-bezier](https://cubic-bezier.com)
## Usage
```jsx
import { BezierCurveEditor } from 'react-bezier-curve-editor`;```
## Props
| Name | Description | Default value |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------- |
| `size` | This 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 | |
| `outerAreaSize` | The extra height above and below the editor. This is necessary for creating elastic curves | `50` |
| `outerAreaColor` | The background color of the outer area | `#fafafa` |
| `innerAreaColor` | The background color of the actual editor area | `#ffffff` |
| `rowColor` | The background color of the rows in the editor area | `#f2f2f2` |
| `strokeWidth` | The width of the bezier curve stroke | `2` |
| `curveLineColor` | The stroke color of the bezier curve | `#000` |
| `fixedHandleColor` | The background color of the curve fixed curve handle colors (start and end point) | `#fff` |
| `handleLineColor` | The stroke color of the handle lines. This also affects the stroke of the fixed handles | `#969696` |
| `startHandleColor` | The color of the start point curve handle | `#f08` |
| `endHandleColor` | The color of the end point curve handle | `#0ab` |
| `startHandleClassName` | The className of the start handle | |
| `startHandleActiveClassName` | Class to apply for active state of start handle | |
| `endHandleClassName` | The className of the end handle | |
| `endHandleActiveClassName` | Class to apply for active state of end handle | |
| `fixedPointActiveClassName` | Class to apply for active state of fixed points | |
| `value` | The current bezier curve value | `[.4,0,1,.6]` |
| `onChange` | The onChange handler (takes bezier curve value array as parameter) | |
|`allowNodeEditing` | Whether or not the left and right nodes can be moved by the user | `false` |## Theming
Theming can be done by either overriding the class names or the CSS variables. Below is a list of the CSS variables used:
```css
: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);
}
```
## AccessibilityFor 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](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer).