euglena/src/proto488flashraster.java
2016-07-10 00:36:44 -07:00

44 lines
1.0 KiB
Java

int x_f = screenWidth;
int y_f = 0;
int t_raster = 0;
int x = 0;
int y = 0;
int framerate = 30;
int num_blinks = 3;
int blinktime = 2 * framerate * num_blinks;
int xstep = 50;
int ystep = 50;
int xsize = xstep;
int ysize = ystep;
void proto488flashraster(int x_i, int y_i, int rasterWidth, int rasterHeight){
//clearDisplay();
color draw_color;
float draw_size_factor;
if ((t_raster % (2*framerate) > framerate) || (t_raster % (2*framerate) == 0)) {
draw_color = color(bgR,bgG,bgB); //Background color
draw_size_factor = 1.1;
} else {
draw_color = color(0,247,255);
draw_size_factor = 1.0;
}
fill(draw_color);
noStroke();
rectMode(CENTER);
rect(convertXCoord(x_f), convertYCoord(y_f), xsize/calibrator.magx * draw_size_factor, ysize/calibrator.magy * draw_size_factor);
t_raster = t_raster + 1;
x = x + xstep * (t_raster / blinktime);
x_f = x_i + x;
y = y + ystep * (x / rasterWidth);
y_f = y_i + y;
t_raster = t_raster % blinktime;
x = x % rasterWidth;
y = y % rasterHeight;
}