p5.js
p5.js copied to clipboard
p5 image scaling(resize func) screw up image quality
p5 image scaling screw up image quality
image(dogeplayer, this.x- 25, this.y - 25);
dogeplayer.resize(this.r + 40, this.r + 40);
Most appropriate sub-area of p5.js?
- [*] Image
- [*] IO (Input/Output)

Hi @EnginKARATAS, can you share a more complete example? Even better if it is running on https://editor.p5js.org. I can't tell where the problem could be with the two lines of code you provided. Thanks.
Hi @limzykenneth , the resize function causing this. I have project like this example. When other tab opens, both tabs, all images bluring.
Im working to dynamic size with socket. I wouldnt share more example.
@EnginKARATAS You don't have to share the code you are working on, just a minimal example that isolate and shows the problem. I can't help otherwise.
//ignore translate, zoom, scale
show() {
translate(width / 2, height / 2);
let newzoom = 128 / player.r;
zoom = lerp(zoom, newzoom, 0.1);
scale(zoom*0.5);
translate(-player.x, -player.y);
image(dogeplayer, this.x- 25, this.y - 25);
dogeplayer.resize(this.r + 40, this.r + 40);
}
in sketch.js
if (frameCount % 60 == 0) { if (player.r > 10 && player.r < 64) { player.r -= 1; } else if (player.r > 64) { player.r -= 3 } }}
how I solve(but there is no re-sizing with my solve. I want to re-sizing)
player.js show function

and I make a comment line for variable that growing the size
