xxxxxxxxxx
28
let offset = 0;
let easing = 0.05;
function setup() {
createCanvas(600, 500);
imgBase = loadImage('base.png'); // Load the image
imgGas = loadImage('gas.png');
}
function draw() {
background(220);
//image(imgBase, 0, 0);
tint(255,255);
image(imgBase, 50, height / 5, imgBase.width / 6, imgBase.height / 6);
let dx = mouseX - imgBase.width / 2 - offset;
offset += dx * easing;
tint(255, 127);
image(imgBase, offset, 0);
}
//function draw() {
//image(img, 0, 0); // Display at full opacity
//let dx = mouseX - img.width / 2 - offset;
//offset += dx * easing;
//tint(255, 127); // Display at half opacity
//image(img, offset, 0);
//}