#Codevember day08: Cat
角丸の多角形など,チャレンジしたいこともあったが時間もあり,今回はたどり着けなかった.しかしやれることはやった😃
Add rounding corners of triangles. · Issue #2529 · processing/p5.js · GitHub
let dark_yellow; let yellow; let light_yellow; let brown; let tooth; let eye; let tongue; let mouse; let bg_blue; let light_blue; let whisker; function setup() { createCanvas(400, 400); colorMode(HSB, 360, 100, 100, 100); angleMode(DEGREES); rectMode(CENTER); colorInit(); background(bg_blue); for (let x = -width; x < width * 2; x += width / 10) { push(); translate(x, height / 2); rotate(45); fill(196, 33, 93, 25); noStroke(); rect(0, 0, 700, 15); pop(); } translate(width / 2, height / 2); // strokeWeight(20); // strokeJoin(ROUND); push(); translate(-90, -100); rotate(-30); strokeWeight(10); strokeJoin(ROUND); stroke(yellow); fill(yellow); triangle(100 - 50 - 50, 30 - 100, 30 - 50 - 50, 170 - 100, 170 - 50 - 50, 170 - 100); stroke(light_yellow); fill(light_yellow); scale(0.6); triangle(100 - 50 - 50, 30 - 100, 30 - 50 - 50, 170 - 100, 170 - 50 - 50, 170 - 100); pop(); push(); translate(90, -100); rotate(30); strokeWeight(10); strokeJoin(ROUND); stroke(yellow); fill(yellow); triangle(100 - 50 - 50, 30 - 100, 30 - 50 - 50, 170 - 100, 170 - 50 - 50, 170 - 100); stroke(light_yellow); fill(light_yellow); scale(0.6); triangle(100 - 50 - 50, 30 - 100, 30 - 50 - 50, 170 - 100, 170 - 50 - 50, 170 - 100); pop(); //neck fill(dark_yellow); noStroke(); ellipse(0, 110, 100, 100); //face fill(yellow); noStroke(); ellipse(0, 0, 250, 250); //mouse fill(mouse); noStroke(); ellipse(0, 75, 60, 60); fill(brown); noStroke(); rect(-30, -105, 12, 45, 10); rect(-10, -105, 12, 45, 10); rect(10, -105, 12, 45, 10); rect(30, -105, 12, 45, 10); // fill(201, 100, 21); noStroke(); ellipse(0, 65, 35, 35); fill(tooth); stroke(tooth); arc(0, 75, 60, 60, 205, 270 + 65, CHORD); fill(tongue); stroke(tongue); arc(0, 75, 60, 60, 45, 90 + 45, CHORD); arc(0, 96, 40, 30, 180, 360, CHORD); push(); translate(-21, 65); rotate(90); fill(tooth); stroke(tooth); strokeWeight(5); beginShape(); for (let angle = 0; angle < 360; angle += 360 / 3) { let x = cos(angle) * 3; let y = sin(angle) * 3; vertex(x, y); } endShape(CLOSE); pop(); push(); translate(21, 65); rotate(90); fill(tooth); stroke(tooth); strokeWeight(5); beginShape(); for (let angle = 0; angle < 360; angle += 360 / 3) { let x = cos(angle) * 3; let y = sin(angle) * 3; vertex(x, y); } endShape(CLOSE); pop(); // left eye noStroke(); fill(tooth); ellipse(-55, -10, 50, 50); noStroke(); fill(eye); ellipse(-55, -10, 25, 25); noStroke(); fill(brown); rect(-55, -50, 45, 15, 10); // right eye noStroke(); fill(tooth); ellipse(55, -10, 50, 50); noStroke(); fill(eye); ellipse(55, -10, 25, 25); noStroke(); fill(brown); rect(55, -50, 45, 15, 10); // nose noStroke(); fill(dark_yellow); rect(0, 15, 30, 25, 15); // left whiskers fill(whisker); noStroke(); rect(-100, 45, 90, 12, 5); rect(-100, 45 + 20, 90, 12, 5); rect(-100, 45 + 20 * 2, 90, 12, 5); // right whiskers fill(whisker); noStroke(); rect(100, 45, 90, 12, 5); rect(100, 45 + 20, 90, 12, 5); rect(100, 45 + 20 * 2, 90, 12, 5); } function colorInit() { mouse = color(193, 96, 25); dark_yellow = color(43, 82, 98); yellow = color(46, 52, 98); light_yellow = color(55, 38, 98); brown = color(7, 46, 63); tooth = color(203, 9, 94); eye = color(193, 96, 25); tongue = color(358, 57, 88); bg_blue = color(192, 74, 80); light_blue = color(196, 36, 93); whisker = color(29, 35, 95); }