Hide
Meet people who work on similar things as you – get help if you need it Join Siafoo Now or Learn More

Nodebox Animation Tutorial, Fluid Curve Movement Atom Feed 0

In Brief A code sample yoinked from the Nodebox Animation Tutorial. While the output shown here is a static image, the code actually produces an animation of a fluidly-bouncing spirographic curve when run from within the Nodebox application/environment.... more
# 's
 1# Sinful Curves
2
3size(300,300)
4speed(100)
5
6def setup():
7
8 global frame
9 frame = 1
10
11def draw():
12
13 from math import sin, radians
14
15 global distort
16
17 global frame
18 frame += 1
19
20 fill(0,0.25,0.25)
21 rect(0,0,WIDTH,HEIGHT)
22
23 for i in range(30):
24
25 nofill()
26 stroke(0.5,1,0)
27 strokewidth(0.5)
28
29 rotate(12)
30
31 v = sin(radians(frame)) * i * 20
32 autoclosepath(False)
33 beginpath(150,150)
34 curveto(v, -v, v, v, 200, 200)
35 endpath()

A code sample yoinked from the Nodebox Animation Tutorial. While the output shown here is a static image, the code actually produces an animation of a fluidly-bouncing spirographic curve when run from within the Nodebox application/environment.

The sample introduces the canonical use of the "speed", "setup", and "draw" functions characteristic of Nodebox animations. It also uses the math module's "sin" function to generate smoothly-flowing cyclical motions.

http://www.siafoo.net/image/90