Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Editor.Drawing.Context.globalAlpha = 0.3;
- var amount = 3;
- for(var t = -amount; t <= amount; t += 3) {
- for(var n = -amount; n <= amount; n += 3) {
- Editor.Drawing.Context.drawImage(Editor.Drawing.ClipCanvas, -(n-1), -(t-1));
- }
- }
- function brushLine(ctx, x1, y1, x2, y2) {
- var diffX = Math.abs(x2 - x1), // calc diffs
- diffY = Math.abs(y2 - y1),
- dist = Math.sqrt(diffX * diffX + diffY * diffY), // find length
- step = 20 / (dist ? dist : 1), // "resolution"
- i = 0, // iterator for length
- t = 0, // t [0, 1]
- b, x, y;
- while (i <= dist) {
- t = Math.max(0, Math.min(1, i / dist));
- x = x1 + (x2 - x1) * t;
- y = y1 + (y2 - y1) * t;
- b = (Math.random() * 3) | 0;
- ctx.drawImage(brush, x - bw * 0.5, y - bh * 0.5); // draw brush
- i += step;
- }
- }
Add Comment
Please, Sign In to add comment