Skip to content

anim-format (runtime format) / mapThroughMesh

Function: mapThroughMesh() ​

ts
function mapThroughMesh(
   from, 
   to, 
   tris, 
   x, 
   y
): 
  | {
  x: number;
  y: number;
}
  | null;

Maps a point through the mesh: from points → to points (same triangles). Returns null when no triangle of from holds it. When several overlap (a folded warp) the topmost (last) triangle wins, as drawn.

Parameters ​

ParameterType
fromreadonly number[]
toreadonly number[]
trisreadonly number[]
xnumber
ynumber

Returns ​

| { x: number; y: number; } | null

HereSplash — 2D animation for the web