42 posts

Tricks

Konva - making a rectangle with a hole

Konva - making a rectangle with a hole

VanquishedWombat ―

Konva's clipFunc is usually used to trim off the edges of oversize images. The magic here is that if we draw an outer path clockwise and an inner path counter-clockwise, the area defined by the inner path becomes a hole! Let's look into it...

Konva Tricks
Konva - Flipping an image in-place

Konva - Flipping an image in-place

VanquishedWombat ―

It's easy to find out that to flip an image we can set the scaleX or Y to -1. But there's a problem here because images are based on the rect and have their origin at (0, 0). To make a proper in-place flip we have a little more work to do. Lets take a look...

Konva Tricks