Code Sketch


virat kholi funny
By: Mhalsakant School
Category: Programming
// --- Kojo Vector Portrait: King Kohli ---
cleari()
setBackground(Color(245, 245, 250)) // ?????? ???? ??????????

// ?. ????? ??? ???? (Navy Blue & Orange India Collar)
def drawJersey(): Unit = {
  // ????
  val collar = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-60, -110)
    p.vertex(0, -145)
    p.vertex(60, -110)
    p.vertex(45, -160)
    p.vertex(-45, -160)
    p.endShape()
  }
  collar.setFillColor(Color(255, 102, 0)) // ????? ???? ???????
  collar.setPenColor(noColor)
  draw(collar)

  // ?????
  val body = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-110, -220)
    p.vertex(-60, -110)
    p.vertex(60, -110)
    p.vertex(110, -220)
    p.endShape()
  }
  body.setFillColor(Color(10, 30, 80)) // ?????? ???? ?????
  body.setPenColor(noColor)
  draw(body)
}

// ?. ??? ??? ??? (Neck & Ears)
def drawNeckAndEars(): Unit = {
  // ??? (Neck)
  val neck = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-35, -50)
    p.vertex(35, -50)
    p.vertex(40, -120)
    p.vertex(-40, -120)
    p.endShape()
  }
  neck.setFillColor(Color(195, 135, 95)) // ??? ??????
  neck.setPenColor(noColor)
  draw(neck)

  // ??? (Left & Right Ears)
  val leftEar = Picture.ellipse(14, 22)
  leftEar.setFillColor(Color(225, 160, 120))
  leftEar.setPenColor(noColor)
  leftEar.setPosition(-58, -10)
  draw(leftEar)

  val rightEar = Picture.ellipse(14, 22)
  rightEar.setFillColor(Color(225, 160, 120))
  rightEar.setPenColor(noColor)
  rightEar.setPosition(44, -10)
  draw(rightEar)
}

// ?. ????????? ???? (Facial Structure)
def drawFace(): Unit = {
  val face = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-52, 20)  // ???? ???????
    p.vertex(52, 20)   // ???? ???????
    p.vertex(48, -20)  // ???
    p.vertex(30, -75)  // ?????? ???????
    p.vertex(0, -90)   // ?????? ????
    p.vertex(-30, -75) // ?????? ???????
    p.vertex(-48, -20)
    p.endShape()
  }
  face.setFillColor(Color(230, 165, 125)) // ????? ???
  face.setPenColor(noColor)
  draw(face)
}

// ?. ???? ??? ???? ???? ????? (Eyes & Eyebrows)
def drawEyesAndBrows(): Unit = {
  // ????? (Eyebrows)
  val leftBrow = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-45, 12)
    p.vertex(-12, 18)
    p.vertex(-10, 10)
    p.vertex(-42, 6)
    p.endShape()
  }
  leftBrow.setFillColor(Color(20, 20, 20))
  leftBrow.setPenColor(noColor)
  draw(leftBrow)

  val rightBrow = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(12, 18)
    p.vertex(45, 12)
    p.vertex(42, 6)
    p.vertex(10, 10)
    p.endShape()
  }
  rightBrow.setFillColor(Color(20, 20, 20))
  rightBrow.setPenColor(noColor)
  draw(rightBrow)

  // ???? (Eyes)
  val leftEye = Picture.ellipse(10, 5)
  leftEye.setFillColor(Color(20, 20, 20))
  leftEye.setPosition(-32, -2)
  draw(leftEye)

  val rightEye = Picture.ellipse(10, 5)
  rightEye.setFillColor(Color(20, 20, 20))
  rightEye.setPosition(22, -2)
  draw(rightEye)
}

// ?. ??? ??? ??????? ???????? ???? (Nose & Signature Beard)
def drawNoseAndBeard(): Unit = {
  // ??? (Nose Bridge)
  val nose = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-4, 10)
    p.vertex(4, 10)
    p.vertex(8, -25)
    p.vertex(-8, -25)
    p.endShape()
  }
  nose.setFillColor(Color(210, 145, 105))
  nose.setPenColor(noColor)
  draw(nose)

  // ???? ??? ???? (Beard Contour)
  val beard = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-48, -20)
    p.vertex(-20, -35) // ???? ???????
    p.vertex(0, -40)   // ???? ????
    p.vertex(20, -35)  // ???? ???????
    p.vertex(48, -20)
    p.vertex(42, -65)
    p.vertex(0, -92)   // ???? ??????
    p.vertex(-42, -65)
    p.endShape()
  }
  beard.setFillColor(Color(25, 20, 20)) // ??? ????/?????? ????
  beard.setPenColor(noColor)
  draw(beard)
}

// ?. ????? ??????? ??? (Hairstyle with Fade)
def drawHair(): Unit = {
  val hair = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-54, 15)
    p.vertex(-45, 55)  // ???? ???
    p.vertex(0, 68)    // ???????? ??????/?????????
    p.vertex(45, 55)
    p.vertex(54, 15)
    p.vertex(48, 22)
    p.vertex(0, 26)
    p.vertex(-48, 22)
    p.endShape()
  }
  hair.setFillColor(Color(15, 15, 15)) // ???? ??
  hair.setPenColor(noColor)
  draw(hair)
}

// ?. ????? ??????? (Title Banner)
def drawText(): Unit = {
  val name = Picture.text("VIRAT KOHLI", 26)
  name.setPenColor(Color(10, 30, 80))
  name.setPosition(-80, 110)
  draw(name)

  val king = Picture.text("KING KOHLI VECTOR ART", 12)
  king.setPenColor(Color(255, 102, 0))
  king.setPosition(-75, 85)
  draw(king)
}

// ???????? ??? ????? ?????
drawJersey()
drawNeckAndEars()
drawFace()
drawEyesAndBrows()
drawNoseAndBeard()
drawHair()
drawText()