Wednesday, 15 August 2012

Remote-control eyeballs: Using remote data from a published Google spreadsheet to position eyes with Processing

Twitr_janus virtual eyes

Above is shown a simple keyboard controlled Processing sketch in action. The arrow keys are used to position the way the eyes look. Each arrow key increases the value of a position variable for the irises and separately for the pupils of the eyes.

To remote control Twitr_janus' eyeballs, this was extended to send position data in 2 directions based on the values in a published google spreadsheet. The RSS feed is read and parsed by Processing to extract the data, which is used to compare the current horizontal and vertical positions with the target positions received. Processing runs a detection function that detects any difference, and reduces the difference by incrementally adjusting the current position and redrawing the eyes, until it can't detect a difference. A classic cybernetic negative feedback system!
Twitr_janus eyes controlled by Google spreadsheet data Twitr_janus eyes controlled by Google spreadsheet data













Left published Google spreadsheet. Right, same with eyes.


Twitr_janus virtual eyes Twitr_janus virtual eyes













Initially, so attempts at this went a bit haywire, due to over thinking the script to work out boundaries to stop the irises  and pupils doing strange things (left) or leaving the edge of the eyes (right).

This java applet demonstrates the direct keyboard sketch in action. This is freely available to download and copy at http://openprocessing.org/sketch/67233

It requires Java, so won't work on some devices, but if you have a Java plug-in, you can make the eyeballs move with the keyboard arrow keys...

No comments:

Post a Comment