I am using a ultrasonic sensor (powered by an Arduino) to control the speed of a slideshow array.
In processing, I am mapping the values from the sensor and then using the values in a timer function to run the array....
input_1_mapped = map(input_1, 0, 50, 0, 1000);
The mapping is linear, but I'd like to be able to curve the values so that the change in speed is more dramatic at first but then becomes more gradual as the interactor gets closer to the sensor.
Any ideas how I could manipulate the data to do this?
I am using the GiCenter Library to run a randomized slideshow of 12 sketches. Each sketch is an animated array of images (ranging from 30-80 images) for a grand total of 800-ish images. I am asymmetrically loading the images in order to not run out of memory, and the speed of the animations is controlled by a sensor attached to an arduino. It is all running pretty smoothly, with one exception.
The size of the sketch is 1280x720, and the project will be running in a gallery for the next month. Periodically (and it seemingly happens more frequently when the sketch first runs) a sketch will only show in the upper left corner of the display window (at 100 px x 100 px)- the rest will be black, and a null pointer exception will pop up. It seems to sort itself out the longer the sketch runs, but I can't figure out why it is happening, and it is less than ideal…. Any ideas why it is happening? I can't find anything in the code, all the sketches are set to the proper pixel dimensions….
Hi- This is my first time posting to this forum for help. I am working on this sketch as part of a larger interactive project; this is, I guess, phase one. I am trying to create a randomized grid that allows me to dynamically re-arrange photographs. Right now, I am loading one half of the sketch with pieces of one image, and one half with pieces from the other.
But, I want the integration of the two images to be more randomized, and I'm not sure how to do that. I would also like to be able to control what percentage of the mix comes from one image (right now it is essentially a 50/50 mix). Any suggestions?
Thanks.
PImage img1;
PImage img2;
int yunits = 50;
int xunits = 33;
int ypixelunits;
int xpixelunits;
void setup() {
size(500, 334);
ypixelunits = width/yunits;
xpixelunits = height/xunits;
img2 = loadImage("img_04.jpg");
img1 = loadImage("img_03.jpg");
//frameRate(5);
noLoop();
}
void draw() {
int rows = int(random(2, 15));
int[] rowPositions = new int[rows];
//calculate the heights, not the y-coordinates
int lastHeight = 0;
int ycount = 0;
int totalHeight = 0;
for (int y = 0; y < height; y += lastHeight) {
if (ycount == rows-1) {
rowPositions[ycount] = height - totalHeight;
lastHeight = rowPositions[ycount];
}
else {
int yelement = int(random(1, ((yunits-rows-ycount)/6)));
rowPositions[ycount] = yelement * ypixelunits;
lastHeight = rowPositions[ycount];
totalHeight += lastHeight;
}
ycount++;
}
int ypos = 0;
int xpos = 0;
for (int i = 0; i < rowPositions.length; i++) {
int columns = 2;
int[] columnPositions = new int[columns];
int lastWidth = 0;
int xcount = 0;
int totalWidth = 0;
for (int x = 0; x < width; x += lastWidth) {
if (xcount == columns-1) {
columnPositions[xcount] = width - totalWidth;
lastWidth = columnPositions[xcount];
}
else {
int xelement = int(random(1, (xunits-columns-xcount)));
columnPositions[xcount] = xelement * xpixelunits;
lastWidth = columnPositions[xcount];
totalWidth += lastWidth;
}
xcount++;
}
int xCrop = 0;
for (int j = 0; j < columnPositions.length; j++) {