Hi @glv , following up on your response I tried to insert that inside a PGraphics class. This is to export later a higher resolution image.
The problem I’m encountering is that I can’t obtain the exact same looking gradients on a much larger canvas (I usually replicate the initial example before tweaking it later on).
Next step will be to change the hard coded values to renderWidth/Height fractions so when I modify printWidth/Height variables it scales up/down consistently.
PGraphics render;
int printWidth = 10;
int printHeight = 10;
int printDpi = 320;
int renderWidth = printWidth * printDpi;
int renderHeight = printHeight * printDpi;
void setup() {
size(800, 400, P2D);
render = createGraphics(renderWidth, renderHeight);
}
void draw() {
render.beginDraw();
render.background(0);
render.colorMode(RGB);
render.translate(renderWidth/4, renderHeight/2);
render.beginShape(QUADS);
render.fill(0, 255, 255); render.vertex(-600, 1200);
render.fill(255, 255, 255); render.vertex(600, 1200);
render.fill(255, 0, 255); render.vertex( 600, -1200);
render.fill(0, 0, 255); render.vertex(-600, -1200);
render.endShape();
render.colorMode(HSB, 360, 100, 100);
render.translate(renderWidth/2, 0);
render.beginShape(QUADS);
render.fill((frameCount+0)%360, 100, 100); render.vertex(-600, 1200);
render.fill((frameCount+90)%360, 100, 100); render.vertex(600, 1200);
render.fill((frameCount+180)%360, 100, 100); render.vertex( 600, -1200);
render.fill((frameCount+270)%360, 100, 100); render.vertex(-600, -1200);
render.endShape();
render.endDraw();
image(render,0,0,width,height);
}
Could it be because there are still 255 color values and now the canvas is much larger? So they gradient gets altered. Perhaps increasing the colorMode() range proportionally would do the trick?