UNPKG

@thi.ng/hiccup-canvas

Version:

Hiccup shape tree renderer for vanilla Canvas 2D contexts

17 lines (16 loc) 524 B
import { TAU } from "@thi.ng/math/api"; import { __endShape } from "./internal/end-shape.js"; const circularArc = (ctx, attribs, pos, r, start = 0, end = TAU, ccw = false) => { ctx.beginPath(); ctx.arc(pos[0], pos[1], r, start, end, ccw); __endShape(ctx, attribs); }; const ellipticArc = (ctx, attribs, pos, r, axis = 0, start = 0, end = TAU, ccw = false) => { ctx.beginPath(); ctx.ellipse(pos[0], pos[1], r[0], r[1], axis, start, end, ccw); __endShape(ctx, attribs); }; export { circularArc, ellipticArc };