javascript - Canvas drawing tool -
how can same effect on canvas it's shown in image below (source: here)
i try link
e.preventdefault(); var x = e.pagex; var y = e.pagey; if (!drawing) return ctx.beginpath(); ctx.globalalpha = .3; ctx.linejoin ='round'; ctx.linecap = 'butt' ctx.shadowblur = 0; //ctx.globalcompositeoperation = "copy"; ctx.moveto(prev.x, prev.y); ctx.strokestyle = '#000'; //ctx.strokestyle = 'rgba(100,0,0,0.1)'; ctx.lineto(x, y); ctx.linewidth = 20; ctx.stroke(); ctx.closepath(); prev.x = x; prev.y = y;
it looks have effect want.
(semi-transparent, overlapping rounded strokes opacity accumulating overlap).
try changing globalalpha .03 instead of .3.
Comments
Post a Comment