Returns a rectangle from width, height
const r = Rects.fromNumbers(100, 200);
// {width: 100, height: 200}
Use toArray for the opposite conversion.
Returns a rectangle from x,y,width,height
import { Rects } from "https://unpkg.com/ixfx/dist/geometry.js";
const r = Rects.fromNumbers(10, 20, 100, 200);
// {x: 10, y: 20, width: 100, height: 200}
Use the spread operator (...) if the source is an array:
const r3 = Rects.fromNumbers(...[10, 20, 100, 200]);
Use toArray for the opposite conversion.
Returns a rectangle from a series of numbers: x, y, width, height OR width, height
Use the spread operator (...) if the source is an array:
Use toArray for the opposite conversion.
See
toArray
Param: xOrWidth
Param: yOrHeight
Param: width
Param: height
Returns