Processing 帧的大小变大
当同时按下箭头键(+、-)和T时,帧的大小变大,整个帧变大(黑色边框增加),而“图片”变小Processing 帧的大小变大,processing,Processing,当同时按下箭头键(+、-)和T时,帧的大小变大,整个帧变大(黑色边框增加),而“图片”变小 color c=color(0); int strokeW=1,flag=0; void setup() { size(600, 600); background(255); } void draw() { fill(c); stroke(c); strokeWeight(strokeW); if(flag==1) line(mouseX, mouseY, pmouseX, pmouseY);
color c=color(0);
int strokeW=1,flag=0;
void setup() {
size(600, 600);
background(255);
}
void draw() {
fill(c);
stroke(c);
strokeWeight(strokeW);
if(flag==1) line(mouseX, mouseY, pmouseX, pmouseY);
}
void mouseDragged() {
flag=1;
}
void mouseReleased(){
flag=0;
}
void keyPressed() {
if (keyCode == UP) strokeW++;
if (keyCode == DOWN) strokeW--;
if (key == 'c')
background(255);
if (key == 't') {
fill(255,10); // semi-transparent white
rect(0,0,width,height);
fill(0);
//line(mouseX, mouseY, , 100);
}
if (strokeW<0)strokeW=1;
if(key== 'b')
c = color(random(0,255),random(0,255),random(0,255));
}
color c=color(0);
int strokeW=1,flag=0;
无效设置(){
大小(600600);
背景(255);
}
作废提款(){
填充(c);
中风(c);
冲程重量(冲程);
if(flag==1)行(mouseX、mouseY、pmouseX、pmouseY);
}
void mouseDragged(){
flag=1;
}
void mouse(){
flag=0;
}
按下void键(){
if(keyCode==UP)strokeW++;
如果(keyCode==向下)冲程--;
如果(键=='c')
背景(255);
如果(键=='t'){
填充(255,10);//半透明白色
矩形(0,0,宽度,高度);
填充(0);
//线(mouseX,mouseY,100);
}
如果(strokeW您必须更改此片段(1):
分为(2):
在(1)中,使用currentstroke
和strokeWeight
值绘制rect。在每个动画帧中,在draw()
方法中,有:
stroke(c);
strokeWeight(strokeW);
它将笔划权重设置为strokeW
。当您按't'
字母时,此当前笔划将用作您的矩形(0,0,宽度,高度)
边框。我已经运行了您的程序,仍然不知道您在问什么。
if (key == 't') {
fill(255,10); // semi-transparent white
stroke(255);
strokeWeight(0);
rect(0,0,width,height);
fill(0);
}
stroke(c);
strokeWeight(strokeW);