{"id":13634929,"url":"https://github.com/JackHCC/Draw-Pikaqiu","last_synced_at":"2025-04-19T03:34:03.018Z","repository":{"id":112237171,"uuid":"173528580","full_name":"JackHCC/Draw-Pikaqiu","owner":"JackHCC","description":"利用turtle库绘画的眨眼睛的皮卡丘~(Blinking Pikachu using the turtle library painting~)","archived":false,"fork":false,"pushed_at":"2019-03-03T07:25:35.000Z","size":1220,"stargazers_count":15,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-09T05:33:46.304Z","etag":null,"topics":["mini-program","python","turtle"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JackHCC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-03T03:59:43.000Z","updated_at":"2023-03-02T01:45:35.000Z","dependencies_parsed_at":"2023-06-01T23:15:57.598Z","dependency_job_id":null,"html_url":"https://github.com/JackHCC/Draw-Pikaqiu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHCC%2FDraw-Pikaqiu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHCC%2FDraw-Pikaqiu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHCC%2FDraw-Pikaqiu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHCC%2FDraw-Pikaqiu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JackHCC","download_url":"https://codeload.github.com/JackHCC/Draw-Pikaqiu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249600500,"owners_count":21297705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mini-program","python","turtle"],"created_at":"2024-08-02T00:00:37.795Z","updated_at":"2025-04-19T03:34:02.733Z","avatar_url":"https://github.com/JackHCC.png","language":"Python","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Pikaqiu 用turtle绘画的皮卡丘\n\n1. 首先我们导入turtle库和time库（用来做动画使用）:\n```\nimport turtle as t\nimport time\n```\n2. 由于turtle没有画曲线的函数，因此我们自定义画曲线函数,函数有4个参数，ang偏转角度，dis移动步长，step步长增幅，n遍历次数，说白了就是将曲线转化为很多条短长的直线：\n```\n#画左偏曲线函数\ndef radian_left(ang,dis,step,n):\n    for i in range(n):\n        dis+=step #dis增大step\n        t.lt(ang) #向左转ang度\n        t.fd(dis) #向前走dis的步长\n        \ndef radian_right(ang,dis,step,n):\n    for i in range(n):\n        dis+=step\n        t.rt(ang) #向左转ang度\n        t.fd(dis) #向前走dis的步长\n```\n3. 定义画耳朵，眼睛，嘴，轮廓，脚画尾巴的函数，具体见python文件\n4. 初始化皮卡丘：\n```\n#初始化\ndef Init():\n    InitEars()\n    InitTail()\n    InitFoots()\n    InitBody()\n    InitFace()\n    InitHands()\n    InitEyes()\n```\n5. 定义Upgrade函数和Upgarde_init函数制作眨眼动画：\n```\n#眨眼睛\ndef Upgarde():\n    InitEars()\n    InitTail()\n    InitFoots()\n    InitBody()\n    InitFace()\n    InitHands()\n    CloseEyes()\n \ndef Upgarde_Init():\n    InitEars()\n    InitTail()\n    InitFoots()\n    InitBody()\n    InitFace()\n    InitHands()\n    InitEyes()\n ```\n 6. Main函数定义：\n ```\n def main():\n\n    Init()\n    \n    t.tracer(False)\n    \n    #眨眼睛动画\n    for i in range(30):\n        if i%2==0:\n            t.reset()\n            t.hideturtle()\n            Upgarde()\n            t.update()\n            time.sleep(0.3)\n        else:\n            t.reset()\n            t.hideturtle()\n            Upgarde_Init()\n            t.update()\n            time.sleep(1)        \n```\n# 展示\n![皮卡丘截图](/pikaqiu.png)\n\n视频动画可以打包下载该文件，点击pikaqiu.mp4观看\n[下载地址](https://github.com/JackHCC/Pikaqiu)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJackHCC%2FDraw-Pikaqiu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJackHCC%2FDraw-Pikaqiu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJackHCC%2FDraw-Pikaqiu/lists"}