Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code for drawing Kakashi Hatake face #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions sketchpy/kakashi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import turtle as tu

class kakashi:
def __init__(self):
self.dot1 = [(276, 257), (274, 258), (273, 260), (274, 261), (276, 262), (278, 261), (279, 259), (278, 258)]
self.dot2 = [(274, 273), (272, 274), (272, 276), (274, 277), (276, 277), (277, 275), (277, 274)]
self.dot3 = [(276, 287), (274, 289), (275, 291), (278, 291),(279, 289), (278, 288),(275, 288)]
self.dot4 = [(378, 273), (381, 274), (380, 277), (377, 277), (376, 275), (377, 274), (380, 273), (381, 276)]
self.dot5 = [(375, 288), (377, 288), (379, 290), (378, 292), (376, 293), (375, 292), (374, 290), (379, 289)]
self.face = [(252, 297), (256, 318), (258, 333), (262, 349), (277, 351), (291, 349), (305, 344), (317, 337), (331, 329), (346, 336), (357, 344), (371, 350), (388, 354), (396, 352), (399, 337), (401, 321), (404, 311), (407, 294), (392, 300), (371, 304), (351, 306), (316, 307), (294, 305), (275, 303), (263, 300), (252, 297)]
self.Hair = [(248, 245), (242, 248), (234, 237), (229, 227), (224, 217), (222, 209), (236, 217), (233, 199), (233, 185), (235, 172), (242, 180), (249, 190), (258, 171), (270, 149), (285, 131), (285, 143), (286, 156), (299, 145), (316, 131), (337, 121), (361, 114), (348, 128), (336, 141), (329, 152), (346, 139), (371, 129), (395, 121), (416, 111), (427, 104), (423, 114), (415, 126), (406, 134), (429, 131), (449, 127), (471, 121), (490, 114), (483, 133), (472, 154), (462, 170), (450, 188), (442, 198), (462, 194), (478, 188), (492, 181), (478, 201), (464, 214), (451, 225), (439, 231), (452, 239), (463, 245), (478, 251), (462, 256), (445, 257), (432, 256), (424, 253), (427, 265), (429, 279), (429, 295), (419, 282), (410, 267), (400, 255), (388, 246), (391, 256), (391, 269), (390, 277), (381, 262), (370, 248), (350, 248), (328, 249), (308, 249), (283, 247), (265, 247), (249, 245)]
self.headband_inner = [(271, 252), (269, 259), (267, 268), (267, 276), (268, 285), (271, 293), (277, 296), (290, 299), (301, 301), (312, 302), (326, 302), (337, 302), (352, 301), (363, 300), (376, 298), (382, 294), (384, 287), (385, 277), (386, 270), (381, 262), (374, 252), (361, 253), (342, 254), (328, 254), (307, 253), (292, 253), (281, 253), (272, 252)]
self.headband_out = [(240, 292), (244, 293), (250, 296), (258, 299), (268, 302), (282, 304), (296, 305), (312, 308), (328, 308), (342, 308), (359, 305), (375, 303), (387, 300), (396, 297), (407, 292), (413, 286), (413, 281), (413, 276), (412, 272), (407, 262), (400, 256), (391, 248), (388, 246), (390, 254), (391, 264), (391, 271), (390, 279), (386, 269), (381, 262), (377, 255), (371, 247), (363, 247), (350, 248), (332, 248), (312, 248), (291, 247), (277, 247), (261, 246), (248, 245), (242, 248), (242, 255), (243, 261), (243, 269), (242, 275), (241, 281), (241, 288), (241, 292)]
self.hidden_leaf = [(327, 282), (326, 279), (327, 277), (330, 276), (333, 276), (336, 278), (337, 283), (335, 287), (331, 289), (327, 289), (324, 288), (321, 285), (319, 283), (318, 280), (313, 288), (324, 288), (321, 285), (318, 280), (318, 277), (319, 273), (322, 270), (325, 269), (329, 268), (333, 268), (338, 271), (341, 270), (344, 267), (345, 265), ]
self.inner_eye = [(366, 316),(368, 316),(367, 317)]
self.left_ear = [(251, 297), (242, 293), (241, 298), (240, 325), (247, 337), (255, 348), (259, 351), (261, 350), (259, 337), (256, 325), (254, 314), (251, 298), (252, 308), (248, 303), (246, 307), (245, 312), (246, 317)]
self.left_eye_ball_dot = [(297, 318)]
self.left_eye_ball = [(287, 315), (287, 318), (289, 321), (293, 323), (296, 323), (298, 322), (300, 320), (301, 318), (301, 316), (294, 315), (287, 315)]
self.left_eye = [(275, 317), (279, 315), (286, 315), (294, 315), (303, 316), (311, 318), (308, 318), (311, 321), (305, 324), (299, 326), (292, 326), (286, 325), (282, 324), (278, 321), (275, 317)]
self.left_eye_curve = [(317, 321), (319, 324), (316, 327), (312, 330)]
self.left_eyebrow = [(292, 305), (300, 306), (308, 307), (322, 318), (303, 311), (296, 310), (287, 310), (280, 311), (275, 313), (280, 310), (287, 308), (296, 308), (293, 305)]
self.left_hair = [(260, 299), (258, 306), (258, 313), (257, 319), (254, 319), (252, 322), (253, 325), (256, 328), (258, 332), (259, 337), (257, 341), (255, 339), (252, 335)]
self.mask = [(262, 351), (268, 372), (282, 395), (296, 408), (315, 423), (345, 425), (374, 399), (391, 376), (396, 354), (397, 351), (385, 353), (370, 351), (354, 341), (342, 333), (332, 329), (322, 333), (311, 340), (300, 347), (286, 351), (272, 352), (262, 350)]
self.nose_shadow = [(339, 374), (335, 374), (332, 374), (328, 373), (331, 378), (337, 379), (338, 377)]
self.nose = [(338, 356), (340, 360), (342, 365), (344, 369), (342, 373), (338, 376)]
self.right_ear = [(406, 295), (410, 290), (415, 291), (417, 296), (418, 307), (419, 319), (415, 332), (410, 344), (405, 351), (402, 355), (398, 354), (397, 349), (398, 341), (401, 326), (403, 309), (406, 296), (405, 303), (409, 301), (411, 305), (412, 312), (412, 317)]
self.right_eye_ball = [(361, 316), (362, 319), (364, 321), (367, 323), (370, 322), (372, 320), (373, 317), (373, 315), (370, 315), (368, 315), (365, 315), (362, 315), (361, 317)]
self.right_eye_curve = [(345, 321), (342, 324), (346, 328), (349, 330)]
self.right_eye = [(350, 320), (353, 317), (356, 316), (349, 317), (360, 315), (378, 315), (384, 315), (382, 320), (378, 323), (373, 325), (369, 325), (369, 335), (369, 348), (369, 335), (369, 325), (364, 325), (360, 324), (354, 322), (351, 320)]
self.right_eyebrow = [(384, 312), (382, 310), (379, 309), (372, 309), (369, 309), (369, 304), (369, 315), (370, 309), (365, 309), (359, 310), (349, 312), (345, 314), (340, 317), (336, 318), (341, 315), (345, 312), (350, 309), (354, 306), (362, 306), (358, 308), (354, 310)]
self.right_hair = [(395, 299), (398, 306), (399, 314), (400, 322), (403, 316), (405, 319), (406, 322), (402, 327), (400, 330), (399, 334), (399, 340), (401, 342), (404, 340), (406, 337), (407, 333)]
self.sharingan_dot_1 = [(365, 318)]
self.sharingan_dot_2 = [(370, 318)]
self.pen = tu.Turtle()
self.pen.hideturtle()
self.pen.speed(0)
self.pen.pensize(2)
self.pen.color("black")
self.x_offset = 350
self.y_offset = 300

def go(self, x, y):
self.pen.penup()
self.pen.goto(x-self.x_offset,(y*-1)+self.y_offset)
self.pen.pendown()


def paint(self,coord,co=(0,0,0)):
self.pen.color(co)
t_x,t_y = coord[0]
self.go(t_x,t_y)
self.pen.fillcolor(co)
self.pen.begin_fill()
t = 0
for i in coord[1:]:
x,y = i
if t:
self.go(x,y)
t = 0
self.pen.begin_fill()
continue
if x == -1 and y == -1:
t = 1
self.pen.end_fill()
continue
else:
self.pen.goto(x-self.x_offset,(y*-1)+self.y_offset)
self.pen.end_fill()


def draw_fn(self,coord,mode = 1,co = (0,0,0),thickness = 1):
co = (co[0]/255,co[1]/255,co[2]/255)

self.pen.color(co)

if mode:
self.pen.width(thickness)
t_x,t_y = coord[0]
self.go(t_x,t_y)
t = 0
for i in coord[1:]:
x,y = i
if t:
self.go(x,y)
t = 0
continue
if x == -1 and y == -1:
t = 1
continue
else:
self.pen.goto(x-self.x_offset,(y*-1)+self.y_offset)
else:
self.paint(coord=coord,co = co)


def draw(self, retain=True):
self.draw_fn(self.mask)
self.draw_fn(self.face)
self.draw_fn(self.nose)
self.draw_fn(self.nose_shadow, co=(230,230,230), mode=0)
self.draw_fn(self.left_ear)
self.draw_fn(self.left_hair)
self.draw_fn(self.right_ear)
self.draw_fn(self.right_hair)
self.draw_fn(self.left_eye)
self.draw_fn(self.left_eye_curve)
self.draw_fn(self.left_eyebrow)
self.draw_fn(self.left_eye_ball, co = (0, 0, 0), mode=0)
self.draw_fn(self.left_eye_ball_dot, co = (255, 255, 255), mode=0)
self.draw_fn(self.right_eye)
self.draw_fn(self.right_eye_curve)
self.draw_fn(self.right_eyebrow)
self.draw_fn(self.right_eye_ball, co=(188,0,0), mode=0)
self.draw_fn(self.inner_eye, co=(0,0,0), mode=0)
self.draw_fn(self.sharingan_dot_1)
self.draw_fn(self.sharingan_dot_2)
self.draw_fn(self.headband_out)
self.draw_fn(self.headband_inner)
self.draw_fn(self.Hair)
self.draw_fn(self.dot1, co=(0, 0, 0), mode=0)
self.draw_fn(self.dot2, co=(0, 0, 0), mode=0)
self.draw_fn(self.dot3, co=(0, 0, 0), mode=0)
self.draw_fn(self.dot4, co=(0, 0, 0), mode=0)
self.draw_fn(self.dot5, co=(0, 0, 0), mode=0)
self.draw_fn(self.hidden_leaf)
if retain:
tu.done()