Pattern creations by sensing body motion 8

Collection of patterns

Patterns are created by hand movement and accelerometer.  Each time development of the patterns is different, because you never move your body twice the same way.

Screen Shot 2014-07-14 at 11.42.40 PM Screen Shot 2014-07-14 at 11.43.02 PM Screen Shot 2014-07-14 at 11.43.33 PM

Screen Shot 2014-07-14 at 11.44.09 PM Screen Shot 2014-07-14 at 11.44.42 PM  Screen Shot 2014-07-14 at 11.46.34 PM

Screen Shot 2014-07-14 at 11.47.12 PM

 

 

Processing code for creating this patterns

import processing.serial.*;

float sensorX=0;
float sensorY =0;
float sensorZ =0;
float x;
float y;
float z;
float targetX, targetY;
float easing = 0.05;
float blueValue=0;
float redValue=0;
float greenValue=0;

Serial myPort;

void setup()
{
size(800, 600);
smooth();
noStroke();
background( 255 );

println(Serial.list());
myPort = new Serial(this, Serial.list()[6], 9600);
myPort.bufferUntil(‘\n’);
}

void draw()
{

targetX = sensorX;
float dx = targetX – x;
if(abs(dx) > 1) {
x += dx * easing;
}

targetY = sensorY;
float dy = targetY – y;
if(abs(dy) > 1) {
y += dy * easing;
}

fill (0, greenValue, blueValue);
ellipse(y, x, 1, 1);

fill (0);
ellipse(x, y, 1, 1);

fill (0, 0, blueValue);
ellipse(y+100, x+100, 1, 1);

fill (0);
ellipse(x+100, y+100, 1, 1);

fill (0, greenValue, 0);
ellipse(y+200, x+200, 1, 1);

fill (0);
ellipse(x+200, y+200, 1, 1);

fill (0, greenValue, blueValue);
ellipse(y+300, x+300, 1, 1);

fill (0);
ellipse(x+300, y+300, 1, 1);

fill (0, 0, blueValue);
ellipse(y+400, x+400, 1, 1);

fill (0);
ellipse(x+400, y+400, 1, 1);
}

void serialEvent(Serial myPort) {
String inString = myPort.readStringUntil(‘\n’);

if (inString != null) {
inString = trim(inString);
float[] colors = float(split(inString, “,”));
if (colors.length >=3) {

redValue = map(colors[0], 0, 1023, 0, 255);
greenValue = map(colors[1], 0, 1023, 0, 255);
blueValue = map(colors[2], 0, 1023, 0, 255);

// map the x,y and zPos from the incoming sensor value
sensorX=map(colors[0], 150, 500, 0, height);
sensorY=map(colors[1], 150, 500, 0, height);
sensorZ=map(colors[2],150, 500, 0, width);
}
}
}

 

 

Leave a Reply