Normalises a point so it is on a 0..1 scale
normaliseByRect({ x: 10, y: 10, width: 20, height: 40 }); normaliseByRect({ x: 10, y: 10 }, 20, 40); normaliseByRect(10, 10, 20, 40); Copy
normaliseByRect({ x: 10, y: 10, width: 20, height: 40 }); normaliseByRect({ x: 10, y: 10 }, 20, 40); normaliseByRect(10, 10, 20, 40);
Point, or x
y coord or width
height or width
height
Point
Normalises a point by a given width and height
normaliseByRect({ x: 10, y: 10 }, 20, 40 }); // { x: 0.5, y: 0.2 } Copy
normaliseByRect({ x: 10, y: 10 }, 20, 40 }); // { x: 0.5, y: 0.2 }
Width
Height
Normalises a point by a given rect's width and height
normaliseByRect({ x: 10, y: 10, width: 20, height: 40 }); // { x: 0.5, y: 0.2 } Copy
normaliseByRect({ x: 10, y: 10, width: 20, height: 40 }); // { x: 0.5, y: 0.2 }
Normalises x,y by width and height so it is on a 0..1 scale
normaliseByRect(10, 10, 20, 40); // { x: 0.5, y: 0.2 } Copy
normaliseByRect(10, 10, 20, 40); // { x: 0.5, y: 0.2 }
Normalises a point so it is on a 0..1 scale
Param: a
Point, or x
Param: b
y coord or width
Param: c
height or width
Param: d
height
Returns
Point