Issues with image float and also image draw
in
Programming Questions
•
1 year ago
Hi Everyone, I have two issues in my below coding.
Firstly If I wanted to stop Image1 from appearing and then only have image 2 appear when the mouse is pressed does anyone know what code i'm missing?
Also when image 2 appears i want it to float on the screen the exact same as Image1, but at this point it doesn't - it just stays there motionless.
Sorry very new to processing.
:(
PImage image2;
PImage image1;
float easing = 0.05; float offset = 0;
void setup()
{
size(1024, 768);
image1 = loadImage("HIPPO.png");
image2 = loadImage("HIPPOBD.png");
}
void draw() {
float targetOffset = map(mouseY, 0, height, -40, 40); offset += (targetOffset - offset) * easing;
image(image1, 85 + offset,65);
}
void mousePressed() {
float targetOffset = map(mouseY, 0, height, -30, 40); offset += (targetOffset - offset) * easing;
image(image2, 85 + offset,65);
}
1