Category experiments

Disc experiment

Recently I’ve been exploring shapes and forms generated by algorithms. Sometimes I have a shape in mind and execute accordingly. This time I took a different approach.

The disc experiment is an exploration of a simple shape, the arc. I know I wanted the arc to be able to transform and I know I wanted it to exist in 3D space. After a few iterations I came upon this general shape.

A tweet from Felix Turner mentioned I should hook it up to web Audio a simple audio component of chrome with some ability to analyze sound data in real time, similar to a sound based experiment’s i’ve tried before. The data was too complex to accurately relate the sound to the visual so after a few iterations, I blatantly copied what Felix did and averaged the data into 1 parameter to make it easier to understand. I recently got into a classical music phase and found myself using Claire De Lune by DeBussy to provide the data.

versions : 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09

credits below

Loop Waveform Visualizer by Felix Turner

Three.js 3D framework

Dat-gui gui framework.

jstween for animation

Claire De Lune by DeBussy

Iris experiment

I recently found an great article about bezier curves by Mike Kamermans. What made it extra amazing was that all the images were open-sourced, interactive files created with Processing JS. You’re able to follow the mathematics of beziers as well understand how they were executed by reading the code.

His brief about calculating offset curves sparked off this concept of layering. By taking the initial bezier and rotate it about the y axis you get a simple and easily adjustable lathe. Offset curves around a lathe create a beautiful layering effect which add quite a bit of dimension. Using gradient fills instead of solids as subtlety to the shape(s) generated. It’s called Eye primarily because the shapes it was generating once I added the gradient fill looked liked an Eyeball. I think in hindsight, this experiment should be renamed iris and because I have an older flash experiment already named eye.

Update – I’ve renamed it Iris.

This experiment was built in HTML5 using the excellent three.js and dat.gui libraries.

I had a decent understanding of the idea so I set about modifying my base code with 3 distinct parts starting from left to right…

  1. The interactive 2d representation of the bezier.
  2. The rotate-able 3d version of the lathe.
  3. Controls created in dat.gui to modify parameters.

After a few versions I was able to get the bezier code as well as the layering effect working in 2d space. I then started working on the 3d shape, constantly adding and refining more parameters. I Isolated a few parameters which affect the animation of the shape and then spent the rest of the time cleaning and refining. Once the majority of the math was done, I spent time creating different view-able options with lines, particles and eventually fills.

Click the image below to see a progression of work

version : 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15

I’ve only tested this in chrome so there’s a very good chance it will not work in other browsers due to the needs of WebGL.

wormy experiment

This experiment was an offshoot from my previous experiment where I wanted to create a simple following formation rather than the circular one that arc had.

This particular experiment was unusual in that I didn’t really have a clear goal in mind. I was trying to solve a particular geometry problem. One iteration led to another which led to another. The end result was just a cleanup of all the iterations so you can see the inner workings. My fiancee wanted to name it colon but I had to veto an name it something more professional like wormy.

I’m slowly learning more about about html5, and I’m finally at a point where I can express some of these ideas at the same fidelity that I had with flash and processing. The reality is that it wouldn’t be possible without some of the open source frameworks available. For this experiment, I use jquery, jqueryui, seb’s vector class and had help from mr elstob.

version 01
version 02
version 03
version 04
version 05
version 06
version 07
version 08
version 09
version 10
version 11
version 12
version 13
version 14
version 15
version 16
version 17

arc experiment

I’ve been drawing circles with code for quite a little while now.
For the most part, I’ve been drawing them using a simple sinusoidal equation which I’ve used a ridiculous amount of times.

    var percentage = i/total*Math.PI / 180
    var xPos = Math.cos(percentage) * radius + offsetX;
    var yPos = Math.sin(percentage) * radius + offsetY;
    // do stuff with values

You don’t have to fully understand trigonometry (although it does help if you do). Plug in some values that change the parameters and you can easily modify code. However, once I started to create arcs, this proved to cause a whole mess of issues, the biggest when determining when to rotate clockwise vs counterclockwise. From my understanding, the sin/cos functions are smart enough to get a range from 0-360°. Once you go pass that, the values reset back to 0°. You can keep track of it using states but the values keep getting clobbered. It’s like the the tall man, small blanket problem. Covering your head makes your feet cold and covering your feet makes your head cold. I wasn’t smart enough to figure this out so I sat on it for a few months, then a few years, I’ve tried tackling this a few times but I’ve always ended up using a workaround instead.

Cut away to a month back. I was reading a post about drawing arcs and circles without using sine and cosine in the main loop. I believe the purpose was to skip trigonometry which can be processing intensive.

var da = (endPositionInRads - startPositionInRads); // distance angle
var ss = 45; // segmenet spacing
var rs = (Math.abs(da) / (Math.PI * 2) * ss); // real segments
var tm = Math.tan(da / real_segments); // tangent multiplier
var rm = 1 - Math.cos(da / real_segments); //radial multiplier

// first position uses sinusoidal
var xPos = Math.cos(startPositionInRads) * radius + offsetX;
var yPos = Math.sin(startPositionInRads) * radius + offsetY;
var tx; // transitionX
var ty; // transitionY
for (i = 0; i < rs; i++) {
    tx = -(yPos - offsetY);
    ty = xPos - offsetX;
    xPos += tx * tm;
    yPos += ty * tm;
    xPos += (offsetX - xPos) * rm;
    yPos += (offsetY - yPos) * rm;
    // do stuff with values

(The code is a little larger but it works)

I didn’t think much of it at first. I’ve actually used it before just for the sake of using it. Going back to the arc problem again, I realized that a simple way to not get the modulus 360° problem was to not use sine and cosines at all. Sure enough it worked and the results of that can be seen below.

(left image uses trig, right image just uses math)

I’ve been completely reliant on using sines and cosines for the pass decade that it actually prevented me from doing what I wanted to do. I think I’m going to revisit a few old experiments that I’ve never published due to code complexity and take a look at it from a different perspective. All the iterations can be found below.

version 01
version 02
version 03
version 04
version 05
version 06
version 07
version 08
version 09
version 10

nudibranch experiment

Audio by Daft Punk (“Recognizer” from Tron Legacy [SoundTrack]).

Nudibranch is an experiment inspired by the motions of a spanish dancer, a type of sea slug commonly found on coral reefs. They oscillate their fins symmetrically as well as rhythmically to travel through open water. This experiment is an abstraction of that motion.

In my previous experiment, I was writing code natively in Processing IDE. I’ve had some luck working with the FDT4 IDE for work related projects so I figured it was about time to plunge into the Eclipse framework. It was definitely a challenge getting everything setup but once it was, working in Eclipse was a breeze.

The first step was to create a simple following motion in 3d space using code I found while browsing through the processing forums. I implemented it to a simple chain script that I converted from 2d to 3d. While the mouse follow was technically working, the range I was receiving leaned towards the extreme causing weird jumps in animation. I instead opted for a simple motion that followed a osculating track.

In the balloon experiment, I was exposing much of the math calculations which overcomplicated the code. In this experiment, I used the toxiclibs libraries which handled much of the complex mathematics and saved me quite a bit of time and headaches along the way. The purple dots represent a scaffold for me to visualize the flapping motion. To quickly go over the construction, I’m building the nudibranch in terms of segments, like slices of a banana. Each slice points towards as well as follows it’s parent. I first parse and store all the points of all the segments and then draw those points later.

The next step was to create a simple oscillating line that protrudes from the center of each segment aka the fins. Using sinusoidal motion that’s offset by the segment id, I’m able to get the motion and cause a ripple effect that travels from the head to the tail of the nudibranch.

I added another scale and offset to each segment to make the flapping of the fins less rigid. I also started playing with the visuals creating line segments for better viewing.

I added the mesh fills soon after and proceeded to fine tune the parameters I created to mimic the look and feel of a nudibranch. I had quite a bit of fun modifying the parameters via the controlP5 sliders so I exposed it to the viewer and added quite a bit more which included motions related to audio, as well as the ability to randomize and animate across all parameters.

This was the basis for the nudibranch video which randomly changed form and shape over time. It may not look like a nudibranch any more but the essence is still there. Feel free to download the latest mac and pc desktop apps to view the ful experience.