【发布时间】:2020-08-17 15:33:11
【问题描述】:
对不起,如果这是一个愚蠢的问题,我才开始在处理中学习 Java,我有点困惑。哈哈
boolean eyeMove = false;
boolean armMove = false;
void setup() {
size(600, 800);
smooth();
}
void draw() {
stroke(1);
fill(255);
ellipse(300, 460, 230, 270);
stroke(1);
fill(188);
ellipse(280, 220, 35, 95);
ellipse(320, 220, 35, 95);
fill(126);
ellipse(280, 220, 20, 80);
ellipse(320, 220, 20, 80);
stroke(1);
fill(255);
ellipse(300, 300, 100, 100);
fill(188);
noStroke();
ellipse(300, 460, 130, 170);
fill(0);
ellipse(240, 580, 40, 40);
ellipse(360, 580, 40, 40);
fill(0);
ellipse(300, 320, 20, 10);
fill(0);
triangle(300, 330, 289, 344, 310, 344);
fill(188);
stroke(1);
ellipse(280, 290, 20, 20);
ellipse(320, 290, 20, 20);
keyPressed();
}
void keyPressed() {
if (!keyPressed) {
fill(0);
ellipse(390, 350, 40, 40);
ellipse(210, 350, 40, 40);
} else if (keyPressed) {
armMove = true;
fill(125);
ellipse(390, 350, 40, 40);
ellipse(230, 350, 40, 40);
}
我在兔子的眼睛上使用了 mousePressed,效果很好。我只是很困惑这现在是如何造成问题的。
【问题讨论】:
-
所以你调用了两次“draw()”?问题可能是您没有在每次调用 draw() 之前清除画布,而只是在已经存在的内容之上绘制?
-
嘿,谢谢你帮我调查这个:) 你是说 keyPressed 吗?因为在我发布的代码中它只有一次“draw()”?我不想只清除手臂上的整个画布怎么做?我看过的所有视频都只是告诉我如何清除背景,而不是一个特定的圆圈:/或者你知道有什么好的视频可以观看吗?:)
标签: java animation processing