xxxxxxxxxx
/*
** Simple parallax
**
** Author: Gweltaz Duval-Guennoc
** Date: 04-09-2017 (Résidence à Bourg-Blanc)
**
** Art: Anna Duval-Guennoc (annaduvalguennoc.blogspot.fr)
*/
/* @pjs preload="1eplan.png";
preload="2eplan.png";
preload="3eplan.png"; */
PImage bg;
PImage mg;
PImage fg;
float mX, mY;
int xAmp = 6;
int yAmp = 3;
void setup() {
bg = loadImage("3eplan.png");
mg = loadImage("2eplan.png");
fg = loadImage("1eplan.png");
size(602, 348);
}
void draw() {
background(0);
mX = (mouseX/float(width)) - 0.5;
mY = (mouseY/float(height)) - 0.5;
image(bg, -xAmp, -yAmp);
image(mg, round(-0.2*xAmp*mX)-xAmp, round(-0.2*xAmp*mY)-yAmp);
image(fg, round(-xAmp*mX)-xAmp, round(-yAmp*mY)-yAmp);
}