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

Cornu Animation Question

Posted by Jim Audette on Feb 08, 2008

I am new to both NodeBox and Python. I have been experimenting with cornu curves and animation. I want to change the points in the path each frame so that I can get a fluid looking shape in an animation. I started out with the following code which I had thought would draw a static circle. Instead on each call to the drawpath function the path is changed and the curve quickly enlarges and moves off the canvas. Is this the expected behavior? It seems that the drawpath is actually changing the points as part of its algorithm.

Thank you in advance. This is the most amazing software!

speed(5)
size(200,200)
cornu = ximport("cornu")
 
def setup():
    global mypath
    mypath = []
    mypath.append((.3,.1))
    mypath.append((.6,.3))
    mypath.append((.3,.6))
 
def draw():
    global mypath
    cornu.drawpath(mypath, close=True)


 
Posted by fdb on Feb 11, 2008

This seems to be a bug in the cornu library. To make your example work, I would suggest changing the last line to the following, which copies the list before passing it of to drawpath.

cornu.drawpath(list(mypath), close=True)
I'll see if I can implement a fix for the library.

Kind regards,

Frederik



Posted by Jim Audette on Feb 11, 2008

That does the trick for now.

Thank you,

Jim



Posted by fdb on Feb 11, 2008

I just released a new Cornu library that fixes the bug.

Kind regards,

Frederik