Ziye Liu's Blog
  • ( www.ziyeliu.com )
  • Home
  • Visual Effects Blog
    • Houdini >
      • Procedural Courtyard House
      • Procedural Music Animation
    • Maya - MEL >
      • MEL Rooftop Generator
      • MEL Circle of Spheres
    • Maya - Rendering >
      • Maya Render Premultiply Issue
      • Depth of Field and Bokeh
      • 3D Render - Match to a Real Object
      • RenderMan I
      • RenderMan II
    • Python >
      • Python Sampler Quilt
      • Motion Capture Data Parsing
      • Python and Turtle Graphics
  • Themes & Variations
    • The Film
    • Scene 1 - "Crazy Polka Dots"
    • Scene 2 - “Untitled”
    • Scene 3 - "Grapes"
    • Scene 4 - “Narcissus Garden”
  • 中文博客

Python and Turtle Graphics

Picture
Picture
####Pattern 4
step = 100
length = 100
angle = 120    
def drawSquare(length,turn):
    for i in range (0,step):
        for b in range (0,2):
            turtle.forward(length+i*2)
            turtle.right(angle+b)   
####Pattern 3
step = 100
length = 100
angle = 90    
def drawSquare(length,turn):
    for i in range (0,step):
        for b in range (0,2):
            turtle.forward(length+i*2)
            turtle.right(angle+b)

Picture
Picture
####Pattern 2
step = 100
length = 100
for x in range (0,2):
    angle = x*100
def drawSquare(length,turn):
    for i in range (0,step):
        for b in range (0,2):
            turtle.forward(length+i*2)
            turtle.right(angle+b)
####Pattern 1
step = 100
length = 100
angle = 90
def drawSquare(length,turn):
    for i in range (0,step):
        for b in range (0,4):
            turtle.forward(length+i)
            turtle.right(angle+b)

www.ziyeliu.com
Digital Art, Visual Effects, Photography
©Ziye Liu, 2011 - 2019, All Rights Reserved