首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

附代码 | 用Python绘制2022卡塔尔世界杯吉祥物!

案例代码:

# -*- coding: UTF-8 -*-

from turtle import *

import time

def set_start(x, y, w=0.5, c='black'):  # 初始设置

  penup()

  setx(x)

  sety(y)

  setheading(towards(0, 0))

  width(w)

  pencolor(c)

  pendown()

  speed(10)

def left_rotate(time, angle, length):

  for __________________:

      left(angle)

      forward(length)

def right_rotate(time, angle, length):

  for i in range(time):

      right(angle)

      forward(length)

def fill_color_patch(x, y, c='white'):

  set_start(x, y, 1, c=c)

  forward(1)

def draw_circle(radius, color, color2=''):

  if color2 == '':

      color2 = color

  penup()

  setheading(towards(0, 0))

  right(90)

  pencolor(color)

  pendown()

  begin_fill()

  circle(radius)

  fillcolor(color2)

  end_fill()

def draw_body():

  # 绘制身体

  fill_color_patch(-114, 125)

  begin_fill()

  set_start(-114, 125, w=2, c='black')

  right_rotate(1, 20, 10)

  left_rotate(3, 6, 10)

  left_rotate(2, 5, 20)

  left_rotate(2, 6, 20)

  left_rotate(1, 9, 20)

  left_rotate(3, 0.5, 43)

  left_rotate(3, 7, 5)

  left_rotate(3, 4.5, 10)

  right_rotate(3, 10, 10)

  right_rotate(2, 14, 10)

  right_rotate(3, 35, 0.8)

  left_rotate(3, 10, 8)

  left_rotate(3, 2, 10)

  right_rotate(3, 2, 10)

  right_rotate(3, 6, 10)

  right_rotate(3, 5, 10)

  right_rotate(3, 4, 10)

  left_rotate(3, 1, 7)

  left_rotate(1, 95, 7)

  left_rotate(3, 3, 8)

  left_rotate(1, 30, 0)

  right_rotate(3, 21.3, 2.2)

  right_rotate(3, 8.5, 7)

  right_rotate(3, 8, 7)

  right_rotate(3, 20, 1)

  right_rotate(1, 15, 10)

  right_rotate(5, 7.7, 20)

  right_rotate(4, 2.5, 18)

  left_rotate(4, 4.5, 18)

  left_rotate(4, 6, 20)

  left_rotate(1, 10, 0)

  right_rotate(2, 5, 10)

  right_rotate(2, 12, 5)

  right_rotate(6, 5, 6)

  goto(-114, 125)

  fillcolor('#EFEFED')

  end_fill()

  fill_color_patch(-102.74, 79.16)

  begin_fill()

  right_rotate(1, 0, 8)

  left_rotate(3, 10, 8)

  left_rotate(1, 0, 5)

  right_rotate(3, 4, 7)

  right_rotate(3, 10, 5)

  right_rotate(3, 5, 7)

  right_rotate(3, 3, 10)

  left_rotate(3, 6, 6)

  left_rotate(3, 27, 4)

  left_rotate(3, 3, 10)

  right_rotate(3, 3, 10)

  right_rotate(3, 5, 8)

  right_rotate(3, 10, 4)

  right_rotate(3, 10, 6)

  right_rotate(2, 5, 5)

  left_rotate(3, 3, 5)

  left_rotate(3, 22, 5)

  left_rotate(2, 6, 5)

  right_rotate(3, 3.5, 10)

  goto(186.32, 2.93)

  setheading(347.36)

  right_rotate(2, 14, 10)

  right_rotate(3, 35, 0.8)

  left_rotate(3, 10, 8)

  left_rotate(3, 2, 10)

  right_rotate(3, 2, 10)

  right_rotate(3, 6, 10)

  right_rotate(3, 5, 10)

  right_rotate(3, 4, 10)

  left_rotate(3, 1, 7)

  right_rotate(1, 3, 7)

  left_rotate(2, 6.5, 6)

  left_rotate(3, 36, 2)

  left_rotate(2, 7, 6)

  left_rotate(2, 6, 8)

  goto(92.19, -171.88)

  setheading(336.36)

  right_rotate(3, 21.3, 2.2)

  right_rotate(3, 8.5, 7)

  right_rotate(3, 8, 7)

  right_rotate(3, 20, 1)

  right_rotate(1, 15, 10)

  right_rotate(5, 7.7, 20)

  right_rotate(4, 2.5, 18)

  left_rotate(4, 4.5, 18)

  left_rotate(4, 6, 20)

  left_rotate(1, 10, 0)

  right_rotate(2, 5, 10)

  goto(-102.74, 79.16)

  fillcolor('#EFEFED')

  end_fill()

  fill_color_patch(-81.69, 68.15)

  begin_fill()

  set_start(-81.69, 68.15, w=2, c='black')

  setheading(342.39)

  left_rotate(1, 10, 8)

  left_rotate(1, 0, 5)

  right_rotate(3, 4, 7)

  right_rotate(3, 10, 5)

  right_rotate(3, 5, 7)

  right_rotate(3, 3, 10)

  left_rotate(3, 6, 6)

  left_rotate(3, 27, 4)

  left_rotate(3, 3, 10)

  right_rotate(3, 3, 10)

  right_rotate(3, 5, 8)

  right_rotate(3, 10, 4)

  right_rotate(3, 10, 6)

  right_rotate(2, 5, 5)

  left_rotate(3, 3, 5)

  left_rotate(3, 22, 5)

  left_rotate(2, 6, 5)

  right_rotate(3, 3.5, 10)

  goto(186.32, 2.93)

  setheading(347.36)

  right_rotate(2, 14, 10)

  right_rotate(3, 35, 0.8)

  left_rotate(3, 10, 8)

  left_rotate(3, 2, 10)

  right_rotate(3, 2, 10)

  right_rotate(1, 6, 10)

  width(1)

  right_rotate(1, 128, 2)

  pencolor('#DAD6D3')

  right_rotate(1, 0, 8)

  left_rotate(3, 5.5, 20)

  left_rotate(3, 14, 20)

  left_rotate(3, 9, 20)

  right_rotate(3, 3, 7)

  right_rotate(3, 27, 3)

  left_rotate(5, 8, 20)

  goto(-81.69, 68.15)

  end_fill()

  set_start(-11, -12, w=1, c='black')

  right_rotate(1, 70, 5)

  width(2)

  left_rotate(1, 21, 5)

  left_rotate(3, 8.5, 5)

  right_rotate(3, 7.5, 16)

  right_rotate(4, 4.5, 16)

  set_start(42, -15, w=1, c='black')

  right_rotate(1, 157, 10)

  width(2)

  right_rotate(4, 7.5, 16)

  width(1)

  right_rotate(1, 5, 12)

  fill_color_patch(35, -24)

  begin_fill()

  right_rotate(1, 170, 20)

  right_rotate(1, 10, 20)

  right_rotate(2, 13, 20)

  right_rotate(1, 10, 20)

  left_rotate(1, 165, 20)

  left_rotate(1, 5, 20)

  left_rotate(2, 18, 10)

  left_rotate(2, 16, 20)

  goto(35, -24)

  end_fill()

  left_rotate(1, 178, 10)

  width(2)

  right_rotate(3, 6.5, 11)

  width(1)

  right_rotate(1, 5, 10)

  left_rotate(1, 152, 10)

  width(2)

  right_rotate(2, 7, 15)

  width(3)

  right_rotate(1, 7, 15)

  right_rotate(1, 11, 15)

  width(2)

  right_rotate(1, 11, 15)

  fill_color_patch(30, -48)

  begin_fill()

  left_rotate(1, 175, 20)

  right_rotate(4, 10, 20)

  left_rotate(1, 155, 15)

  left_rotate(2, 18, 20)

  left_rotate(2, 18, 20)

  goto(30, -48)

  end_fill()

def draw_head():

  # 绘制头的形状

  fill_color_patch(-16.6, 4.97)

  begin_fill()

  set_start(-16.6, 4.97, w=1.5, c='black')

  setheading(284.5)

  left_rotate(3, 6.5, 6)

  left_rotate(3, 27, 4)

  left_rotate(3, 3, 10)

  right_rotate(3, 3, 10)

  right_rotate(2, 5, 9)

  left_rotate(1, 130, 8)

  right_rotate(1, 40, 9)

  left_rotate(6, 12, 10)

  left_rotate(2, 12, 9)

  left_rotate(1, 50, 9)

  right_rotate(3, 7.5, 8)

  left_rotate(3, 15, 4)

  left_rotate(2, 5, 8)

  # print(pos())

  goto(-16.6, 4.97)

  fillcolor('#EFEFED')

  end_fill()

def draw_mouth():

  # 嘴

  fill_color_patch(-14, 22)

  begin_fill()

  set_start(-14, 22, w=2, c='#4B4542')

  right_rotate(1, 5, 8)

  right_rotate(4, 8, 5)

  left_rotate(1, 25, 3)

  left_rotate(2, 35, 1.5)

  left_rotate(2, 15, 3)

  left_rotate(1, 12, 6)

  left_rotate(3, 14, 4)

  left_rotate(3, 33, 2.2)

  right_rotate(2, 13, 5)

  right_rotate(2, 10, 4)

  goto(-14, 22)

  fillcolor('#712532')

  end_fill()

  fill_color_patch(-4, -4)

  begin_fill()

  set_start(-4, -4, w=1, c='#5A242A')

  left_rotate(1, 50, 4)

  right_rotate(5, 28, 1.2)

  left_rotate(3, 33, 0.5)

  right_rotate(1, 5, 3)

  right_rotate(5, 29.5, 1.2)

  right_rotate(4, 15, 3)

  goto(-4, -4)

  fillcolor('#A04B58')

  end_fill()

  fill_color_patch(-7.74, -4.69)

  begin_fill()

  setheading(265.47)

  left_rotate(1, 25, 3)

  left_rotate(2, 35, 1.5)

  left_rotate(2, 15, 3)

  left_rotate(1, 12, 5)

  left_rotate(1, 160, 3)

  right_rotate(1, 8, 3.2)

  width(2)

  right_rotate(1, 8, 3.2)

  width(1)

  right_rotate(3, 45, 1)

  left_rotate(4, 45, 1)

  goto(-7.74, -4.69)

  fillcolor('white')

  end_fill()

  fill_color_patch(-14, 22)

  begin_fill()

  right_rotate(1, 5, 8)

  left_rotate(2, 13, 4.5)

  left_rotate(1, 40, 6)

  left_rotate(2, 15, 4)

  goto(4.75, 12.03)

  setheading(183.47)

  right_rotate(2, 13, 5)

  right_rotate(2, 10, 4)

  goto(-14, 22)

  fillcolor('white')

  end_fill()

  set_start(6, 13, w=2, c='black')

  left_rotate(1, 93, 3)

  right_rotate(2, 10, 2.5)

  width(1)

  right_rotate(1, 6, 3)

def draw_eye():

  # 眼睛

  fill_color_patch(-12, 37)

  begin_fill()

  left_rotate(1, 130, 5)

  right_rotate(2, 5, 4.5)

  right_rotate(2, 65, 1.5)

  right_rotate(2, 12, 4.5)

  right_rotate(3, 10, 4)

  right_rotate(1, 125, 3.5)

  goto(-12, 37)

  fillcolor('white')

  end_fill()

  fill_color_patch(-12, 37)

  begin_fill()

  left_rotate(1, 130, 5)

  right_rotate(2, 5, 4.5)

  right_rotate(2, 65, 1.5)

  right_rotate(2, 12, 4.5)

  right_rotate(1, 170, 4.5)

  left_rotate(1, 10, 3)

  left_rotate(2, 66, 1.5)

  goto(-12, 37)

  fillcolor('black')

  end_fill()

  fill_color_patch(-3.54, 37.44)

  begin_fill()

  setheading(254)

  right_rotate(3, 10, 4)

  right_rotate(1, 125, 3.5)

  right_rotate(3, 16, 3)

  right_rotate(3, 32, 1.5)

  goto(-3.54, 37.44)

  fillcolor('black')

  end_fill()

  set_start(-6.8, 36.5, w=1)

  draw_circle(0.8, 'white')

  right_rotate(1, 160, 7)

  fill_color_patch(7, 31)

  begin_fill()

  set_start(7, 31, w=1, c='white')

  left_rotate(1, 135, 5)

  right_rotate(1, 13, 3)

  right_rotate(2, 18, 3)

  right_rotate(3, 12, 3)

  right_rotate(2, 19, 3)

  right_rotate(2, 23, 3)

  right_rotate(1, 30, 6)

  right_rotate(1, 50, 10)

  goto(7, 31)

  fillcolor('white')

  end_fill()

  fill_color_patch(7, 31)

  begin_fill()

  left_rotate(1, 135, 5)

  right_rotate(1, 13, 3)

  right_rotate(2, 18, 3)

  right_rotate(3, 12, 3)

  right_rotate(2, 19, 3)

  right_rotate(2, 23, 3)

  right_rotate(1, 30, 5)

  right_rotate(1, 70, 1.5)

  right_rotate(1, 108, 4)

  left_rotate(1, 35, 4)

  left_rotate(2, 25, 3)

  left_rotate(3, 16, 2.5)

  left_rotate(2, 14, 3)

  left_rotate(2, 12, 3)

  goto(7, 31)

  fillcolor('black')

  end_fill()

  fill_color_patch(7, 31)

  begin_fill()

  left_rotate(1, 155, 0)

  right_rotate(3, 30, 3.1)

  right_rotate(3, 30, 3.6)

  right_rotate(3, 30, 3.1)

  right_rotate(3, 30, 3.6)

  goto(7, 31)

  end_fill()

  fill_color_patch(8, 31)

  begin_fill()

  set_start(8, 31, w=1, c='#4B4542')

  left_rotate(1, 140, 0)

  right_rotate(3, 30, 2.5)

  right_rotate(3, 30, 2.9)

  right_rotate(3, 30, 2.5)

  right_rotate(3, 30, 2.9)

  goto(8, 31)

  fillcolor('black')

  end_fill()

  set_start(13, 25, w=1)

  draw_circle(1, 'white')

  set_start(9, 20, w=2, c='#4B4542')

  left_rotate(1, 92, 13)

  # 眉毛

  fill_color_patch(-2, 63)

  begin_fill()

  left_rotate(1, 40, 3)

  right_rotate(2, 9, 3)

  right_rotate(2, 17, 1)

  right_rotate(2, 5, 3)

  right_rotate(1, 165, 4)

  left_rotate(2, 12, 2)

  left_rotate(2, 35, 1)

  left_rotate(1, 20, 2)

  goto(-2, 63)

  fillcolor('black')

  end_fill()

  fill_color_patch(13, 45)

  begin_fill()

  set_start(13, 45, w=1, c='#4B4542')

  left_rotate(1, 92, 8)

  right_rotate(2, 15, 3)

  right_rotate(2, 11, 4)

  right_rotate(1, 5, 4)

  left_rotate(1, 5, 4)

  right_rotate(1, 168, 4)

  left_rotate(3, 4, 5)

  left_rotate(4, 5, 2.3)

  goto(13, 45)

  fillcolor('black')

  end_fill()

def draw_cap():

  # 帽子

  fill_color_patch(54.95, 18.19)

  begin_fill()

  set_start(54.95, 18.19, w=1, c='black')

  setheading(25)

  right_rotate(2, 5, 9)

  left_rotate(1, 130, 8)

  left_rotate(2, 4, 8)

  right_rotate(3, 4.5, 8)

  left_rotate(2, 4.5, 8)

  right_rotate(2, 10, 4)

  right_rotate(2, 15, 2.5)

  left_rotate(1, 92, 2.5)

  left_rotate(2, 5, 5)

  left_rotate(1, 95, 2.5)

  left_rotate(3, 8, 5)

  left_rotate(2, 3, 10)

  right_rotate(2, 2, 9)

  left_rotate(2, 2, 8)

  goto(54.95, 18.19)

  fillcolor('black')

  end_fill()

  width(3)

  right_rotate(1, 170, 4)

  left_rotate(1, 25, 4)

  width(2)

  left_rotate(1, 7, 4)

  width(1)

  left_rotate(1, 4, 5)

  fill_color_patch(68, 25)

  begin_fill()

  left_rotate(1, 5, 2)

  right_rotate(1, 155, 2)

  goto(68, 25)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(65, 26)

  begin_fill()

  set_start(65, 26, w=1, c='#626063')

  left_rotate(1, 5, 3)

  right_rotate(1, 145, 3)

  goto(65, 26)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(61, 28)

  begin_fill()

  set_start(61, 28, w=1, c='#626063')

  left_rotate(1, 10, 3)

  right_rotate(1, 140, 3)

  goto(61, 28)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(58, 30)

  begin_fill()

  set_start(58, 30, w=1, c='#626063')

  left_rotate(1, 10, 3)

  right_rotate(1, 90, 1)

  right_rotate(1, 60, 2)

  goto(58, 30)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(54, 33)

  begin_fill()

  set_start(54, 33, w=1, c='#626063')

  left_rotate(1, 10, 3)

  right_rotate(1, 90, 1)

  right_rotate(1, 60, 2)

  goto(54, 33)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(49.5, 35)

  begin_fill()

  set_start(49.5, 35, w=1, c='#626063')

  left_rotate(1, 10, 2.5)

  right_rotate(1, 90, 1)

  right_rotate(1, 60, 2)

  goto(49.5, 35)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(46, 37.5)

  begin_fill()

  left_rotate(1, 0, 3)

  right_rotate(1, 90, 1)

  right_rotate(1, 60, 2)

  goto(46, 37.5)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(42, 40)

  begin_fill()

  set_start(42, 40, w=1, c='#626063')

  left_rotate(1, 0, 3)

  right_rotate(1, 90, 1)

  right_rotate(1, 60, 2)

  goto(42, 40)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(39, 43)

  begin_fill()

  left_rotate(1, 0, 3)

  right_rotate(1, 90, 1)

  right_rotate(1, 60, 2)

  goto(39, 43)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(35.5, 45.5)

  begin_fill()

  left_rotate(1, 0, 3)

  right_rotate(1, 90, 1)

  right_rotate(1, 60, 2)

  goto(35.5, 45.5)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(32, 48)

  begin_fill()

  set_start(32, 48, w=1, c='#626063')

  left_rotate(1, 0, 2)

  right_rotate(1, 90, 1)

  right_rotate(1, 60, 2)

  goto(32, 48)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(28.5, 50)

  begin_fill()

  right_rotate(1, 20, 2)

  right_rotate(1, 150, 2)

  goto(28.5, 50)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(25.5, 52)

  begin_fill()

  set_start(25.5, 52, w=1, c='#626063')

  right_rotate(1, 20, 2.5)

  right_rotate(1, 145, 2.5)

  goto(25.5, 52)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(22.5, 54)

  begin_fill()

  right_rotate(1, 20, 2.5)

  right_rotate(1, 145, 2.5)

  goto(22.5, 54)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(20, 55)

  begin_fill()

  set_start(20, 55, w=1, c='#626063')

  right_rotate(1, 30, 2)

  right_rotate(1, 145, 2)

  goto(20, 55)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(18, 57)

  begin_fill()

  right_rotate(1, 35, 2)

  right_rotate(1, 145, 2)

  goto(18, 57)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(16, 59)

  begin_fill()

  set_start(16, 59, w=1, c='#626063')

  right_rotate(1, 40, 2)

  right_rotate(1, 140, 2)

  goto(16, 59)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(14, 62)

  begin_fill()

  right_rotate(1, 45, 2)

  right_rotate(1, 140, 2)

  goto(14, 62)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(12, 65)

  begin_fill()

  right_rotate(1, 50, 2)

  right_rotate(1, 145, 2)

  goto(12, 65)

  fillcolor('#626063')

  end_fill()

  fill_color_patch(5.5, 63)

  begin_fill()

  right_rotate(1, 80, 2)

  right_rotate(1, 150, 2)

  goto(5.5, 63)

  fillcolor('#626063')

  end_fill()

  draw_circle(0.8, '#626063')

  draw_circle(0.6, '#626063')

  set_start(12, 56, w=1, c='#626063')

  draw_circle(0.5, '#626063')

  set_start(14, 54, w=1, c='#626063')

  draw_circle(0.4, '#626063')

  draw_circle(0.4, '#626063')

  set_start(19.5, 50, w=1, c='#626063')

  draw_circle(0.4, '#626063')

  set_start(22.5, 48, w=1, c='#626063')

  draw_circle(0.5, '#626063')

  draw_circle(0.6, '#626063')

  set_start(29, 43, w=1, c='#626063')

  draw_circle(0.7, '#626063')

  draw_circle(0.8, '#626063')

  draw_circle(0.9, '#626063')

  draw_circle(0.9, '#626063')

  draw_circle(0.9, '#626063')

  draw_circle(0.9, '#626063')

  set_start(52, 27, w=1, c='#626063')

  draw_circle(0.8, '#626063')

  draw_circle(0.7, '#626063')

  draw_circle(0.6, '#626063')

def draw_hair():

  # 头发

  right_rotate(1, 152, 10)

  left_rotate(2, 7, 5)

  left_rotate(2, 3, 10)

  right_rotate(1, 3, 10)

  right_rotate(2, 12, 5)

  right_rotate(5, 15, 4)

  begin_fill()

  width(1)

  right_rotate(1, 110, 1)

  left_rotate(3, 31, 1)

  left_rotate(3, 3, 2)

  right_rotate(1, 70, 2)

  left_rotate(2, 20, 1)

  right_rotate(2, 10, 5)

  right_rotate(2, 15, 5)

  left_rotate(1, 142, 5)

  left_rotate(1, 13, 5)

  left_rotate(4, 20, 5)

  left_rotate(3, 15, 5)

  goto(168.01, 42.05)

  fillcolor('black')

  end_fill()

  right_rotate(1, 152, 10)

  left_rotate(2, 12, 5)

  left_rotate(2, 9, 10)

  right_rotate(2, 2, 9)

  right_rotate(2, 16, 5)

  right_rotate(5, 14, 5)

  right_rotate(2, 8, 4)

  begin_fill()

  width(1)

  right_rotate(1, 90, 1)

  left_rotate(3, 27, 1)

  left_rotate(3, 3, 1.5)

  right_rotate(1, 60, 2)

  left_rotate(3, 22, 1)

  right_rotate(2, 12, 4)

  right_rotate(2, 12, 5)

  left_rotate(1, 142, 5)

  left_rotate(2, 13, 5.5)

  left_rotate(1, 30, 4)

  left_rotate(2, 12, 3)

  left_rotate(1, 30, 2)

  right_rotate(1, 30, 5)

  left_rotate(1, 15, 5)

  goto(168.43, 58.69)

  fillcolor('black')

  end_fill()

  set_start(105, 10, w=2, c='#550313')

  right_rotate(1, 152, 10)

  left_rotate(2, 10, 5)

  left_rotate(2, 4, 10)

  left_rotate(2, 4, 10)

  right_rotate(2, 3, 10)

  right_rotate(2, 16, 5)

  right_rotate(4, 14, 4)

  begin_fill()

  width(1)

  right_rotate(1, 30, 1)

  left_rotate(1, 30, 1)

  left_rotate(2, 12, 5)

  left_rotate(2, 15, 4)

  left_rotate(2, 20, 5)

  left_rotate(2, 22, 6)

  left_rotate(1, 155, 3)

  right_rotate(3, 16, 5)

  right_rotate(3, 12, 5)

  goto(169.28, 82.08)

  fillcolor('black')

  end_fill()

  right_rotate(1, 148, 10)

  left_rotate(2, 10, 5)

  left_rotate(2, 8, 10)

  left_rotate(1, 4, 10)

  right_rotate(2, 12, 8)

  right_rotate(2, 16, 5)

  right_rotate(4, 12, 5)

  right_rotate(2, 10, 4)

  begin_fill()

  width(1)

  right_rotate(1, 30, 2)

  left_rotate(1, 30, 1)

  left_rotate(2, 10, 4)

  right_rotate(2, 8, 4)

  left_rotate(2, 20, 4)

  left_rotate(2, 16, 5)

  right_rotate(1, 40, 2)

  right_rotate(1, 180, 2)

  right_rotate(1, 140, 0)

  left_rotate(1, 120, 3)

  left_rotate(3, 5, 5)

  left_rotate(2, 3, 5)

  goto(162.15, 74.34)

  fillcolor('black')

  end_fill()

def draw_football():

  # 足球

  # draw_circle(39, 'black', '#DCDCDC')

  fill_color_patch(39.34, -90.63)

  begin_fill()

  set_start(39.34, -90.63, w=2, c='black')

  setheading(124.2)

  left_rotate(20, 18, 12.2)

  goto(39.34, -90.63)

  fillcolor('#DCDCDC')

  end_fill()

  fill_color_patch(-25, -110)

  begin_fill()

  set_start(-25, -110, w=1, c='white')

  right_rotate(1, 160, 10)

  left_rotate(5, 20, 12)

  left_rotate(4, 18, 12)

  pencolor('black')

  left_rotate(1, 35, 12)

  left_rotate(7, 18, 12.1)

  goto(-25, -110)

  fillcolor('white')

  end_fill()

  fill_color_patch(-25, -108)

  begin_fill()

  set_start(-25, -108, w=1, c='black')

  right_rotate(1, 20, 4)

  right_rotate(2, 10, 3)

  left_rotate(1, 35, 5)

  left_rotate(1, 165, 5)

  right_rotate(2, 15, 3)

  goto(-25, -108)

  fillcolor('black')

  end_fill()

  fill_color_patch(-16, -101)

  begin_fill()

  set_start(-16, -101, w=1, c='black')

  right_rotate(1, 35, 8)

  right_rotate(1, 140, 4)

  left_rotate(2, 21, 2)

  left_rotate(2, 8, 4.5)

  right_rotate(1, 105, 8)

  right_rotate(1, 120, 3)

  left_rotate(3, 15, 4)

  goto(-16, -101)

  fillcolor('black')

  end_fill()

  fill_color_patch(-10, -93)

  begin_fill()

  set_start(-10, -93, w=1, c='black')

  left_rotate(1, 90, 4)

  right_rotate(1, 135, 5)

  right_rotate(2, 3, 7)

  right_rotate(1, 60, 3)

  right_rotate(1, 135, 5)

  left_rotate(3, 10, 4)

  goto(-10, -93)

  fillcolor('black')

  end_fill()

  fill_color_patch(6, -82)

  begin_fill()

  set_start(6, -82, w=1, c='black')

  right_rotate(1, 50, 4)

  right_rotate(1, 60, 6)

  right_rotate(2, 3, 7)

  right_rotate(1, 130, 4)

  right_rotate(1, 60, 5)

  left_rotate(3, 8, 4)

  goto(6, -82)

  fillcolor('black')

  end_fill()

  fill_color_patch(30, -88)

  begin_fill()

  set_start(30, -88, w=1, c='black')

  right_rotate(1, 130, 5)

  right_rotate(1, 15, 5)

  right_rotate(1, 150, 5)

  goto(30, -88)

  fillcolor('black')

  end_fill()

  fill_color_patch(25, -89)

  begin_fill()

  set_start(25, -89, w=1, c='black')

  right_rotate(1, 140, 8)

  right_rotate(1, 95, 4)

  left_rotate(2, 25, 6)

  right_rotate(1, 130, 8)

  right_rotate(1, 110, 3)

  left_rotate(3, 20, 4)

  goto(25, -89)

  fillcolor('black')

  end_fill()

  fill_color_patch(20, -106)

  begin_fill()

  right_rotate(1, 180, 8)

  right_rotate(1, 120, 4)

  left_rotate(3, 18, 5.8)

  right_rotate(1, 120, 8)

  right_rotate(1, 110, 3)

  left_rotate(3, 14, 5)

  goto(20, -106)

  fillcolor('black')

  end_fill()

  fill_color_patch(-8, -117)

  begin_fill()

  right_rotate(1, 100, 8)

  right_rotate(1, 115, 4)

  left_rotate(2, 16, 5)

  left_rotate(1, 22, 6)

  right_rotate(1, 125, 8)

  right_rotate(1, 120, 3)

  left_rotate(1, 25, 4)

  left_rotate(3, 15, 4)

  goto(-8, -117)

  fillcolor('black')

  end_fill()

  fill_color_patch(-12, -137)

  begin_fill()

  set_start(-12, -137, w=1, c='black')

  right_rotate(1, 145, 8)

  right_rotate(1, 148, 4)

  left_rotate(2, 18, 3.2)

  right_rotate(1, 55, 7)

  right_rotate(1, 165, 3)

  left_rotate(3, 20, 3)

  goto(-12, -137)

  fillcolor('black')

  end_fill()

  fill_color_patch(-6, -144)

  begin_fill()

  right_rotate(1, 35, 6)

  right_rotate(1, 105, 4)

  left_rotate(3, 16, 5.5)

  right_rotate(1, 130, 5)

  right_rotate(1, 78, 3)

  left_rotate(3, 5, 4)

  goto(-6, -144)

  fillcolor('black')

  end_fill()

  fill_color_patch(23, -115)

  begin_fill()

  set_start(23, -115, w=1, c='black')

  right_rotate(1, 60, 8)

  right_rotate(1, 120, 4)

  left_rotate(3, 12, 5.3)

  right_rotate(1, 100, 8)

  right_rotate(1, 130, 3)

  left_rotate(3, 15, 5)

  goto(23, -115)

  fillcolor('black')

  end_fill()

  fill_color_patch(32, -133)

  begin_fill()

  right_rotate(1, 140, 6)

  right_rotate(1, 110, 4)

  left_rotate(3, 8, 5)

  right_rotate(1, 80, 7)

  right_rotate(1, 140, 3)

  left_rotate(3, 14, 6)

  goto(32, -133)

  fillcolor('black')

  end_fill()

  fill_color_patch(39, -135)

  begin_fill()

  set_start(39, -135, w=1, c='black')

  right_rotate(1, 30, 7)

  right_rotate(1, 80, 3)

  left_rotate(3, 20, 2.2)

  right_rotate(1, 160, 5)

  right_rotate(1, 60, 3)

  left_rotate(2, 15, 3)

  goto(39, -135)

  fillcolor('black')

  end_fill()

  fill_color_patch(14, -153)

  begin_fill()

  right_rotate(1, 90, 7)

  right_rotate(1, 130, 3.5)

  right_rotate(1, 60, 3)

  goto(14, -153)

  fillcolor('black')

  end_fill()

def draw_clothes():

  # 衣服图案

  fill_color_patch(79, -197)

  begin_fill()

  right_rotate(1, 30, 2)

  right_rotate(3, 25, 1.5)

  left_rotate(3, 55, 1)

  left_rotate(3, 35, 2.5)

  goto(79, -197)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(78, -198)

  begin_fill()

  set_start(78, -198, w=1, c='#661E34')

  left_rotate(1, 25, 2)

  left_rotate(3, 25, 1.5)

  right_rotate(3, 55, 1)

  right_rotate(3, 35, 2.5)

  goto(78, -198)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(77, -193)

  begin_fill()

  right_rotate(1, 30, 2)

  right_rotate(3, 25, 1.5)

  left_rotate(3, 55, 1)

  left_rotate(3, 35, 2.5)

  goto(77, -193)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(77, -193)

  begin_fill()

  left_rotate(1, 30, 2)

  left_rotate(3, 25, 1.5)

  right_rotate(3, 55, 1)

  right_rotate(3, 35, 2.5)

  goto(77, -193)

  fillcolor('#661E34')

  end_fill()

  left_rotate(1, 2, 10)

  left_rotate(2, 5, 6)

  fill_color_patch(78, -183)

  begin_fill()

  set_start(78, -183, w=1, c='#661E34')

  right_rotate(1, 90, 2)

  right_rotate(3, 10, 1.8)

  left_rotate(3, 55, 1)

  left_rotate(3, 25, 2)

  goto(78, -183)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(70, -188)

  begin_fill()

  left_rotate(1, 100, 2)

  left_rotate(3, 10, 1.8)

  right_rotate(3, 55, 1)

  right_rotate(3, 25, 2)

  goto(70, -188)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(75, -183)

  begin_fill()

  right_rotate(1, 30, 2)

  left_rotate(3, 10, 1.8)

  left_rotate(3, 50, 1)

  left_rotate(3, 20, 2)

  goto(75, -183)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(71, -185)

  begin_fill()

  left_rotate(1, 50, 2)

  right_rotate(3, 13, 1.8)

  right_rotate(3, 50, 1)

  right_rotate(3, 20, 2)

  goto(71, -185)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(80, -175)

  begin_fill()

  right_rotate(1, 30, 2)

  right_rotate(3, 15, 1.8)

  left_rotate(1, 110, 1)

  left_rotate(1, 50, 1)

  left_rotate(3, 22, 2)

  goto(80, -175)

  fillcolor('#661E34')

  end_fill()

  set_start(80, -178, w=1, c='#661E34')

  left_rotate(1, 30, 2)

  right_rotate(3, 15, 1.8)

  right_rotate(3, 15, 1.8)

  fill_color_patch(61, -185)

  begin_fill()

  set_start(61, -185, w=1, c='#661E34')

  left_rotate(1, 55, 3)

  left_rotate(3, 20, 3)

  right_rotate(3, 53, 1)

  right_rotate(3, 20, 3)

  goto(61, -185)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(51.10, -181.18)

  set_start(63, -186, w=1, c='#661E34')

  right_rotate(1, 10, 2)

  left_rotate(8, 15, 1.8)

  begin_fill()

  right_rotate(3, 15, 1.8)

  right_rotate(3, 32, 1)

  right_rotate(1, 10, 5)

  right_rotate(3, 30, 3)

  right_rotate(2, 30, 2)

  right_rotate(1, 100, 4)

  right_rotate(1, 80, 1)

  left_rotate(5, 45, 2)

  goto(51.10, -181.18)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(67, -175)

  begin_fill()

  set_start(67, -175, w=1, c='#661E34')

  left_rotate(1, 40, 2)

  right_rotate(3, 15, 1.8)

  right_rotate(1, 10, 2)

  right_rotate(1, 130, 2)

  right_rotate(1, 8, 2)

  right_rotate(3, 15, 1.8)

  goto(67, -175)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(65, -177)

  begin_fill()

  set_start(65, -177, w=1, c='#661E34')

  left_rotate(1, 60, 2)

  right_rotate(3, 23, 1.8)

  left_rotate(1, 10, 2)

  left_rotate(3, 35, 2)

  right_rotate(1, 120, 2)

  right_rotate(3, 35, 2)

  right_rotate(2, 32, 2)

  right_rotate(1, 12, 2)

  left_rotate(3, 12, 1.8)

  goto(65, -177)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(70, -174)

  begin_fill()

  right_rotate(1, 40, 2)

  left_rotate(3, 23, 1.8)

  right_rotate(1, 10, 3)

  right_rotate(1, 35, 2)

  left_rotate(1, 90, 2)

  left_rotate(1, 70, 1.5)

  left_rotate(2, 30, 2)

  left_rotate(1, 10, 2)

  right_rotate(3, 12, 1.8)

  goto(70, -174)

  fillcolor('#661E34')

  end_fill()

  set_start(56, -163, w=1, c='#661E34')

  left_rotate(1, 80, 2)

  right_rotate(1, 30, 2)

  right_rotate(3, 18, 2)

  left_rotate(3, 45, 2)

  width(2)

  left_rotate(4, 32, 2)

  fill_color_patch(57, -160)

  begin_fill()

  left_rotate(1, 80, 2)

  right_rotate(1, 50, 2)

  right_rotate(3, 15, 1.8)

  right_rotate(1, 10, 2)

  right_rotate(1, 110, 2)

  right_rotate(1, 10, 2)

  right_rotate(2, 15, 1.8)

  goto(57, -160)

  fillcolor('#661E34')

  end_fill()

  left_rotate(1, 30, 2)

  right_rotate(3, 10, 2)

  set_start(57, -154, w=1, c='#661E34')

  left_rotate(1, 10, 2)

  right_rotate(2, 10, 2)

  set_start(46, -155, w=1, c='#661E34')

  fill_color_patch(52, -148)

  begin_fill()

  set_start(52, -148, w=1, c='#661E34')

  left_rotate(1, 100, 2)

  right_rotate(3, 50, 1.5)

  left_rotate(1, 20, 5)

  right_rotate(1, 100, 1)

  right_rotate(1, 60, 4)

  left_rotate(1, 90, 2)

  right_rotate(1, 120, 2)

  goto(52, -148)

  fillcolor('#661E34')

  end_fill()

  set_start(75.77, -145.63, w=2, c='black')

  setheading(202.36)

  right_rotate(1, 3, 7)

  left_rotate(2, 6.5, 6)

  left_rotate(3, 36, 2)

  left_rotate(2, 7, 6)

  left_rotate(2, 6, 8)

  # 小足球

  draw_circle(10, '#661E34', '#DAD6D3')

  right_rotate(1, 3, 5)

  right_rotate(1, 55, 4)

  right_rotate(1, 65, 5)

  left_rotate(1, 90, 1.5)

  left_rotate(1, 90, 6)

  right_rotate(1, 50, 4)

  right_rotate(1, 55, 4)

  left_rotate(1, 90, 2)

  left_rotate(1, 90, 5)

  right_rotate(1, 40, 4)

  right_rotate(1, 50, 5)

  left_rotate(1, 90, 1.5)

  left_rotate(1, 90, 5)

  right_rotate(1, 60, 5)

  right_rotate(1, 60, 5)

  left_rotate(1, 90, 1.5)

  left_rotate(1, 90, 6)

  right_rotate(1, 50, 5)

  right_rotate(1, 60, 5)

  fill_color_patch(149, -32)

  begin_fill()

  set_start(149, -32, w=1, c='#661E34')

  left_rotate(1, 80, 4)

  right_rotate(3, 90, 4)

  fillcolor('#661E34')

  end_fill()

  fill_color_patch(183, -13)

  begin_fill()

  left_rotate(1, 80, 4)

  right_rotate(3, 90, 4)

  fillcolor('#661E34')

  end_fill()

  # 字母

  set_start(101, -125, w=2, c='#661E34')

  right_rotate(1, 50, 3)

  left_rotate(3, 30, 2)

  left_rotate(3, 30, 1)

  left_rotate(3, 27, 2.5)

  right_rotate(3, 5, 2.5)

  left_rotate(1, 70, 1.5)

  left_rotate(3, 35, 2)

  left_rotate(3, 40, 1)

  left_rotate(1, 10, 2)

  left_rotate(1, 175, 6)

  set_start(109, -118, w=2, c='#661E34')

  right_rotate(1, 100, 6)

  left_rotate(1, 165, 6)

  left_rotate(3, 30, 2)

  left_rotate(2, 3, 3)

  left_rotate(1, 70, 2)

  left_rotate(3, 35, 1.5)

  left_rotate(3, 38, 1.5)

  left_rotate(1, 50, 2)

  left_rotate(1, 170, 6)

  set_start(123, -110, w=2, c='#661E34')

  left_rotate(1, 170, 7)

  left_rotate(1, 170, 3)

  right_rotate(2, 30, 2.5)

  # 2022

  right_rotate(1, 90, 2)

  right_rotate(3, 45, 2)

  right_rotate(2, 12, 2)

  right_rotate(1, 0, 2)

  left_rotate(1, 152, 6)

  right_rotate(1, 90, 2)

  right_rotate(3, 42, 2)

  right_rotate(2, 12, 2)

  right_rotate(3, 45, 2)

  right_rotate(2, 12, 2)

  goto(132, -102)

  set_start(137, -98, w=2, c='#661E34')

  right_rotate(1, 70, 2)

  right_rotate(3, 52, 2)

  right_rotate(2, 15, 2)

  right_rotate(1, 0, 2)

  left_rotate(1, 155, 6)

  set_start(142, -94, w=2, c='#661E34')

  right_rotate(1, 70, 2)

  right_rotate(3, 54, 2)

  right_rotate(2, 8, 2)

  right_rotate(1, 0, 2)

  left_rotate(1, 150, 7)

if _______________________:

  title('2022世界杯吉祥物Laeeb')

  wide = 600

  height = 500

  screensize(wide, height)

  setup(wide + 30, height + 30, 100, 50)

  shape(name='turtle')

  time.sleep(2)

  draw_body()

  draw_head()

  draw_mouth()

  draw_eye()

  draw_cap()

  draw_hair()

  draw_football()

  draw_clothes()

  set_start(1000, 1000, 1)

  done()

  • 发表于:
  • 原文链接https://page.om.qq.com/page/O6Yc58lb9CVeXz16dx-WH4JA0
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券