Hi all, completely new to processing. I'm just trying to do a very basic sketch using two images. I'm using offseting so one of the images goes up and down according to the mouse movement, but I want to restrict how high the images goes up since the image obviously cuts off at some point.
My code is:
PImage a, b;
float offset;
void setup() {
size(965, 725);
a = loadImage("2b.png");
b = loadImage("2c.png");
}
void draw() {
image(a, -50, -30);
float offsetTarget = map(mouseX, 0, width, -b.width/2 - width/2, 0);
offset += (offsetTarget-offset);
image(b, 0, offset);
}
My code is:
PImage a, b;
float offset;
void setup() {
size(965, 725);
a = loadImage("2b.png");
b = loadImage("2c.png");
}
void draw() {
image(a, -50, -30);
float offsetTarget = map(mouseX, 0, width, -b.width/2 - width/2, 0);
offset += (offsetTarget-offset);
image(b, 0, offset);
}
1