Code viewer for World: paint erase picture (clone...

// Cloned by Xiaoyu Lyu on 17 Nov 2022 from World "paint erase picture" by P5 Editor porting project 
// Please leave this clone trail here.
 

/*https://editor.p5js.org/p5/sketches/Image:_Copy_Method
 * @name Copy() method
 * @frame 600,400
 * @description An example of how to simulate coloring image with the copy() method.
 */
let draft, ready;
function preload() {
  ready = loadImage("uploads/p5editor/1624215182.png");
  draft = loadImage("uploads/p5editor/1624215163.png");
}
function setup() {
  createCanvas(600, 400);
  noCursor();
  cursor("uploads/p5editor/1624215325.png", 20, -10);
  image(ready, 0, 0);
  image(draft, 0, 0);
}
function mouseDragged() {
  copy(ready, mouseX, mouseY, 20, 20, mouseX, mouseY, 20, 20);
}