work mostly play

6Mar/110

Yet More Applets – now with springs!


It should be clear to pretty much everyone on the planet by now that i'm a big fan of the Processing visual programming language. Well, here is more evidence. In the process of trying out algorithms for my thesis, I made a couple of games using spring force / attractor algorithms where you can make little structures and play with catenary curves. Both games use a similar interface, the main difference is that one is 3d (don't be fooled by that third dimension, I think the 2d version is actually more fun.)

You can find the 2d game here and the 3d game here. I'm going to make a separate applet page one of these days, promise.

The games are pretty easy to play:

  • Left click places or moves a node (click and drag to move).
  • Center click changes a node between fixed and free modes. In the 2d version center click and drag will pan the canvas.
  • Right click deletes a node (or a spring if you click at its center.)
  • Clicking an existing node and then making a new node or picking another existing node will link the two, adding nodes as necessary to make up the distance. If you delete a node it will try to keep the surrounding nodes connected (you can use this to shorten a "string" of nodes.)
  • Spacebar toggles between fixed and free node placement. C clears the board.
  • There are some other buttons to mess with constants, look at the source if you are curious (try toggling between the presets in the 2d version with the 1 and 2 keys).
  • Happy springing!