Last active
February 2, 2017 01:41
Revisions
-
AlcaDesign revised this gist
Feb 2, 2017 . 1 changed file with 38 additions and 37 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,49 +1,50 @@ float sliderA, sliderB; float dim = 20; void setup() { size(600, 600); sliderA = random(0, dim); sliderB = random(0, dim * 2); } void draw() { clear(); sliderA = map(mouseX, 0, width, 0, dim); sliderB = map(mouseY, 0, height, 0, dim * 2.0); drawFirstElement(); repeatSample(0, 0, dim, dim); } void drawFirstElement () { pushMatrix(); stroke(255); line(sliderB, 0, sliderA, sliderA); popMatrix(); PImage a = get(0, 0, floor(dim * 2), floor(dim)); pushMatrix(); translate(dim * 2, 0); scale(-1, 1); image(a, 0, 0); popMatrix(); PImage b = get(0, 0, floor(dim * 2), floor(dim * 2)); pushMatrix(); translate(dim * 2, 0); rotate(radians(90)); image(b, 0, 0); popMatrix(); pushMatrix(); translate(0, dim * 2); scale(1, -1); image(b, 0, 0); popMatrix(); pushMatrix(); translate(0, 0); rotate(radians(90)); scale(1, -1); image(b, 0, 0); popMatrix(); } void repeatSample(int x, int y, float w, float h) { -
AlcaDesign created this gist
Feb 2, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,56 @@ float sliderA, sliderB; float dim = 20; void setup() { size(600, 600); sliderA = random(0, dim); sliderB = random(0, dim * 2); } void draw() { clear(); sliderA = map(mouseX, 0, width, 0, dim); sliderB = map(mouseY, 0, height, 0, dim * 2.0); drawFirstElement(); repeatSample(0, 0, dim, dim); } void drawFirstElement () { pushMatrix(); stroke(255); line(sliderB, 0, sliderA, sliderA); popMatrix(); PImage a = get(0, 0, floor(dim * 2), floor(dim)); pushMatrix(); translate(dim * 2, 0); scale(-1, 1); image(a, 0, 0); popMatrix(); PImage b = get(0, 0, floor(dim * 2), floor(dim * 2)); pushMatrix(); translate(dim * 2, 0); rotate(radians(90)); image(b, 0, 0); popMatrix(); pushMatrix(); translate(0, dim * 2); scale(1, -1); image(b, 0, 0); popMatrix(); pushMatrix(); translate(0, 0); rotate(radians(90)); scale(1, -1); image(b, 0, 0); popMatrix(); } void repeatSample(int x, int y, float w, float h) { if (w > 500 ) return; PImage sample = get(x, y, floor(w * 2), floor(h * 2)); image(sample, x + w * 2, y, w * 2, h * 2); image(sample, x + w * 2, y + w * 2, w * 2, h * 2); image(sample, x, y + w * 2, w * 2, h * 2); repeatSample(x, y, w * 2, h * 2); }