PShape bot1;
PShape bot2;
PShape bot3;
PImage fondo;
float easing = 0.05;
float offset = 0;
void setup() {
size(600, 400);
bot1 = loadShape("cacaguate.svg");
bot2 = loadShape("cacaguate2.svg");
bot3 = loadShape("cacaguate3.svg");
fondo = loadImage("fonfon.png");
smooth();
}
void draw() {
// Set the background to the "landscape" image; this image
// must be the same width and height as the program
background(fondo);
// Set the left/right offset and apply easing to make
// the transition smooth
float targetOffset = map(mouseY, 0, height, -40, 60);
offset += (targetOffset - offset) * easing;
// Draw the left robot
shape(bot1, 85 + offset, 30);
// Draw the right robot smaller and give it a smaller offset
float smallerOffset = offset * 0.7;
shape(bot2, 510 + smallerOffset, 140, 45, 248);
// Draw the smallest robot, give it a smaller offset
smallerOffset *= -0.5;
shape(bot3, 410 + smallerOffset, 225, 39, 124);
}
No hay comentarios:
Publicar un comentario