📜 ⬆️ ⬇️

Creating connecting arrows for block elements using canvas

arrows_for_blocks Hello!

Recently there was a need to make a simple hierarchical tree for a web page (organization structure). The blocks turned out to be quite good, but when it came time to connect all the arrows, the question arose - how? The solution was two: draw arrows in .png or use special characters.

But I wanted something faster, more comfortable, modern - i.e. just indicate: the arrow from Block A to Block B. Already in the evening a small library was written, allowing you to realize your plans ...

Implementation

The implementation is simple and convenient, as planned; technically it happens in two steps:

Disadvantages:

At the moment, I discovered several problems:

Naturally, when moving (or animating) blocks relative to the background, the arrows will remain in place.
')
In custody:

Everything is still pretty damp, so it bears the status of beta, if you have any suggestions, then with pleasure “pull request” on guthub .

Examples of use and more details can be found here .

design_canvas_arrows

The same interesting, interesting way of constructing block schemes is shown here - a short writing style is used, in our case, we are not limited to simple block diagrams, but we connect or point to everything we want, other blocks, paragraphs, drawings, etc. using the canvas.

Thanks for attention!

Source: https://habr.com/ru/post/140856/


All Articles