Code Sketch


thala funny
By: Mhalsakant School
Category: Programming
// --- Kojo Vector Portrait: MS Dhoni (Thala No. 7) ---
cleari()
setBackground(Color(245, 245, 250)) // ?????? ???? ??????????

// ?. ????? ??? ???? (Yellow CSK/India Yellow-Blue Tones)
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(0, 51, 153)) // ???? ???? ???????
  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(255, 204, 0)) // ????? ?????? ?????
  body.setPenColor(noColor)
  draw(body)
}

// ?. ??? ??? ??? (Neck & Ears)
def drawNeckAndEars(): Unit = {
  // ??? (Neck)
  val neck = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-36, -50)
    p.vertex(36, -50)
    p.vertex(42, -120)
    p.vertex(-42, -120)
    p.endShape()
  }
  neck.setFillColor(Color(190, 130, 90)) // ?????? ????? ???
  neck.setPenColor(noColor)
  draw(neck)

  // ??? (Left & Right Ears)
  val leftEar = Picture.ellipse(14, 22)
  leftEar.setFillColor(Color(220, 155, 115))
  leftEar.setPenColor(noColor)
  leftEar.setPosition(-58, -8)
  draw(leftEar)

  val rightEar = Picture.ellipse(14, 22)
  rightEar.setFillColor(Color(220, 155, 115))
  rightEar.setPenColor(noColor)
  rightEar.setPosition(44, -8)
  draw(rightEar)
}

// ?. ????????? ???? (Dhoni's Facial Structure)
def drawFace(): Unit = {
  val face = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-50, 20)  // ???? ???????
    p.vertex(50, 20)   // ???? ???????
    p.vertex(46, -20)  // ???
    p.vertex(32, -75)  // ?????? ???????
    p.vertex(0, -90)   // ?????? ????
    p.vertex(-32, -75) // ?????? ???????
    p.vertex(-46, -20)
    p.endShape()
  }
  face.setFillColor(Color(228, 160, 120)) // ????? ???
  face.setPenColor(noColor)
  draw(face)
}

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

  val rightBrow = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(12, 16)
    p.vertex(44, 14)
    p.vertex(42, 6)
    p.vertex(10, 8)
    p.endShape()
  }
  rightBrow.setFillColor(Color(30, 25, 20))
  rightBrow.setPenColor(noColor)
  draw(rightBrow)

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

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

// ?. ??? ??? ?????? ???????? ???? (Nose & Beard Style)
def drawNoseAndBeard(): Unit = {
  // ??? (Nose)
  val nose = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-4, 10)
    p.vertex(4, 10)
    p.vertex(7, -25)
    p.vertex(-7, -25)
    p.endShape()
  }
  nose.setFillColor(Color(205, 140, 100))
  nose.setPenColor(noColor)
  draw(nose)

  // ???? ??? ???? (Moustache & Salt-Pepper Stubble Beard)
  val beard = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-46, -20)
    p.vertex(-18, -35) // ???? ???????
    p.vertex(0, -38)   // ???? ????
    p.vertex(18, -35)  // ???? ???????
    p.vertex(46, -20)
    p.vertex(40, -65)
    p.vertex(0, -92)   // ???? ??????
    p.vertex(-40, -65)
    p.endShape()
  }
  beard.setFillColor(Color(45, 40, 38)) // ????? ??? ???? ?????? ???
  beard.setPenColor(noColor)
  draw(beard)
}

// ?. ?????? ?????????? (Hairstyle)
def drawHair(): Unit = {
  val hair = Picture.fromVertexShape { p =>
    p.beginShape()
    p.vertex(-54, 15)
    p.vertex(-48, 58)  // ???? ???
    p.vertex(0, 72)    // ??????? ???? ??
    p.vertex(48, 58)
    p.vertex(54, 15)
    p.vertex(46, 22)
    p.vertex(0, 26)
    p.vertex(-46, 22)
    p.endShape()
  }
  hair.setFillColor(Color(25, 20, 15)) // ???? ??
  hair.setPenColor(noColor)
  draw(hair)
}

// ?. ????? ??????? (Title Banner)
def drawText(): Unit = {
  val name = Picture.text("M.S. DHONI", 26)
  name.setPenColor(Color(0, 51, 153))
  name.setPosition(-75, 115)
  draw(name)

  val thala = Picture.text("THALA #7 VECTOR ART", 12)
  thala.setPenColor(Color(255, 153, 0))
  thala.setPosition(-70, 90)
  draw(thala)
}

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