A
A
Alexander Sinitsyn2018-03-31 21:35:06
Android
Alexander Sinitsyn, 2018-03-31 21:35:06

How to draw such a line with your finger?

5abfd48092d69663616744.png
Maybe it's not a line, but a filled contour. But it is drawn in one motion, the width depends on pressing.
----------
While the idea is to calculate the coordinates of points lying on a line perpendicular to the line connecting the previous point with the current one, at a distance of (brush thickness * pressure * size + 1) / 2 and build two paths using these points, closed in a loop.

Something like this, only the distance between the perpendiculars is less
5abfe0c2d509c719430367.png5abfe0ccc75af662956349.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Sinitsyn, 2018-04-01
@a_u_sinitsin

It turned out something like this
The first "skeleton" of the line. The width is the same everywhere, because The emulator does not have pressure force.
Filled It
remains to overcome glitches on sharp bends.

S
Sergey Sergey, 2018-04-01
@hahenty

Thickness can be affected by swipe speed, with limits on the maximum. Taper at the ends, taking into account the slowdown - for example, at the end or at the beginning of the draw, holding the finger in place for a short time will lead to the "blunting" of the sharp end.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question