@feds01/graphika / core/interpolation
core/interpolation
Type Aliases
ControlPoint
ts
type ControlPoint = {
next: default;
prev: default;
};Defined in: core/interpolation.ts:21
Control points for cubic Bezier curves.
Properties
| Property | Type | Defined in |
|---|---|---|
next | default | core/interpolation.ts:23 |
prev | default | core/interpolation.ts:22 |
InterpolationKind
ts
type InterpolationKind = "linear" | "cubic";Defined in: core/interpolation.ts:18
Types of interpolation supported.
Functions
splineCurve()
ts
function splineCurve(
prev,
current,
next,
t,
graph): ControlPoint;Defined in: core/interpolation.ts:41
x0,y0,x1,y1 are the coordinates of the end (knot) pts of this segment x2,y2 is the next knot -- not connected here but needed to calculate p2 p1 is the control point calculated here, from x1 back toward x0. p2 is the next control point, calculated here and returned to become the next segment's p1.
Parameters
| Parameter | Type | Description |
|---|---|---|
prev | default | the previous point |
current | default | the current point |
next | default | the next point |
t | number | tension coefficient |
graph | default | graph object |