xxxxxxxxxx
43
let infile = 'assets/moonwalk.jpg';
let img;
var mX,mY;
var iscale = 0.5;
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
mx = width/2; // init at center canvas
my = height/2;
}
function preload() {
img = loadImage(infile);
}
function setup() {
createCanvas(windowWidth, windowHeight,P2D);
//frameRate(60);
imageMode(CENTER);
img.resize(img.width*iscale, img.height*iscale);
mx = width/2; // init at center canvas
my = height/2;
}
function draw() {
background(200,200,0);
// image(img, mx, my,img.width*iscale, img.height*iscale);
image(img, mx, my);
text(nf(frameRate(),0,1),10,10);
}
function mouseDragged() {
//function mouseMoved() {
mx = mouseX;
my = mouseY;
}
function keyPressed() {
if ( key == 'i' ) {
print (" width "+width+" height "+height+" windowWidth "+windowWidth+" windowHeight "+windowHeight);
}
}