Resizing an image without losing resolution

Hi there. I am trying to resize an image according to the window size. However, when I make the window small and then make it great again (haha..) then the resolution is lost.

function setup() {
  moon = loadImage("assets/moonwalk.jpg");
  createCanvas(windowWidth, windowHeight);
}

function draw() {
    background(255);
    image(moon,0,0);
    moon.resize(windowWidth,0)
}

http://alpha.editor.p5js.org/mxa/sketches/Hy9CEZj5-

Tagged:

Answers

This discussion has been closed.