diff --git a/examples/convolution/sketch.js b/examples/convolution/sketch.js index eeebe4c..838cafd 100644 --- a/examples/convolution/sketch.js +++ b/examples/convolution/sketch.js @@ -38,9 +38,20 @@ function setup() { function draw() { background('#060621'); if (image_mode) { - drawQuadrille(quadrille, 0, 0, 20 / (2 ** scl), 1.6 / (2 ** scl), quadrille === orig ? 'magenta' : 'cyan'); + drawQuadrille(quadrille, + { + LENGTH: 20 / (2 ** scl), + outlineWeight: 1.6 / (2 ** scl), + outline: quadrille === orig ? 'magenta' : 'cyan' + }); } else { - drawQuadrille(mask, 0, 0, 50, 2, 'magenta', false, 0.0625, 0.25); + drawQuadrille(mask, + { + LENGTH: 50, + min: 0.0625, + max: 0.25, + alpha: 255 + }); } } diff --git a/examples/from_other/sketch.js b/examples/from_other/sketch.js index 45ac54b..a4f9eae 100644 --- a/examples/from_other/sketch.js +++ b/examples/from_other/sketch.js @@ -28,6 +28,6 @@ function setup() { function draw() { background('#060621'); - drawQuadrille(H, 2, 2, LENGTH, 2); - drawQuadrille(other, 2, 10, LENGTH, 2, 'magenta', true); + drawQuadrille(H, {x: 2, y: 2, LENGTH: LENGTH}); + drawQuadrille(other, {x: 2, y: 10, LENGTH: LENGTH, board: true}); } \ No newline at end of file diff --git a/examples/glyphs/sketch.js b/examples/glyphs/sketch.js index dfa85a8..869a5d7 100644 --- a/examples/glyphs/sketch.js +++ b/examples/glyphs/sketch.js @@ -1,7 +1,7 @@ const ROWS = 20; const COLS = 10; const LENGTH = 20; -var t, T, L, Lbit, test; +var t, I, T, L, Lbit, test; var quadrille; var clone; var x = 2, y = 2; @@ -40,22 +40,41 @@ function setup() { clone.reflect(); test = createQuadrille(4, int(random(1, 1048576)), color('#F0B25A')); c.setBlue(255); + /* + I = createQuadrille([ + [0, c, 0, 0], + [0, c, 0, 0], + [0, c, 0, 0], + [0, c, 0, 0], + ]); + */ + I = createQuadrille([ + [0, 0, 0, 0, 0, 0], + [0, 0, c, 0, 0, 0], + [0, 0, c, 0, 0, 0], + [0, 0, c, 0, 0, 0], + [0, 0, c, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + ]); } function draw() { background('#060621'); - drawQuadrille(quadrille, x, y, LENGTH, 2, 'green'); + //drawQuadrille(quadrille, x, y, LENGTH, 2, 'green'); + drawQuadrille(quadrille, {x: x, y: y, LENGTH: LENGTH, outlineWeight: 2, outline: 'green'}); + drawQuadrille(I, {x:2, y:12, LENGTH: LENGTH, outline:'blue'}); //drawQuadrille(test, x, y, LENGTH, 2, 'green', true); - drawQuadrille(clone, 2, 8, LENGTH, 0); + //drawQuadrille(clone, 2, 8, LENGTH, 0); //drawQuadrille(L, 2, 12, LENGTH); //drawQuadrille(Lbit, 2, 12, LENGTH); + //drawQuadrille(I, 2, 12, LENGTH, 2, 'blue'); } function keyPressed() { if (keyCode === UP_ARROW) { quadrille.reflect(); } else if (keyCode === DOWN_ARROW) { - quadrille.rotate(); + I.rotate(); } if (key === 'a') { x = x > 0 ? x - 1 : x; @@ -76,7 +95,7 @@ function keyPressed() { test.delete(test.height - 1); } if (key === 'p') { - console.log(test.toInt()); + console.log(I.toInt()); } if (key === 'r') { quadrille.randomize(); diff --git a/examples/imaging/sketch.js b/examples/imaging/sketch.js index 58da14e..1507272 100644 --- a/examples/imaging/sketch.js +++ b/examples/imaging/sketch.js @@ -19,7 +19,11 @@ function setup() { function draw() { background('#060621'); - drawQuadrille(quadrille, 0, 0, 20 / (2 ** scl), 1.6 / (2 ** scl)); + drawQuadrille(quadrille, + { + LENGTH: 20 / (2 ** scl), + outlineWeight: 1.6 / (2 ** scl), + }); } function keyPressed() { diff --git a/examples/logic/sketch.js b/examples/logic/sketch.js index 62528a0..338701c 100644 --- a/examples/logic/sketch.js +++ b/examples/logic/sketch.js @@ -27,11 +27,10 @@ function setup() { function draw() { background('#060621'); - drawQuadrille(q1, x1, y1, LENGTH, 2, 'green', true); - drawQuadrille(q2, x2, y2, LENGTH, 2, 'blue', true); + drawQuadrille(q1, {x: x1, y: y1, LENGTH: LENGTH, outline: 'green', board: true}); + drawQuadrille(q2, {x: x2, y: y2, LENGTH: LENGTH, outline: 'blue', board: true}); if (q3) { - drawQuadrille(q3, x3, y3, LENGTH, 2, 'magenta', true); - //drawQuadrille(q3, x3, y3, LENGTH, 2, 'magenta'); + drawQuadrille(q3, {x: x3, y: y3, LENGTH: LENGTH, board: true}); } } diff --git a/examples/memory/sketch.js b/examples/memory/sketch.js index de2ecc9..0297851 100644 --- a/examples/memory/sketch.js +++ b/examples/memory/sketch.js @@ -22,8 +22,8 @@ function setup() { function draw() { background(/*'#060621'*/ '#007ACC'); - drawQuadrille(board, 0, 0, LENGTH, 2, 'blue', true); - drawQuadrille(quadrille, x, y, LENGTH, 2, 'green'); + drawQuadrille(board, {LENGTH: LENGTH, outline: 'blue', board: true}); + drawQuadrille(quadrille, {x: x, y: y, LENGTH: LENGTH, outline: 'green'}); } function keyPressed() { diff --git a/examples/mosaic/sketch.js b/examples/mosaic/sketch.js index 7660d58..0b0453f 100644 --- a/examples/mosaic/sketch.js +++ b/examples/mosaic/sketch.js @@ -21,7 +21,7 @@ function setup() { function draw() { background('#FDF6E3'); - drawQuadrille(quadrille, x, y, LENGTH, 2, 'green'); + drawQuadrille(quadrille, {x: x, y: y, LENGTH: LENGTH, outline: 'green'}); } function keyPressed() { diff --git a/examples/rand/sketch.js b/examples/rand/sketch.js index cefe5c3..1b0bc10 100644 --- a/examples/rand/sketch.js +++ b/examples/rand/sketch.js @@ -36,8 +36,8 @@ function setup() { function draw() { background('#060621'); //drawQuadrille(quadrille, x, y, LENGTH, 2, 'green'); - drawQuadrille(quadrille, 2, 12, LENGTH, 2, 'green'); - drawQuadrille(r, x, y, LENGTH, 2, 'blue', true); + drawQuadrille(quadrille, {x: 2, y: 12, LENGTH: LENGTH, outline: 'green'}); + drawQuadrille(r, {x: x, y: y, LENGTH: LENGTH, outline: 'blue', board: true}); } function keyPressed() { diff --git a/examples/raster/sketch.js b/examples/raster/sketch.js index c205846..e2e58a8 100644 --- a/examples/raster/sketch.js +++ b/examples/raster/sketch.js @@ -12,7 +12,7 @@ function setup() { function draw() { background('#060621'); - drawQuadrille(quadrille, 0, 0, LENGTH, 2, 'green', true); + drawQuadrille(quadrille, {LENGTH: LENGTH, outline: 'green', board: true}); tri(); } diff --git a/p5.quadrille.js b/p5.quadrille.js index 70f5a47..988d862 100644 --- a/p5.quadrille.js +++ b/p5.quadrille.js @@ -21,7 +21,7 @@ class Quadrille { /** * Current library version. */ - static version = '0.3.1'; + static version = '0.4.0'; /** * @param {Quadrille} quadrille1 @@ -601,7 +601,17 @@ class Quadrille { return new Quadrille(...arguments); } - p5.prototype.drawQuadrille = function(quadrille, x = 0, y = 0, LENGTH = 10, outlineWeight = 2, outline = 'magenta', board = false, min = 0, max = 0, alpha = 255) { + p5.prototype.drawQuadrille = function(quadrille, + { x = 0, + y = 0, + LENGTH = 10, + outlineWeight = 2, + outline = 'magenta', + board = false, + min = 0, + max = 0, + alpha = 255 + } = {} ) { this.push(); this.translate(x * LENGTH, y * LENGTH); this.stroke(outline);