xxxxxxxxxx
let imgw = 800;
let imgh = 600;
let imgs = 1.0;
let imgws = 0;
let imghs = 0;
let xoff_base = 200.0;
let xoff = 0;
let yoff_base = 100.0;
let yoff = 0;
function preload(){
soundFormats('mp3');
music = loadSound('song.mp3');
}
function setup() {
createCanvas(windowWidth, windowHeight);
img = loadImage('saul.jpg');
music.setVolume(1.0);
background(0);
}
function draw() {
if(!music.isPlaying()){
music.play();
}
imgs = sin(millis() / 1500)*2.0 + 3.5;
imgws = imgw * imgs;
imghs = imgh * imgs;
xoff = xoff_base * sin(millis() / 1000);
yoff = yoff_base * sin(millis() / 3000) + 100;
image(img, (windowWidth/2) - (imgws / 2) + xoff, (windowHeight/2) - (imghs / 2) +yoff ,imgws, imghs);
}