canvaskit-wasm 0.39
build 2026-04-29
Point
Point is a 2-element array [x, y]. CanvasKit accepts plain JS arrays or typed arrays interchangeably — there's no constructor and nothing to delete. APIs that take a Point (e.g. Shader.MakeLinearGradient's start / end) read the first two numbers.
const start = [60, 50];
const end = [360, 200];
const grad = CK.Shader.MakeLinearGradient(start, end, [...colors], null, CK.TileMode.Clamp);
For batch APIs that take many points (Path.addPoly, Vertices), the convention is a flat number[] of [x0, y0, x1, y1, …], not an array of points.
Path.getPoint(i) returns a Point as a Float32Array(2).
See also
Path.addPoly,Path.getPoint.Shader.MakeLinearGradient,MakeRadialGradient,MakeTwoPointConicalGradient.