Util
Own Methods
getRandomColor()
return random hex color
Example:
shape.fill(Konva.Util.getRandomColor());
getRGB(color)
get RGB components of a color
Parameters:
color
(String)
Example:
// each of the following examples return {r:0, g:0, b:255}
var rgb = Konva.Util.getRGB('blue');
var rgb = Konva.Util.getRGB('#0000ff');
var rgb = Konva.Util.getRGB('rgb(0,0,255)');
haveIntersection(r1, r2)
check intersection of two client rectangles
Parameters:
r1
(Object): { x, y, width, height } client rectangler2
(Object): { x, y, width, height } client rectangle
Example:
const overlapping = Konva.Util.haveIntersection(shape1.getClientRect(), shape2.getClientRect());