Skip to content

Instantly share code, notes, and snippets.

@chrisallick
Created October 2, 2015 15:24
Show Gist options
  • Select an option

  • Save chrisallick/c5f4112f30b2e9ef790a to your computer and use it in GitHub Desktop.

Select an option

Save chrisallick/c5f4112f30b2e9ef790a to your computer and use it in GitHub Desktop.
Loading An Image & Drawing an Image
var img;
function setup() {
createCanvas(640, 480);
img = loadImage( "kitten.png" );
background( 255 );
}
function draw() {
if( mouseIsPressed ){
image( img, mouseX-(img.width/2), mouseY-(img.height/2) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment