[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-573365-105":53,"doc-detail-573365-en":126},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":119,"head_meta":121,"extra_data":123,"updated_unix":125},105,"en","py5-cheatsheet-complete-reference","py5 cheatsheet - Complete reference","","py5 cheatsheet提供对py5/Processing编程要点的快速对照式参考，涵盖程序结构（静态与动画的setup/draw流程）、函数与坐标空间基础、注释与输出打印、颜色与填充描边（含不同color模式）、常用2D图元（点线矩形椭圆圆弧等）、复合形状与Bézier顶点绘制、排版文本相关接口以及数学与随机数工具。还总结了控制流与条件/逻辑/循环用法，并列出常用常量与系统变量。",{"@graph":63,"@context":118},[64,80,101],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/py5-cheatsheet-complete-reference/573365/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/py5-cheatsheet-complete-reference/573365.png","ImageObject",442,249,{"name":88,"@type":89},"Oliver","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-17","2026-10-14",true,{"@type":98,"interactionType":99,"userInteractionCount":76},"InteractionCounter",{"@type":100},"ViewAction",{"@type":102,"mainEntity":103},"FAQPage",[104,110,114],{"name":105,"@type":106,"acceptedAnswer":107},"py5的静态草图与动画草图在结构上有什么区别？","Question",{"text":108,"@type":109},"静态草图通常只需要一次运行初始化代码。动画草图则包含setup只在开始时运行一次，以及draw在每一帧持续运行。","Answer",{"name":111,"@type":106,"acceptedAnswer":112},"如何在py5中绘制复杂形状并闭合轮廓？",{"text":113,"@type":109},"使用begin_shape()与end_shape()包裹顶点列表，在其中加入vertex等顶点；需要闭合时可在end_shape(CLOSE)中指明闭合。",{"name":115,"@type":106,"acceptedAnswer":116},"py5的条件判断与循环通常怎么写？",{"text":117,"@type":109},"条件使用if/elif/else并以冒号结尾；逻辑判断可组合and/or/not与关系运算符（如==、!=、>等）。循环常用for并配合range或遍历列表来逐项处理。","https://schema.org",{"og:url":78,"og:type":120,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":122,"canonical":78},"index,follow",{"doc_id":124,"site_id":56},573365,1792067868,{"code":4,"msg":5,"data":127},{"doc_id":124,"user_id":128,"nickname":88,"user_avatar":129,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":76,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":135,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":136,"faqs":137,"seo_title":138,"seo_description":61,"update_tm":139,"read_time":9},8796095461610,"https://ap-avatar.wpscdn.com/davatar_276721f389ce27ea32af1340a28f341c","py5  \ncheatsheet  \nComplete reference at [https://py5.ixora.io/reference](https://py5.ixora.io/reference)  \nProgram Structure  \nStructuring a static sketch:  \nsize(400 , 200)  \nrun this code once  \nStructuring an animated sketch:  \ndef setup() : size(400 , 200)  \nrun this code once at start def draw() :  \nrun this code every frame  \nFunction anatomy:  \nThe default coordinate space:  \n| |  |\n| --- | --- |\n| | |\n\n| Comments |  |\n| --- | --- |\n| \\# this is' ' ' | a single line comment |\n| this is a |  |\n| multiline' ' ' | comment |\n| Fills & Strokes\u003Cbr>background(color) \\# set bg color fill(color) \\# set fill colorno_fill() \\# disable the fill stroke(color) \\# set stroke color stroke_weight() \\# stroke width in px no_stroke() \\# disable the stroke\u003Cbr>A red ﬁll using three diﬀerent color values: |  |\n| \u003Cbr>fill( ' \\#FF0000 ' ) \\# hexadecimal fill(255 , 0 , 0 ) \\# red , green , blue \\# HSB (Hue Saturation brightness)\u003Cbr>color_mode(HSB , 360 , 100 , 100) fill(0 , 100 , 100) |  |\n| Print\u003Cbr>print(value) \\# prints to console |  |\n\n2D Primitives  \npoint(x , y )  \nline(x1 , y 1 , x2 , y2 ) rect(x , y , width , height) ellipse(x , y , width , height) circle(x , y , diameter) square(x , y , extent)  \narc (x , y , width , height , start , end)  \nFor measuring arc angles, use radians:  \nShapes  \nDraw complex shapes using vertices nested within beginShape () and endShape () functions:  \nbegin_shape()  \nvertex(x1 , y 1 )  \nvertex(x2 , y2 )  \n\\# add more vertices here end_shape(CLOSE)  \nFor curved shapes, use a Bézier-vertex function:  \nbegin_shape()  \nvertex(x1 , y 1 ) \\# vertex 1  \nbezier_vertex(  \nx1cp , y 1cp , \\# control point 1  \nx2cp , y2cp , \\# control point 2  \nx2 , y2 ) \\# vertex 2  \n\\# add more vertices or beziers here end_shape()  \nTypography text_font(create_font( font , size)) text_size( rendered_size)  \ntext ( 'text ' , x , y )  \n| Math\u003Cbr>Use arithmetic operators to add, subtract, etc:\u003Cbr>+ - * / %\u003Cbr>Use brackets to override operator precedence: |\n| --- |\n| \u003Cbr>( 1 + 2 ) * 3 \\# equals 9 , not 7 |\n| Random\u003Cbr>For unexpected values, use the random function: |\n| \u003Cbr>random( 10) \\# 0 .0 up to not inc . 10 random(5 , 10) \\# 5 .0 to not inc . 10 random_int(5 , 10) \\# integer value random_choice([5 , 10]) \\# choose one |\n| To set the seed value for the pseudo-random generator, use:\u003Cbr>random_seed( integer)\u003Cbr>Constants & System Variables For diﬀerent values of pi, use these constants:\u003Cbr>PI HALF_PI QUARTER_PI TAU\u003Cbr>Some useful Processing system variables:\u003Cbr>width , height \\# sketch width , height mouse_x , mouse_y \\# mouse x , y coords frame_count \\# current frame number |\n\nControl Flow  \nPython if-then logic:  \nif condition_a :  \nif condition_a is true , do this elif condition_b :  \nif condition_b is true , do this else :  \nif condition_a /b false , do this  \nRelational operators:  \n== != > \u003C >= \u003C=  \nLogical operators:  \nand or not  \nIteration using a for-loop:  \n\\# displays 0 , 1 , 2 in console for i in range(3 ) :  \nprint ( i )  \nLooping through a list:  \nnumbers = [3 , 4 , 5] \\# a list  \n\\# displays 3 , 4 , 5 in console for i in numbers :  \nprint ( i )  \nCheat sheet source ﬁles available at [github.com/tabreturn/processing.py-cheat-sheet](github.com/tabreturn/processing.py-cheat-sheet)","cbCaioAUM0HnhYiN","https://ap.wps.com/l/cbCaioAUM0HnhYiN","pdf",195704,"English","# Program Structure\n## Structuring a static sketch\n## Structuring an animated sketch\n# Function anatomy\n## Default coordinate space\n# Comments, Fills & Strokes, Print\n# 2D Primitives\n# Shapes\n## beginShape/endShape\n## Bézier vertex\n# Typography\n# Math\n# Random\n# Constants & System Variables\n# Control Flow\n## if/elif/else\n## Relational and logical operators\n## for loops","[{\"question\":\"py5的静态草图与动画草图在结构上有什么区别？\",\"answer\":\"静态草图通常只需要一次运行初始化代码。动画草图则包含setup只在开始时运行一次，以及draw在每一帧持续运行。\"},{\"question\":\"如何在py5中绘制复杂形状并闭合轮廓？\",\"answer\":\"使用begin_shape()与end_shape()包裹顶点列表，在其中加入vertex等顶点；需要闭合时可在end_shape(CLOSE)中指明闭合。\"},{\"question\":\"py5的条件判断与循环通常怎么写？\",\"answer\":\"条件使用if/elif/else并以冒号结尾；逻辑判断可组合and/or/not与关系运算符（如==、!=、\\u003e等）。循环常用for并配合range或遍历列表来逐项处理。\"}]","py5 cheatsheet - Complete reference | PDF",1791938244]