Ciao 访客, welcome back to old school! :p
void setup(){ size(270,420); smooth(); rectMode(CENTER);}void draw(){ background(255); //Legs noStroke(); fill(#4778BB); rect(142,396,177,36); //Body noStroke(); fill(#C6776A); rect(137,335,189,86); rect(137,287,161,63); arc(138,378,190,28,0,PI); //Left Arm stroke(#C6776A); strokeWeight(30); strokeCap(ROUND); beginShape(); curveVertex(81,256); curveVertex(70,265); curveVertex(46,306); curveVertex(35,350); curveVertex(35,362); endShape(); stroke(50); strokeWeight(1.5); line(57,316,52,352); //Right Arm stroke(#C6776A); strokeWeight(30); strokeCap(ROUND); beginShape(); curveVertex(192,257); curveVertex(210,270); curveVertex(229,310); curveVertex(240,351); curveVertex(240,366); endShape(); stroke(50); strokeWeight(1.5); line(215,318,220,350); //Left Hand noStroke(); fill(#EC2F4A); ellipse(34,353,42,42); stroke(50); strokeWeight(1); ellipse(49,349,17,17); //Right Hand noStroke(); fill(#EC2F4A); ellipse(240,361,41,41); stroke(50); strokeWeight(1); ellipse(223,355,17,17); //Collar stroke(#EC2F4A); strokeWeight(15); strokeCap(ROUND); beginShape(); curveVertex(58,250); curveVertex(64,267); curveVertex(90,290); curveVertex(130,304); curveVertex(154,307); endShape(); strokeWeight(20); beginShape(); curveVertex(139,301); curveVertex(147,301); curveVertex(186,291); curveVertex(212,272); curveVertex(221,262); endShape(); //Buttons stroke(50); strokeWeight(2); line(141,314,138,388); noStroke(); fill(50); ellipse(129,319,7,7); ellipse(128,346,7,7); ellipse(127,374,7,7); //Face noStroke(); fill(#FFECC4); ellipse(135,164,255,264); //Hat noStroke(); fill(#4778BB); arc(134,134,250,210,-PI,0); strokeCap(SQUARE); strokeWeight(32); stroke(#EC2F4A); noFill(); beginShape(); curveVertex(-7,155); curveVertex(2,149); curveVertex(70,130); curveVertex(125,124); curveVertex(195,128); curveVertex(266,142); curveVertex(275,147); endShape(); //Shoe noStroke(); fill(50); arc(93,414,110,18,-PI,0); arc(192,414,110,18,-PI,0); //Left Eye pushMatrix(); translate(101,182); rotate(radians(19.2)); noStroke(); fill(255); ellipse(0,0,68,78); popMatrix(); //Right Eye pushMatrix(); translate(171,181); rotate(radians(-22.7)); noStroke(); fill(255); ellipse(0,0,68,78); popMatrix(); //Left Pupil noStroke(); fill(0); ellipse(113,184,9,9); ellipse(156,182,9,9); //Eyebrow stroke(0); strokeWeight(4); line(78,127,52,152); line(182,124,211,145); //Mouth noStroke(); fill(0); triangle(107,250,176,248,142,276); fill(255); beginShape(QUADS); vertex(113,251); vertex(126,250); vertex(125,259); vertex(120,259); vertex(129,250); vertex(142,249); vertex(142,259); vertex(128,259); vertex(144,250); vertex(160,250); vertex(156,259); vertex(145,260); vertex(162,250); vertex(172,250); vertex(163,258); vertex(157,259); endShape(); strokeCap(ROUND); //Hat Decoration for(int i=0;i<9;i++){ pushMatrix(); translate(120,33); rotate(radians(360/9*i)); stroke(50); strokeWeight(6); line(-25,0,25,0); stroke(#EC2F4A); strokeWeight(5); line(-25,0,25,0); popMatrix(); }}
void setup() { size(270, 430); background(255, 255, 255);}void draw() { if (mousePressed && mouseButton == LEFT) { drawAll(0); } else { drawAll(1); }}void drawAll(int eyeAction) { HatTop hatTop = new HatTop(240, 50, 80, 6, ROUND, 72, 34, 50, 9); BlueHat bHat = new BlueHat(78, 118, 188, 135, 150, 245, 245); HatRedEdge rHatEdge = new HatRedEdge(237, 48, 76, 135, 140, 255, 20); Cloth cloth = new Cloth(135, 282, 245, 245); Face face = new Face(255, 236, 194, 135, 152, 245, 245, eyeAction); Base [] elements = { bHat, rHatEdge, hatTop, cloth, face }; for (int i = 0; i < elements.length; i++) { elements[i].doDraw(); }}
class Base { Base() { smooth(); noStroke(); } void doDraw() { }}
class BlueHat extends Base { int _R = 0; int _G = 0; int _B = 0; float _startX = 0; float _startY = 0; float _hWidth = 0; float _hHeight = 0; BlueHat(int r, int g, int b, float startX, float startY, float hWidth, float hHeight) { this._R= r; this._G= g; this._B= b; this._startX = startX; this._startY = startY; this._hWidth = hWidth; this._hHeight = hHeight; } void doDraw() { drawBlueHat(); } void drawBlueHat() { fill(this._R, this._G, this._B); noStroke(); arc(this._startX, this._startY, _hWidth, _hHeight, PI, TWO_PI); }}
class HatRedEdge extends Base { int _R = 0; int _G = 0; int _B = 0; float _startX = 0; float _startY = 0; float _hWidth = 0; float _hHeight = 0; HatRedEdge(int r, int g, int b, float startX, float startY, float hWidth, float hHeight) { this._R= r; this._G= g; this._B= b; this._startX = startX; this._startY = startY; this._hWidth = hWidth; this._hHeight = hHeight; } void doDraw() { drawHatRedEdge(); } void drawHatRedEdge() { fill(this._R, this._G, this._B); noStroke(); rectMode(CENTER); rect(this._startX, this._startY, _hWidth, _hHeight); arc(this._startX, this._startY-10, _hWidth, _hHeight+20, PI, TWO_PI); }}
class HatTop extends Base { int _R = 0; int _G = 0; int _B = 0; int _weight = 0; int _cap = 0; int _baseX = 0; int _baseY = 0; int _lineLength = 0; int _drawNumber = 0; HatTop(int r, int g, int b, int weight, int cap, int baseX, int baseY, int lineLength, int drawNumber) { this._R= r; this._G= g; this._B= b; this._weight= weight; this._cap= cap; this._baseX= baseX; this._baseY= baseY; this._lineLength = lineLength; this._drawNumber = drawNumber; } void doDraw() { drawHatTop(); } void drawHatTop() { strokeCap(this._cap); stroke(this._R, this._G, this._B); strokeWeight(this._weight); translate(this._baseX + this._lineLength, this._baseY); int x = 0; while (x < this._drawNumber) { rotate(radians(360/this._drawNumber)); line(0-this._lineLength/2, 0, this._lineLength/2, 0); x += 1; } //revert rotate and axis to normal rotate(-this._drawNumber*radians(360/this._drawNumber)); translate(-(this._baseX + this._lineLength), -this._baseY); }}
class Cloth extends Base { float _startX = 0; float _startY = 0; float _hWidth = 0; float _hHeight = 0; Cloth(float startX, float startY, float hWidth, float hHeight) { this._startX = startX; this._startY = startY; this._hWidth = hWidth; this._hHeight = hHeight; } void doDraw() { drawPants(); drawCoat(); drawTies(); drawGloves(); drawShoes(); } void drawTies() { fill(236, 49, 78); strokeWeight(1); stroke(0); translate(this._startX, this._startY); rotate(radians(28)); ellipse(-40, 0, 95, 25); rotate(-radians(28)); translate(-this._startX, -this._startY); translate(this._startX + 80, this._startY); rotate(-radians(35)); ellipse(-12, -38, 95, 25); rotate(radians(35)); translate(-(this._startX+80), -this._startY); } void drawCoat() { fill(203, 121, 109); noStroke(); quad(this._startX-82, this._startY-40, this._startX+87, this._startY-40, this._startX+110, this._startY+100, this._startX-100, this._startY+100); rectMode(CENTER); translate(this._startX -98, this._startY+15); rotate(-radians(70)); rect(20, 12, 120, 30); ellipse(0, 2, 120, 30); rotate(radians(70)); translate(-(this._startX -98), -(this._startY+15)); translate(this._startX +98, this._startY+15); rotate(radians(70)); rect(0, 5, 120, 30); ellipse(-5, -5, 120, 30); rotate(-radians(70)); translate(-(this._startX +98), -(this._startY+15)); //radians ellipse(this._startX+5, this._startY+97, 211, 25); stroke(54, 45, 46); strokeWeight(3); line(this._startX+8, this._startY+5, this._startX+6, this._startY+104); strokeWeight(2); line(this._startX-88, this._startY+15, this._startX-92, this._startY+48); line(this._startX+96, this._startY+15, this._startX+102, this._startY+48); fill(0); ellipse(this._startX, this._startY+15, 4, 4); ellipse(this._startX-2, this._startY+50, 4, 4); ellipse(this._startX-4, this._startY+85, 4, 4); } void drawGloves() { fill(238, 51, 78); noStroke(); ellipse(this._startX-100, this._startY+70, 45, 45); ellipse(this._startX+105, this._startY+70, 45, 45); stroke(54, 45, 46, 40); strokeWeight(1); ellipse(this._startX-85, this._startY+60, 20, 20); ellipse(this._startX+90, this._startY+60, 20, 20); } void drawPants() { fill(66, 117, 183); noStroke(); rectMode(CENTER); rect(this._startX+8, this._startY+115, 190, 40); } void drawShoes() { fill(46, 44, 49); noStroke(); arc(this._startX-48, this._startY+135, 120, 15, PI, TWO_PI); arc(this._startX+62, this._startY+135, 120, 15, PI, TWO_PI); }}
class Face extends Base { int _R = 0; int _G = 0; int _B = 0; float _startX = 0; float _startY = 0; float _hWidth = 0; float _hHeight = 0; int _eyeAction = 1; Face(int r, int g, int b, float startX, float startY, float hWidth, float hHeight, int eyeAction) { this._R= r; this._G= g; this._B= b; this._startX = startX; this._startY = startY; this._hWidth = hWidth; this._hHeight = hHeight; this._eyeAction = eyeAction; } void doDraw() { drawFace(); switch(this._eyeAction) { case 0: drawClosedEyes(); break; case 1: drawEyes(); break; } drawMouth(); drawEyebrow(); } void drawFace() { fill(this._R, this._G, this._B); noStroke(); arc(this._startX, this._startY, _hWidth, _hHeight, 0, PI); arc(this._startX, this._startY, _hWidth, 28, PI, TWO_PI); } void drawClosedEyes() { fill(255); stroke(0, 0, 0); strokeWeight(5);// line(this._startX-53, this._startY+20,this._startX, this._startY+25);// line(this._startX+10, this._startY+25,this._startX+33, this._startY+20); noFill(); arc(this._startX-53, this._startY+30,60,20,PI,TWO_PI); arc(this._startX+53, this._startY+30,60,20,PI,TWO_PI); } void drawEyes() { fill(255); stroke(0, 0, 0, 40); strokeWeight(2); translate(this._startX-33, this._startY+25); rotate(radians(30)); ellipse(4, 0, 60, 70); rotate(-radians(30)); translate(-(this._startX-33), -(this._startY+25)); translate(this._startX+33, this._startY+25); rotate(radians(-30)); ellipse(1, 4, 60, 70); rotate(radians(30)); translate(-(this._startX+33), -(this._startY+25)); fill(0); float eye1X = constrain(mouseX,this._startX-35,this._startX-15); float eye1Y = constrain(mouseY,this._startY+3,this._startY+40); float eye2X = constrain(mouseX,this._startX+20,this._startX+40); float eye2Y = constrain(mouseY,this._startY+3,this._startY+40); ellipse(eye1X, eye1Y, 8, 8); ellipse(eye2X, eye2Y, 8, 8); } void drawMouth() { fill(51, 46, 50); noStroke(); triangle(this._startX-40, this._startY+85, this._startX+43, this._startY+85, this._startX, this._startY+110); fill(255); quad(this._startX-32, this._startY+87, this._startX-13, this._startY+87, this._startX-15, this._startY+94, this._startX-24, this._startY+94); quad(this._startX-11, this._startY+87, this._startX+5, this._startY+87, this._startX+5, this._startY+94, this._startX-13, this._startY+94); quad(this._startX+7, this._startY+87, this._startX+21, this._startY+87, this._startX+20, this._startY+94, this._startX+7, this._startY+94); quad(this._startX+23, this._startY+87, this._startX+37, this._startY+87, this._startX+27, this._startY+94, this._startX+21, this._startY+94); } void drawEyebrow() { stroke(66, 65, 72); strokeCap(PROJECT); strokeWeight(4); line(this._startX-80, this._startY-10, this._startX-54, this._startY-32); line(this._startX+50, this._startY-32, this._startX+76, this._startY-10); }}
PImage stanmarsh;void setup() { size (540,820); smooth(); stanmarsh = loadImage("Stan Marsh.jpg");}void draw() {//背景图 background(255); //image(stanmarsh,0,0,540,820);//身体strokeWeight(2); noStroke(); fill(20,90,198); rect(110,720,350,80); fill(188,74,42); beginShape(); curveVertex(105, 510); curveVertex(105, 510); curveVertex(40, 660); curveVertex(105, 680); curveVertex(85, 745); curveVertex(285, 765); curveVertex(485, 740); curveVertex(510, 660); curveVertex(445, 510); curveVertex(445, 510); endShape(); noFill(); //衣服 fill(216,2,34); stroke(2); beginShape(); curveVertex(115, 530); curveVertex(115, 530); curveVertex(190, 590); curveVertex(275, 600); curveVertex(245, 570); curveVertex(245, 570); endShape(); beginShape(); curveVertex(300, 570); curveVertex(300, 570); curveVertex(278, 600); curveVertex(295, 610); curveVertex(345, 600); curveVertex(420, 560); curveVertex(440, 540); curveVertex(425, 520); curveVertex(425, 520); endShape(); stroke(0);strokeWeight(8);line(280,605,270,760);strokeWeight(4);line(112,618,100,680);line(428,620,442,680);fill(0);ellipse(256,624,15,15);ellipse(254,672,15,15);ellipse(250,734,15,15);noFill();//脚 fill(0); beginShape(); curveVertex(75, 810); curveVertex(75, 810); curveVertex(160, 790); curveVertex(270, 800); curveVertex(370, 790); curveVertex(490, 810); curveVertex(275, 807); curveVertex(75, 810); curveVertex(75, 810); endShape(); noFill(); //手 noStroke(); fill(170,42,62); ellipse(70,690,80,80); ellipse(480,700,80,80); stroke(0); strokeWeight(1); ellipse(100,680,35,35); ellipse(450,695,35,35);//头部 strokeWeight(2); noStroke(); fill(240,233,106); ellipse(270,320,520,520); fill(10,40,185); beginShape(); vertex(14,270); bezierVertex(70,50,280,60,270,60); bezierVertex(490,80,500,140,525,270); bezierVertex(250,250,250,250,14,270); endShape(); strokeWeight(50); stroke(240,10,10); beginShape(); curveVertex(15, 270); curveVertex(15, 270); curveVertex(260, 250); curveVertex(520, 270); curveVertex(520, 270); endShape(); strokeWeight(10); stroke(0); line(100,300,150,250); line(400,250,450,300);//眼睛 strokeWeight(2); fill(255); pushMatrix(); translate(200,360); rotate(45); ellipse(0,0,120,160); popMatrix(); pushMatrix(); translate(350,360); rotate(335); ellipse(0,0,120,160); popMatrix(); fill(0); ellipse(220,360,20,20); ellipse(320,360,20,20);//嘴巴noStroke();fill(0);triangle(210, 485, 358, 485, 286, 550);fill(255);quad(220, 488, 256,488, 250, 505, 235, 505);quad(259, 488, 290,488, 288, 505, 256, 505);quad(293, 488, 320,488, 318, 505, 292, 505);quad(322, 488, 347,488, 328, 505, 320, 505);noFill();stroke(0);strokeWeight(1);fill(237,41,19);translate(220, 80);for (int i = 1 ; i < 32 ; i++) { rotate( (360/8)*i ); ellipse(0, 0, 10, 120);}}
size(270, 500);background(255);ellipseMode(RADIUS);smooth();//PantsnoStroke();fill(57, 95, 170);rect(55, 385, 160, 55);//Clothesfill(0);rect(35, 330, 200, 50);stroke(183, 91, 91);strokeCap(ROUND);strokeWeight(33);beginShape();vertex(75, 280);bezierVertex(70, 300, 35, 330, 35, 380);endShape();beginShape();vertex(195, 280);bezierVertex(200, 300, 235, 330, 235, 380);endShape();noStroke();fill(183, 91, 91);quad(75, 280, 195, 280, 225, 405, 45, 405);beginShape();vertex(45, 405);bezierVertex(105, 418, 165, 418, 225, 405);bezierVertex(225, 405, 45, 405, 45, 405);endShape();//Collarstroke(0);fill(234, 5, 47);strokeWeight(1);beginShape();vertex(57, 288);bezierVertex(95, 340, 175, 340, 213, 288);bezierVertex(213, 288, 57, 288, 57, 288);endShape();//ButtonsstrokeCap(SQUARE);strokeWeight(3);line(135, 310, 135, 413);noStroke();fill(0);ellipse(125, 340, 3, 3);ellipse(125, 370, 3, 3);ellipse(125, 400, 3, 3);//shoesbeginShape();vertex(40, 440);bezierVertex(60, 425, 125, 425, 145, 440);bezierVertex(145, 440, 40, 440, 40, 440);endShape();beginShape();vertex(125, 440);bezierVertex(145, 425, 210, 425, 230, 440);bezierVertex(230, 440, 125, 440, 125, 440);endShape();//Glovesfill(234, 5, 47);noStroke();ellipse(35, 380, 21, 21);ellipse(235, 380, 21, 21);stroke(0);strokeWeight(1);ellipse(50, 375, 8, 8);ellipse(220, 375, 8, 8);//HeadnoStroke();fill(255, 229, 173);ellipse(135, 188, 127, 127);//Hatfill(0, 77, 183);beginShape();vertex(11, 155);bezierVertex(40, 20, 230, 20, 258, 155);bezierVertex(160, 130, 110, 130, 11, 155);endShape();//Hat Bandfill(234,5,47);beginShape();vertex(3, 150);bezierVertex(100, 115, 170, 115, 267, 150);bezierVertex(267, 150, 267, 180, 267, 180);bezierVertex(170, 145, 100, 145, 3, 180);bezierVertex(3, 180, 3, 150, 3, 150);endShape();//Hat Decostroke(234, 5, 47);strokeWeight(6);strokeCap(ROUND);pushMatrix();translate(120, 53);rotate(0);line(-30, 0, 30, 0);rotate(PI*0.125);line(-30, 0, 30, 0);rotate(PI*0.25);line(-30, 0, 30, 0);rotate(PI*0.375);line(-30, 0, 30, 0);rotate(PI);line(-30, 0, 30, 0);rotate(PI*0.5);line(-30, 0, 30, 0);rotate(PI*0.625);line(-30, 0, 30, 0);rotate(PI*0.75);line(-30, 0, 30, 0);rotate(PI*0.875);line(-30, 0, 30, 0);popMatrix();//Eye Brownstroke(0);strokeCap(SQUARE);strokeWeight(5);line(53, 168, 80, 138);line(187, 140, 217, 168);//EyesnoStroke();pushMatrix();translate(97, 198);rotate(PI*0.15);fill(196, 170, 115);ellipse(0, 5, 38, 43); //eye shadow leftfill(255);ellipse(0, 0, 38, 43); // eye leftpopMatrix();pushMatrix();translate(170, 198);rotate(PI*0.850);fill(196, 170, 115);ellipse(0, -5, 34, 43); //eye shadow rightfill(255);ellipse(0, 0, 34, 43); //eye rightpopMatrix();fill(0);ellipse(108, 197, 4, 4); //Eye Balls Leftellipse(158, 197, 4, 4); //Eye Balls Right//mouthstroke(0);strokeWeight(2);fill(255);triangle(98, 265, 172, 265, 135, 295);fill(0);triangle(114, 277, 156, 277, 135, 295);line(122, 265, 120, 280);line(135, 265, 135, 280);line(153, 265, 150, 280);