Haxademic is my personal Processing-based creative coding toolkit, built to run in Eclipse with Java and the latest version of Processing. It's a starting point for interactive visuals, installations, rendering and writing Processing "sketches" in a more robust environment. It loads a bunch of useful Java/Processing libraries and contains a ton of other useful tools that I've written.
While the code has been open-sourced, I don't plan on making it easy/viable for others to use - I don't have the time or desire to support it. This repository is more about sharing the interesting code within, and I fully endorse borrowing it however you see fit.
Below you'll find a long list of classes and utilities that I've built to make my life easier. I've tried to make as many basic demos as possible for all of these features. The
demo package mostly mirrors the
core directory and should give you an idea of how to implement these object on your own.
PAppletHax - This is the base class for every Processing app that I build. It initializes tools for app-level concerns, rendering, multiple input devices, audio FFT, and debugging tools. Tons of additional tools and utilities can be found in the library.
P - This class holds static references and methods - primarily to the app instance so I don't have to pass it around everywhere.
AppWindow - This object helps set up properties related to the app window, which can mostly be configured in
AppSettings - Static constants to help set app properties and initialize special objects in
PAppletHax. Used in tandem with
Config - Loads properties from
data/properties/run.properties (or an additional custom .properties file), using the same string constants in
AppSettings. All of these properties can be overridden in PAppletHax in the automatically-called
config() function on app initialization. Also helps access & parse command line arguments.
ConvertUtil - A collection of basic Java type-conversion methods.
Patterns - A collection of pattern generators for step sequencer.
GLBlendModes - Fancy OpenGL blend modes with helper methods to set them on a given PGraphics context.
AppStoreDistributed - A WebSockets-enabled extension of
AppStore to keep multiple machines in sync with a shared data structure.
P, the object allows us to toggle and add relatime properties to the
DebugViewHashMap and log values on-screen, rather than trying to watch Java console values fly by. Press
/to toggle. Also includes a panel for key commands and extra developer-defined info.
ColorUtil - Handy color conversion methods.
EasingColor - An object that represents a single color with interpolation and helpful getter/setter methods. Has some overlap with
ColorUtil - the two classes should possibly be merged.
ImageGradient - Loads an image and samples its colors horizontally. Works well for gradients and comes with a library of presets.
OpenGLUtil - Lower-level helper methods to set OpenGL flags that aren't obviously available in Processing.
OrientationUtil - Helper methods to orient the graphics context rotation towards a specific 3d location. These utilities help point 3d objects toward each other.
PG - Lots of static helper methods to initialize and set properties on the specified PGraphics context. Used constantly throughout the core and demos.
PGraphics32 - A custom PGraphics object with 32-bit float texture enabled for use as a data texture in shaders.
AnimatedGifEncoder - Renders a gif file directly out of a Processing app. I've mostly abandoned this in favor of rendering a video, then using conversion tools like ffmpeg to more precisely convert to gif.
Base64Image - Encodes and decodes between a PImage and a base64-encoded string.
BufferActivityMonitor - Gives us an "activity" rating of a moving image, like a webcam, video, or other PGraphics instance that animates. Useful for motion detection.
BufferColorObjectDetection - Finds the center of mass of a specific color (within a threshold) on an image. Useful for object tracking in controlled situations.
BufferMotionDetectionMap - Uses shaders for fast frame-diffing to detect motion between video/camera frames. Includes helpers to find random motion points in the motion map result.
BufferThresholdMonitor - Copies an image to a low-res buffer, runs a threshold filter, and counts white vs black pixels. Useful as a step in certain CV processes.
FrozenImageMonitor - Helps detect a frozen video stream (from a webcam, most likely). Camera feeds have some natural noise that will change over time, even if the subject doesn't. If the feed is frozen, this can be detected.
ImageCyclerBuffer - Uses GLSL transitions to create a slideshow from an array of PImages.
ImageSequenceMovieClip - Loads and plays back an image sequence like a Movie object does for video files.
ImageSequenceRecorder - Builds an array of PGraphics objects to record recent video frames and play them back for time distortion effects or short video compiling.
ImageUtil - Lots of tools for dealing with images and drawing them to screen.
TickerScroller - Repeats a texture across a PGraphics and scrolls.
TiledTexture - A drawing helper that takes advantage of OpenGL's texture repeat function and lets us draw a rectangle with a texture fill. Includes zoom & rotation controls for fancy texture & pattern tiling.
BaseSavedQuadUI - Base class for
PGraphicsKeystone. Stores/recalls a quad to text file and provides a GUI and keyboard controls to move the vertices.
CaptureKeystoneToRectBuffer - Reverse-projection-mapping tool. Pulls from an image with a configurable quad and draws to a PGraphics instance.
PGraphicsKeystone - Projection-mapping tool. Draws a PGraphics buffer to screen, with custom keystoning backed by a text file.
SavedRectangle - Basic mapping tool. Provides rectangle data controlled by a mouse-based UI, backed by a text file.
ForceDirectedLayout - Force-directed layout implementation.
ParticleLauncher - GPU particle implementation.
VectorFlyer - 3D particle that flies toward a destination point.
Extrude2dPoints - Turns a set of 2d points into a 3d extrusion.
Icosahedron - Icosahedron generator, with optional texture application.
MarchingCubes - Marching cubes implementation.
MeshShapes - A collection of interesting generative mesh shape drawing functions.
LinesDeformAndTextureFilter - GPU displacement shader for a textured LINES PShape.
MeshDeformAndTextureFilter - GPU displacement shader for a standard PShape.
PointsDeformAndTextureFilter - GPU displacement shader for a textured POINTS PShape.
PShapeSolid - Accepts a SPhape and tracks shared vertices, providing multiple deformation strategies without letting connected triangles diverge.
PShapeUtil - A large collection of normalization, texturing and other manipulation methods to apply to PShape objects.
Shapes - Some custom mesh-drawing tools.
Superformula - A superformula implementation.
TextToPShape - Text with a custom font turned into a 2d or 3d mesh.
FileUtil - File & directory methods to help with file creation, deletion & listing.
PrefToText - Saves & retries a float/int/String value from a text file.
WatchDir - Watches a directory & provides a delegate callback when files have changed.
DMXWrapper - Helper to "easily" connect and send messages to an ENTTEC DMX USB Pro.
GamepadState - Uses JInput to receive messages from a gamepad controller.
MidiText - Parses a MIDI file.
InputTrigger - Accepts multiple inputs to trigger the same action. Keystrokes, MIDI, OSC, HTTP and more.
IDepthCamera - Interface for
KinectAmbientActivityMonitor - Provides a general ambient activity value for a room.
KinectRoomScanDiff - Scans a room with the Kinect, then watches for depth differences from scan.
KinectDepthSilhouetteSmoothed - A hardware-accelerated smoothed silhouette image from raw depth data.
KinectRegionGrid - Breaks up kinect raw data into an x/z grid, with center-of-mass (joystick) and
active readings for each quadrant.
Mouse - Automates, moves & clicks the system mouse with a Java Robot.
OscState - Wraps up OSC i/o functionality.
PrintPageDirect - Print an image to a physical printer directly from Processing.
SerialDevice - Basic input/output wrapping for Arduino and similar USB serial devices.
WebCam - Inits a webcam via singleton or normal instances, and receives new frames by implementing
IWebCamCallback. It stores & recalls your
Capture configuration for the next app launch.
DisplacementPoint - Elastic displacement from a static point, based on an influencing external point.
EasingBoolean - Lerps towards true or false over time. Switches when it reaches the end. Useful for dealing with noisy data.
EasingFloat - Lerps towards a target. Includes optional frame delay and acceleration.
ElasticFloat - Lerps towards a target with Hooke's law springiness. Configurable friction and acceleration.
FloatBuffer - A FIFO buffer of incoming float values for smoothing purposes.
LinearFloat - Linearly lerps towards a target. Includes optional frame delay. Works great in tandem with
Penner - Robert Penner's easing equations.
MathUtil - Lots of useful math utility functions.
SphericalCoord - Spherical coordinate helper functions.
DemoAssets - A collection of media files (svg, obj, png, ttf, mp4) to help quickly load an asset for demo purposes. Files are pulled from
MediaTimecodeTrigger - A helper object to run callbacks as audio or video playback reaches specified timecodes. Could be used for any time-tracked event triggering.
NormalizeMonoWav - Normalizes a mono .wav file without any external libraries.
WavRecorder - Record a .wav file with Minim.
AudioIn - A singleton to initialize a given IAudioInput object and route microphone input, or audio file playback FFT into a global analysis object, easily accessed from around the codebase.
AudioStreamData - The common data storage object for audio analysis results.
IAudioInput - A common interface between several Java libraries that run FFT analysis and beat detection on an incoming audio signal. Choose between Beads, Minim, ESS or Processing Sound, via AppSettings.
MovieFinishedListener - Adds a native listener for video playback completion.
MovieToImageSequence - Loads frames from a video into an array of PImages in realtime. Useful for fancier & faster playback/scrubbing through video frames without relying on Movie decoding once the frames are extracted.
DashboardPoster - Post debug info & screenshots to a web-based dashboard.
FileDownloader - Download a file from the web to a local directory.
IPAddress - Get the local machine's IP address.
JsonRequest - Make a JSON request to a web server.
JsonUtil - JSON formatting utility.
SocketServer - Run a websocket server with Java-WebSocket.
WebServer - Run a web server with Jetty.
FrameLoop - Frame-counting helper to build looping animations, trigger looping events based on
frameCount, and provide global access to frame-based calculations.
GifRenderer - Auto-render gifs from the app.
ImageSequenceRenderer - Auto-render an image sequence from the app.
JoonsWrapper - Render high-quality raytraced geometry with Joons.
VideoRenderer - Render a video directly from the app.
AppRestart - Kills & restarts the app!
AppUtil - Set app window properties and generate the script that was used to launch the app.
CrashMonitor - Launches a 2nd app window to monitor the first, in case of a crash.
DateUtil - Date & time helper functions.
JavaInfo - Tons of methods to print out Java & system properties.
SecondScreenViewer - Launches a 2nd, scaled-down window to monitor the main window from a 2nd monitor.
ScriptRunner - Cross-platform script runner - makes up for the difference between .cmd/bat and .sh scripts. Works with
IScriptCallback delegate to callback when the script finishes.
SystemUtil - Get a timestamp, take a screenshot, copy text to clipboard, open a web browser, check/kill system processes, run a Timer.
FitTextSourceBuffer - Generates a tightly-cropped texture from a String with a custom PFont.
RandomStringUtil - Generates random Strings.
StringBufferLog - Generates a buffer of text for an on-screen log tail.
StringFormatter - Format numbers to strings.
UISlider - A text file-backed slider UI.
UIButton - A Button object with optional toggle mode.
UI - A collection of
IUIControl objects, auto-initialized with a PAppletHax app via
\ to toggle paneL, and add new sliders/buttons with static methods on
Haxademic uses the following Java & Processing libraries, which I've included in this repository so you don't have to find them yourself (more on that below):
defaults write com.apple.finder AppleShowAllFiles YES
haxademicdirectory that you cloned/downloaded, press Finish, and the project should be ready to use.
libdirectory and select Refresh. This will let Eclipse know that you've added the appropriate libraries on your file system.
haxademicproject in the Package Explorer or Navigator window and click Properties
src/com/demo/and choose Run As -> Java Application from the menu. This will create a run configuration for the app.
The Haxademic codebase and apps are MIT licensed, so do what you want with these files. Feel free to let me know that you're using it for something cool. I've added 3rd-party .jar files and compiled Java libraries that I'm probably not actually allowed to redistribute here, so if you're the owner of one of those libraries and would like the files removed, let me know. I've included them to aid those who would like a quick start and not have to search for the many dependencies of this project. Some of these libraries have disappeared from the web entirely, so searching for them may be futile anyway. I just want people to make cool things with this library, and hope you understand.