该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
想將
void setup(){
size(960,480);
strokeWeight(6);
}
void draw(){
background(204);
stroke(102);
line(836,63,836,105);
line(836,148,836,419);
line(836,105,782,105);
line(782,105,782,373);
line(782,373,802,373);
line(836,418,377,418);
line(836,63,491,63);
line(754,105,451,105);
line(754,105,754,373);
line(754,373,700,373);
line(726,132,726,319);
line(726,319,700,319);
line(726,132,467,132);
line(544,63,544,105);
line(700,162,700,373);
line(700,160,511,160);
line(511,160,511,304);
line(511,304,645,304);
line(553,189,553,261);
line(645,189,645,304);
line(645,189,553,189);
line(553,261,615,261);
line(614,261,614,212);
line(614,212,573,212);
line(573,239,573,212);
line(665,345,467,345);
line(665,345,665,373);
line(665,373,421,373);
line(467,133,467,345);
line(421,105,421,390);
line(461,63,128,63);
line(377,64,377,371);
line(377,373,297,373);
line(377,176,297,176);
line(297,176,297,371);
line(356,204,356,241);
line(297,241,297,204);
line(356,204,297,204);
line(356,241,297,241);
line(337,91,337,152);
line(337,105,166,105);
line(337,143,268,143);
line(268,143,268,399);
line(268,204,166,204);
line(166,105,166,204);
line(128,63,128,241);
line(128,241,227,241);
line(227,222,227,402);
line(226,390,128,390);
line(128,390,128,416);
line(128,416,268,416);
line(268,399,377,399);
line(377,399,377,416);
line(268,402,268,416);
line(128,63,128,241);
ellipse(727,352,16,16);
ellipse(143,403,16,16);
if(mousePressed==true){
stroke(255);
}
line(836,63,836,105);
line(836,148,836,419);
line(836,105,782,105);
line(782,105,782,373);
line(782,373,802,373);
line(836,418,377,418);
line(836,63,491,63);
line(754,105,451,105);
line(754,105,754,373);
line(754,373,700,373);
line(726,132,726,319);
line(726,319,700,319);
line(726,132,467,132);
line(544,63,544,105);
line(700,162,700,373);
line(700,160,511,160);
line(511,160,511,304);
line(511,304,645,304);
line(553,189,553,261);
line(645,189,645,304);
line(645,189,553,189);
line(553,261,615,261);
line(614,261,614,212);
line(614,212,573,212);
line(573,239,573,212);
line(665,345,467,345);
line(665,345,665,373);
line(665,373,421,373);
line(467,133,467,345);
line(421,105,421,390);
line(461,63,128,63);
line(377,64,377,371);
line(377,373,297,373);
line(377,176,297,176);
line(297,176,297,371);
line(356,204,356,241);
line(297,241,297,204);
line(356,204,297,204);
line(356,241,297,241);
line(337,91,337,152);
line(337,105,166,105);
line(337,143,268,143);
line(268,143,268,399);
line(268,204,166,204);
line(166,105,166,204);
line(128,63,128,241);
line(128,241,227,241);
line(227,222,227,402);
line(226,390,128,390);
line(128,390,128,416);
line(128,416,268,416);
line(268,399,377,399);
line(377,399,377,416);
line(268,402,268,416);
line(128,63,128,241);
ellipse(727,352,16,16);
ellipse(143,403,16,16);
}
跟下面合在一起!
float x;
float y;
float px;
float py;
float myEasing=0.02;
void setup(){
size(960,480);
stroke(0,102);
}
void draw(){
float targetX=mouseX;
float targetY=mouseY;
x+=(targetX-x)*myEasing;
y+=(targetY-y)*myEasing;
float myWeight=dist(x,y,px,py);
strokeWeight(myWeight);
line(x,y,px,py);
px=x;
py=y;
}