1.0.2 • Published 7 years ago
svg-cubic-bezier v1.0.2
svg-cubic-bezier
Draw a cubic bezier curve in svg given 4 control points.
Examples
Installation
npm i svg-cubic-bezierRequired Props
Props you must specify:
parentDom- SVG element onto on which the curve is drawnctrlPts- array of 4 x-y objects mapping the conrol points of the curve
Optional Props
Props can optionally specify:
onCtrlPtMouseDown(ctrlPtIndex)- handler for 'mousedown' event on control pointsshouldShowCtrlPts- renders the 4 control pointsstyleCurve- styling for the bezier curvestyleAnchorPts- styling for curve's 2 anchor pointsstyleCtrlPts- styling for curve's 2 control pointsstyleHandles- styling for curve's 2 handle arms
Methods
Methods you can call:
updateProps({...})- update any existing props and re-render