INNER CODE UNIT · TypeScript
sin
hyscaler/HyCanvas · packages/a11y/src/index.ts:100
const sin = Math.sin(rad);
const sx = t.scaleX ?? 1;
const sy = t.scaleY ?? 1;
const w = s.width ?? 0;
const h = s.height ?? 0;
let top = Infinity;
let cx = 0;
let cy = 0;
for (const [px, py] of [[0, 0], [w, 0], [w, h], [0, h]] as const) {
const x = (t.x ?? 0) + cos * sx * px - sin * sy * py;
const y = (t.y ?? 0) + sin * sx * px + cos * sy * py;
top = Math.min(top, y);
cx += x / 4;
cy += y / 4;
}
return { cx, top, cy };
};
let backward = 0;