Hi VV,
Drawing the ink would be effortless in a language like Processing, but is tricky in NodeBox. Unlike Processing, NodeBox is stateless so can’t do open-ended simulations where things (like moving pens) continuously evolve.
But there is a fairly simple way of doing what you want. The trick is to see that a spirograph drawing repeats after awhile so is not open-ended. Thus all you have to do is compute the complete drawing first, and then redraw a little more of it in each frame of the movie.
I have attached a demonstration network and a movie of the spirograph in action. The network may look different than yours, but is really just a slight extension.
The first thing I did was to wrap your entire network (except for the frame node) into a subnetwork which I named gears. The only change I made was to make the inner gear slightly transparent so you can see the ink better. So far no change.
Then I copied gears and named the copy “pen”. I then edited pen to remove everything except the pen hole in the inner gear. I added a port called thickness that changes the size of the pen hole and colored it red. So pen works just like gears except that all it shows is a red dot moving around.
To compute the entire drawing I fed a range node into pen instead of frame and by trial and error set the end value to 2520. This moves the pen dot enough to complete the drawing; pen now produces a list of 2520 red dots.
I then fed this list into a slice node and fed the frame into the slice size. So the first frame draws the first dot, the second draws the first two dots, etc. All that remains is to combine the gears and the pen.
When you hit play you’ll notice that the playback is now pretty clunky, but when you export the movie it comes out smooth. If you want to see the drawing without the gears, just disconnect the gear subnetwork from the combine node.
If you ever fiddle with your gear design to produce gears with a different number of teeth or a different position for the pen hole, you can repeat this process. Even better would be to make a general purpose gear system so you could feed these values into both the gear and pen subnetworks.
This is a really wonderful NodeBox project! What a great idea! Thanks for sharing it with us.
John