





























I need idea how i can make brush who can color smudge.
Example in picture: right side painting with basic brush with two different colors in left also painting but additional use smudge tool, the result should be something like left side

I need advice how i can try to do it
Here is one attempt
On mousedown grab a copy of the area under the mouse into a separate canvas
On mousemove draw that copy one pixel at a time from the previous mouse position to the current mouse position at 50% alpha, grabbing a new copy after each move.
In pseudo code
on mouse down
grab copy of canvas at mouse position
prevMousePos = currentMousePos
on mouse move
for (pos = prevMousePos to currentMousePos step 1 pixel)
draw copy at pos with 50% alpha
grab new copy of canvas at pos
prevMousePos = currentMousePos
The brush is feathered by drawing a rgba(0,0,0,0) to rgba(0,0,0,1) radial gradient over it using globalCompositeOperation = 'destination-out'.
The question and quoted portions thereof are CC BY-SA 3.0 by Your choice from here
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。