Hi. I want to scroll a large image horizontally, and the code below will do the job, but not as smooth that I'm used to, on my tablet (Samsung Tab E 9.6). It flickers a bit. Is there a way to improve it or better use java ScrollView containing an image?
PGraphics img;
int imgx;
boolean dragging = false;
void setup() {
fullScreen();
orientation(LANDSCAPE);
img = createGraphics(4 * width, height);
img.beginDraw();
img.fill(150);
for (float i = 200; i <= 4 * width; i += 400) {
img.ellipse(i, 400, 400, 400);
}
img.endDraw();
frameRate(1000);
}
void draw() {
background(255);
imgx = constrain(imgx, -img.width + width, 0);
set(imgx, 0, img);
if (!mousePressed && dragging) dragging = false;
if (dragging) imgx += -pmouseX + mouseX;
}
void mousePressed() {
dragging = true;
}