1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Problem with the Cornucopia example

Posted by Gabra on May 25, 2008

Hi.
I was exploring the cornu library and tried to reproduce the
Cornucopia example: http://www.nodebox.net/code/index.php/Cornucopia

When I copied the code I noticed that when producing the output
the letters are just written over each other.
How do I change the code to something like the example picture.


 
Posted by Lucas on May 27, 2008

Hello Gabra,

try this:

size(500,500)
ximport("cornu")
translate(0,0)
font("American Typewriter", 100)
path = textpath("2008", 0, 0)
 
ptlist = []
 
d = 6.15
for i in range(3):
    for pt in path:
        if pt.cmd == LINETO or pt.cmd == CURVETO:
            ptlist.append((pt.x+random(-d, d), pt.y+random(-d, d)))
 
nofill()
stroke(0)
cp = cornu.path(ptlist)
cp.fit(0, 0, 500, 500)
 
cp.draw()
good luck



Posted by Gabra on May 29, 2008

Works great.
Thanks!