Browse Source

added fxCopyZoom

master
Victor Giers 1 year ago
parent
commit
297f761a76
3 changed files with 43 additions and 6 deletions
  1. 34
    0
      effects.pde
  2. 8
    5
      secondapplet.pde
  3. 1
    1
      statics_and_lists.pde

+ 34
- 0
effects.pde View File

@@ -1793,7 +1793,41 @@ class GRAUZONE extends Shader {
}
}

/*

COPYZOOM
*/

class COPYZOOM extends Shader {
int coprx, copry, coprw, coprh;
PImage buffer;
COPYZOOM() {
name = "fxCopyZoom";
params.add(new Param("w", FLOATVAL, 0, 1, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE}));
params.add(new Param("h", FLOATVAL, 0, 1, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE}));
params.add(new Param("x", FLOATVAL, 0, 1, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE}));
params.add(new Param("y", FLOATVAL, 0, 1, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE}));
buffer = createImage(renderer.width, renderer.height, ARGB);

coprw = int(random(0, renderer.width));
coprh = int(random(0, renderer.height));
coprx = int(random(0, renderer.width-coprw));
copry = int(random(0, renderer.height-coprh));
}
void apply() {
if (buffer.width != renderer.width || buffer.height != renderer.height) buffer.resize(renderer.width, renderer.height);
buffer = renderer.get();
coprw = int(map(params.get(0).value, 0, 1, 1, renderer.width));
coprh = int(map(params.get(1).value, 0, 1, 1, renderer.height));
coprx = int(map(params.get(2).value, 0, 1, 0, renderer.width-coprw));
copry = int(map(params.get(3).value, 0, 1, 0, renderer.height-coprh));
renderer.beginDraw();
buffer.copy(coprx, copry, coprw, coprh, 0, 0, renderer.width, renderer.height);
renderer.image(buffer, 0, 0, renderer.width, renderer.height);
renderer.endDraw();
}
}

/*


+ 8
- 5
secondapplet.pde View File

@@ -45,10 +45,10 @@ public class SecondApplet extends PApplet {
.setSize(15, 15)
.plugTo(this, "CP5_pauseAllAction");
pauseAll.getCaptionLabel().getStyle().setMargin(-17, 0, 0, 20);
Bang nativeReso = cp5.addBang("native reso")
.setPosition(220,height-35)
.setSize(15,15)
.setPosition(220, height-35)
.setSize(15, 15)
.plugTo(this, "CP5_nativeResoAction");
//nativeReso.getCaptionLabel().getStyle().setMargin(-17,0,0,20);

@@ -102,10 +102,10 @@ public class SecondApplet extends PApplet {
totalBrickHeight+= bricks.get(i).h;
}
popMatrix();
if(heightOverLimit){
if (heightOverLimit) {
strokeWeight(3);
fill(255);
line(width-5,-scrollAmount+4,width-5,height-120+(maxSurfaceHeight-120-totalBrickHeight)-scrollAmount-4);
line(width-5, -scrollAmount+4, width-5, height-120+(maxSurfaceHeight-120-totalBrickHeight)-scrollAmount-4);
//-scrollAmount + (-1*(maxSurfaceHeight-120-totalBrickHeight)));
}
fill(68, 68, 68);
@@ -551,6 +551,9 @@ public class SecondApplet extends PApplet {
case(15):
shaderManager.addShader(new GRAUZONE());
break;
case(16):
shaderManager.addShader(new COPYZOOM());
break;
/*
case(4):
shaderManager.addShader(new AUECHO());

+ 1
- 1
statics_and_lists.pde View File

@@ -57,9 +57,9 @@ String availableFx[] = {
"fxPosterize",
"fxDual",
"fxGrauzone",
"fxCopyZoom",
"fxMove",
"fxCopyZoom",
"fxScanker",
"fxPixelSort",

Loading…
Cancel
Save