Thursday 29 November 2012

Another Generative Design Sketch in Processing.py

Here is another generative design sketch translated for processing.py.
   1 import generativedesign.Mesh as Mesh
   2 
   3 
   4 """
   5 part of the example files of the generativedesign library.
   6 Modified to run with processing.py
   7 """
   8 
   9 def setup():
  10     """
  11     Setup the drawing style
  12     """
  13     size(1000,1000,P3D) 
  14     # setup drawing style 
  15     background(255)
  16     noStroke()
  17     fill(0) 
  18     # setup lights
  19     lightSpecular(230, 230, 230) 
  20     directionalLight(200, 200, 200, 0.5, 0.5, -1) 
  21     specular(color(220)) 
  22     shininess(5.0) 
  23     # setup view
  24     translate(width*0.5, height*0.5)
  25     rotateX(-0.2) 
  26     rotateY(-0.5) 
  27     scale(100)  
  28     # setup Mesh, set colors and draw  
  29     myMesh = Mesh(this, Mesh.STEINBACHSCREW, 200, 200, -3.0, 3.0, -PI, PI)
  30     myMesh.setColorRange(200, 200, 50, 50, 40, 40, 100)
  31     myMesh.draw()
  32 
  33 
  34 def draw():
  35     """
  36     The processing draw loop
  37     """
  38     pass

No comments:

Post a Comment