小白求教!!!!!!“mixing active and static modes"
processing吧
全部回复
仅看楼主
level 1
南城十五 楼主
//left red
int x = 120;
int y = 330;
int w = 255;
int h = 25;
void setup(){
size(760,825);
smooth();
sstrokeWeight(2);
}
void draw(){
background(250);
if((mouseX>x)&&(mouseX<x+w)&&
(mouseY>y)&&(mouseY<y+h)){
fill(154,133,240);
}else{
fill(229,111,125);
}
rect(x,y,w,h);
triangle(100,343,120,330,120,355);
fill(255,255,255);
textSize(15);
text("Asia",335,347);
fill(0,0,0);
textSize(15);
text("62%",60,347);
}
//middle
//big cicrle
fill(129,92,74);
ellipse(380,290,50,50);
//small cicrle
noStroke();
fill(240,193,39);
ellipse(380,290,28,28);
//gunzi
fill(129,92,74);
rect(375,313,11,500);
想做一个指示牌,鼠标放上去就变颜色,但是出现错误。
周五就交作业了,求求大家救命!!!!!!!!!!!
2018年11月21日 08点11分 1
level 6
2018年11月21日 11点11分 2
level 6
楼主你的代码去掉最后那些就行了。。。
话说你为什么把最后那部分放在draw()外面。。。
另外setup里面有一行多了个s
2018年11月21日 11点11分 3
level 6
把最后的draw()外面的代码移进draw()
2018年11月21日 11点11分 4
啊啊啊啊啊啊啊啊啊!!!谢谢谢谢!已经可以了
2018年11月21日 14点11分
level 7
Hello,@南城十五。关于这个错误,我想说的是——
active mode(动态模式)与 static mode(静态模式)。简单理解,前者所创建的为动态图形,后者则为静态图形。
为什么会如此差异呢?
静态模式,所有函数皆为内置函数,即不存在自定义的函数。故函数都是一次性调用,图形为静态。
动态模式,却是常常包含 setup() 和 draw() 。而在 draw() 中的函数都可在程序运行过程中循环调用,是动态的。
2018年11月21日 14点11分 5
1