# karmi/shoes_demonstration_apps

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Older
100644 33 lines (29 sloc) 1.119 kb
 f9c7b0f Added example Python script from NodeBox bundled examples karmi authored Jan 5, 2009 1 # See http://www.nodebox.net 2 3 size(600, 600) 4 # Use a grid to generate a bubble-like composition. 5 # This example shows that a grid doesn't have to be rigid at all. 6 # It's very easy to breake loose from the coordinates NodeBox 7 # passes you, as is shown here. The trick is to add or subtract 8 # something from the x and y values NodeBox passes on. Here, 9 # we also use random sizes. 10 11 # We use a little bit of math to define the fill colors. 12 # Sinus and cosinus are not standard functions of NodeBox. 13 # Instead, they are in Python's math library. The next 14 # line imports those functions. 15 from math import sin, cos 16 17 gridSize = 40 18 # Translate a bit to the right and a bit to the bottom to 19 # create a margin. 20 translate(100,100) 21 22 startval = random() 23 c = random() 24 for x, y in grid(10,10, gridSize, gridSize): 25 fill(sin(startval + y*x/100.0), cos(c), cos(c),random()) 26 s = random()*gridSize 27 oval(x, y,s, s) 28 fill(cos(startval + y*x/100.0), cos(c), cos(c),random()) 29 deltaX = (random()-0.5)*10 30 deltaY = (random()-0.5)*10 31 deltaS = (random()-0.5)*200 32 oval(x+deltaX, y+deltaY,deltaS, deltaS) 33 c += 0.01
Something went wrong with that request. Please try again.