diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-05-11 17:30:47 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-05-11 17:30:47 -0400 |
| commit | 5c7f7b8f70d1f9b87758b74e7efadaef91fd22a5 (patch) | |
| tree | 029b7da99b6e467618a200a3d16636daadcb06d0 /js | |
| parent | cb55fa7cfd84ed67313033c595bdbb9a69195e58 (diff) | |
fix smear at edge of canvas bug
Diffstat (limited to 'js')
| -rw-r--r-- | js/blit.js | 9 | ||||
| -rw-r--r-- | js/ui/nopaint.js | 12 |
2 files changed, 15 insertions, 6 deletions
@@ -28,6 +28,15 @@ var blit = (function(){ } }) } + blit.copy_toroidal_from = function(A, B, x, y){ + x = x || 0 ; y = y || 0 + B.forEach(function(lex, u, v){ + var cell = A.get(u+x, v+y) + if (cell) { + lex.assign(cell) + } + }) + } blit.copy_to = function(A, B, x, y){ x = x || 0 ; y = y || 0 B.forEach(function(lex, u, v){ diff --git a/js/ui/nopaint.js b/js/ui/nopaint.js index b40cfd1..d5a5ab6 100644 --- a/js/ui/nopaint.js +++ b/js/ui/nopaint.js @@ -328,7 +328,7 @@ var nopaint = (function(){ }, clone_region: function(x, y){ - blit.copy_from(canvas, brush, round(x-brush.w/2), round(y-brush.h/2)) + blit.copy_toroidal_from(canvas, brush, round(x-brush.w/2), round(y-brush.h/2)) brush.mask(brush) }, @@ -419,11 +419,10 @@ var nopaint = (function(){ type: "shader", dx: 0, dy: 0, - speed: 5, + speed: 3, is_recursive: false, start: function(){ undo.save_rect(0, 0, canvas.w, canvas.h) - this.speed = floor(randrange(1, 3)) this.canvas = canvas.clone() }, paint: function(t){ @@ -456,7 +455,7 @@ var nopaint = (function(){ type: "translate", dx: 0, dy: 0, - speed: 5, + speed: 3, start: function(){ this.__start() this.dx = randint(3)-1 @@ -482,7 +481,7 @@ var nopaint = (function(){ type: "scale", scale: 1, dscale: 0, - speed: 5, + speed: 3, start: function(){ this.__start() var sign = randsign() @@ -521,6 +520,7 @@ var nopaint = (function(){ type: "rotate", theta: 0, d_theta: 0, + start: function(){ this.__start() var sign = randsign() @@ -548,7 +548,7 @@ var nopaint = (function(){ var CycleTool = ShaderTool.extend({ type: "cycle", n: 0, - speed: 30, + speed: 5, is_recursive: true, start: function(){ this.__start() |
