xxxxxxxxxx
56
/*
* @name Load and Display Image
* @description Images can be loaded and displayed to the screen at their
* actual size or any other size.
* <p><em><span class="small"> To run this example locally, you will need an
* image file, and a running <a href="https://github.com/processing/p5.js/wiki/Local-server">
* local server</a>.</span></em></p>
*/
let img; // Declare variable 'img'.
let photoY=0;
let photoX=0;
fontsize = 20;
function setup() {
createCanvas(800, 480);
neapolis = loadImage('https://66.media.tumblr.com/bf95ce62310c1e42ebf75cac0ea8f24f/cc57c045af1178a0-2b/s1280x1920/a62152bd6a2952ffe3b1213f22eaf3ef598b6c55.png'); // Load the image
textFont("Georgia");
textSize(36);
//textAlign(CENTER);
}
function draw() {
background(255);
push();
image(neapolis, photoX, photoY);
// imageMode(CENTER);
pop();
}
function keyTyped(){
if(key=="8"){
photoY=photoY-10;
}
if(key=="2"){
photoY=photoY+10;
}
if(key=="6"){
photoX=photoX-10;
}
if(key=="4"){
photoX=photoX+10;
}
}