Skip to content

anim-format (runtime format) / softMesh

Function: softMesh() ​

ts
function softMesh(
   rest, 
   drawn, 
   tris, 
   level
): object;

A mesh object's SOFTNESS (owner 2026-11-07, like subdivision surfaces): the user's points stay where they are (the first rest.length / 2 points, same order) and level times every triangle is split in four, the new points pulled along a smooth curve through their neighbours' pulls (each point's slope = the least-squares gradient of the pulls around it; edge middle = cubic Hermite midpoint) — so bends come out round instead of folded at the triangle edges. Interpolating: a pull that changes evenly (moves, turns, scales, shears) is drawn exactly as without softness, and no pull = nothing changes. Rest points of the new points are halfway between theirs (the flat picture is not bent). drawn absent = rest (nothing to soften).

Parameters ​

ParameterType
restreadonly number[]
drawnreadonly number[] | null | undefined
trisreadonly number[]
levelnumber

Returns ​

object

NameType
drawnnumber[]
restnumber[]
trisnumber[]

HereSplash — 2D animation for the web