Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
104 lines (63 sloc) 4.85 KB

Harmonograph 1.0.0

Screenshot

Download for OSX (181.6mb)
Source

About

Axidraw black line photo

This was never meant for public use so the ui isn't very intuitive (and the code is a horror show - don't judge me), it was just an attempt to see how easy it was to use Processing inside a desktop Java app while working with the Axidraw pen plotter. See Technical section below if you want the details.

There are three preset type variants:

Shapes

  • Constrained Circle - the Lissajoux control points are constrained within a circle.
  • Line - only the x axis is incremented each iteration.
  • Circle - the control points are moved around a paramtric circle in an attempt to prevent having a single origin point for the Axidraw (too many passes of the pen on a single point of paper doesn't work well).

Shapes

Controls

Everything should become apparant through experimenting but there are a couple of modifiers for mouse scroll/trackpad when the preview pane has focus:

  • Ctrl-scroll will rotate the object.
  • Shift-scroll increases zoom amount.

In addition you can save and load shapes in the File menu, as well as export to PNG and PDF (which can then be imported into Inkscape for plotting to the Axidraw).

The view menu allow you to change the background colour, the stroke colour and the stroke opacity, this becomes useful when using a high amount of iterations and produces attractor-like images. There's also a quick light theme/dark theme toggle as I sometimes use a white gel pen on black card with the Axidraw.

If you do intend to plot the shapes with an Axidraw or similar set the stroke opacity quite high so you get a better idea of how the shape will perform when plotted, higher iterations don't work well for plotting, eg:

Stroke opacity

Technical

I've never got on well with the look (or api syntax) of ControlP5 so looked around for info about using the core Processing lib within a standard Java Swing project. I found this example on HappyCoding.io and started building a project based around an evolving Lissajous curve sketch I'd been using with the Axidraw plotter. Normally with these things you put up with the basic Processing IDE and tweak a line here and there, moving to Jetbrains IDEA for this creative coding is much more productive.

The core sketch itself creates two Lissajoux control points and then derives three coordinates for a curve vertex each iteration, playing with these values gives drastically different results so I added Javaluator to enable editing the expressions for these points outside of the IDE.

Shapes

Java to OSX App

Packaging a .jar as an .app, notes:

jar2app - install is broken on my machine but can be run fine with Python: python jar2app.py path/to/jar.jar

To bundle in the JVM so app will run on any Mac without dependency on Java being installed: python jar2app.py path/to/jar.jar -r /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk

and as above but with custom app icon set (created by any online .png to .icon tool): python jar2app.py path/to/jar.jar -r /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk --icon=appIcon.icns

Note. Find the path to the jdk with: /usr/libexec/java_home -v 1.7

Swing + Processing App Icon

The Processing lib will pesistently change your app's dock icon and was a pain to fix, eventually I found a solution in a random comment in the Processing forums, if using 3D mode customise the icon like so:

public void settings() {
    size(1052, 744, P3D);
    PJOGL.setIcon("appIcon.png");
}

and for non-P3D sketches:

  public void run() {
    String[] processingArgs = {"ProcessingSketch"};
    PApplet.runSketch(processingArgs, this);
    surface.setIcon(somePImage);
  }

Create installer for OSX .app

Using: create-dmg

Lots of options but this was all I needed:

./create-dmg \
--volname "Harmonograph Installer" \
--window-pos 200 120 \
--window-size 800 400 \
--icon Harmonograph.app 200 190 \
--hide-extension Harmonograph.app \
--app-drop-link 600 185 \
Harmonograph-Installer.dmg \
Harmonograph.app/

Contact

If you'd like any more information contact me at fiskdebug@gmail.com