I am trying to program a drawing application using Canvas. the way it works is connecting lines when you click the mouse. when the line is opaque, it works well, but when I change the alpha parameter, I have a problem.
I tried two options:
but. The path begins when the mouse falls for the first time and ends when the mouse rises again: each movement of the mouse calls the stroke () function. because the line is transparent, the beginning of the whole path will become opaque, and the end will not be, because stroke () is called many times, and it drwas all the way over and over.
b. The path begins and ends with each mouse movement: the line is transparent along the entire path, but the coincidence point between each path and the path is less transparent (because they consist of two lines). therefore, the whole path is not hard.
the only way to get a good result is when I call stroke () only when the mouse rises again. then he strokes it well all the way, but I donβt see anything when drawing it.
What can I do?
thanks
html5 canvas line paint stroke
Amit hagin
source share