Skip to content

anim-format (runtime format) / barycentric

Function: barycentric() ​

ts
function barycentric(
   pts, 
   a, 
   b, 
   c, 
   x, 
   y
): [number, number, number] | null;

barycentric weights of (x, y) in triangle (a, b, c) of pts; null when the triangle is degenerate

Parameters ​

ParameterType
ptsreadonly number[]
anumber
bnumber
cnumber
xnumber
ynumber

Returns ​

[number, number, number] | null

HereSplash — 2D animation for the web