Crossfade with EZIO
This example uses one analog-to-digital input to control the crossfade amount.crossfade_ezio.zip (90.8kb)
import processing.serial.*;
// create variables for the Images
PImage fire;
PImage water;
EZIO ezio;
void setup ()
{
// load the images
fire = loadImage("fire.jpg");
water = loadImage("water.jpg");
println(Serial.list());
//replace /dev/ttyUSB0 with your serial port!
ezio = new EZIO (this,"/dev/ttyUSB0");
size(512,400);
}
void draw ()
{
background(0,0,0);
// tint (r,g,b,alpha);
int a;
a=ezio.a2d(0);
tint (255,255,255,a);
image(water,0,0,512,400);
tint (255,255,255,255-a);
image(fire,0,0,512,400);
}
void stop()
{
// when the sketch stops, close the serial port too
ezio.stop();
}