mu chance or much chance ?

日々の戯れ言

ProcessingのPythonモード 勉強4

以下の本を読みながら,
ProcessingのPythonモードを勉強しています.
第3章後半です.

  • list3_5.pyde
angle = 0.0
    
def setup():
    size(800, 600)
    frameRate(60)
    fill(0, 127, 255)
    noStroke()

def draw():
    global angle
    background(0)
    rotate(angle)
    rectMode(CENTER)
    rect(400, 300, 300, 300)
    angle += 0.1
  • list3_6.pyde
angle = 0.0
    
def setup():
    size(800, 600)
    frameRate(60)
    fill(0, 127, 255)
    noStroke()

def draw():
    global angle
    background(0)
    translate(width / 2, height / 2)
    rotate(angle)
    rectMode(CENTER)
    rect(0, 0, 300, 300)
    angle += 0.1
  • list3_7.pyde
angle = 0.0

def setup():
    size(800, 600)
    frameRate(60)
    fill(0, 127, 255)
    noStroke()
  
def draw():
    global angle
    background(0)
    
    translate(width / 4, height / 4)
    rotate(angle)
    rectMode(CENTER)
    rect(0, 0, 100, 100)
    
    translate(width / 2, height / 2)
    rotate(angle)
    rectMode(CENTER)
    rect(0, 0, 200, 200)
    
    angle += 0.1
  • list3_8.pyde
angle = 0.0

def setup():
    size(800, 600)
    frameRate(60)
    fill(0, 127, 255)
    noStroke()
  
def draw():
    global angle
    background(0)
    
    pushMatrix()
    translate(width / 4, height / 4)
    rotate(angle)
    rectMode(CENTER)
    rect(0, 0, 100, 100)
    popMatrix()
    
    pushMatrix()
    translate(width / 2, height / 2)
    rotate(angle)
    rectMode(CENTER)
    rect(0, 0, 200, 200)
    popMatrix()
    
    angle += 0.1