Examples of boids that draw, some driven by video optical flow. Examples all save drawings to Adobe Illustrator 7.0 format using IgnoCodeLib. Based on Flocking, by Daniel Shiffman http://www.shiffman.net, in The Nature of Code, Spring 2009. Demonstration of Craig Reynolds' "Flocking" behavior, See: http://www.red3d.com/cwr/. Original optical flow code by Hidetoshi Shimodaira shimo@is.titech.ac.jp.
This code is designed to work in the Eclipse IDE, though it can be modifed to run in Processing. See the ProcessingDemo folder for examples that run in Processing 2 and Processing 3 (.zip file has them all).
Add Processing 2.2.1 or 3.x libraries core.jar and video.jar to the Eclipse Build Path. In Processing 3 you will need to install the Processing video library. Add external libraries IgnoCodeLib (https://processing.org/reference/libraries/) and ControlP5 (http://www.sojamo.de/libraries/controlP5/) to the Build Path.
You will need to set the video device for your system in the setupVideo call in the setup method. To save files, set the filePath variable to point to a directory in your system.
The ProcessingDemo folder includes fairly complete information on moving code between Processing and Eclipse and strategies to incorporate .java files into Processing.