Skip to content
pixi-silk
GitHub repository
Function

catmullRom

import { catmullRom } from 'pixi-silk';
function catmullRom(
   flat: number[], 
   closed?: boolean, 
   step?: number, 
   alpha?: number
): number[];

Samples a centripetal Catmull-Rom spline through flat points. It has no cusps or self-loops within a segment. closed adds the segment back to the first point. step is the target sample spacing in local units, at most 64 per segment. alpha 0.5 is centripetal (0 uniform, 1 chordal). Fewer than 3 points come back as a copy.

Parameters#

ParameterTypeDefault value
flatnumber[]undefined
closedbooleanfalse
stepnumber2
alphanumber0.5

Returns#

number[]