[英]p5.js background only filling half of background
So I'm just getting into p5.js, and when I go to use the background()
function, it only fills in half the background on a sort of diagonal. 所以我只是进入p5.js,当我使用
background()
函数时,它只填充了对角线的一半背景。
I've drawn some shapes just experimenting with them and colors, but I can't figure out why I can't draw a whole background. 我已经绘制了一些形状,只是尝试了它们和颜色,但是我不明白为什么不能绘制整个背景。
This is my code: 这是我的代码:
function setup() {
createCanvas(200,200);
}
function draw() {
background(0,100,50);
stroke(255,0,0);
fill(0,255,0);
rect(50,50,20,20);
stroke(0,0,255);
fill(255,0,0);
ellipse(60,40,20,20);
}
The same thing happens if I try using samples of other programs too, so it must not be something with my code. 如果我也尝试使用其他程序的示例,则会发生相同的情况,因此我的代码中一定不能出现这种情况。
Google chrome zoom was 110%, which for some reason doubled the default canvas size in my index.html, disabling the default zoom corrected the issue. Google chrome缩放率为110%,由于某种原因,它使我的index.html中的默认画布大小增加了一倍,禁用默认缩放可解决此问题。 Thank you Kevin and Pepe.
谢谢凯文和佩佩。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.