Hallo.
I'm a rank beginner, but I thought a small PHP background might let me be ambitious. Apparently not.
But while I go back to the basics, could you folks perhaps let me know what I'm doing wrong?
My plan was to make a red screen (well, rectangle) pulse according to a midi clock I was planning on adding later. I wanted a red to black fade similar to Robert Hodgin's video with Bitshifter (http://vimeo.com/2148419)
Basically wanted to mimic that effect, play around with recursion a we bit, and hopefully build into a slightly larger thingy
I seem to have the numbers doing (vaguely) what I want according to the Println function, though the map function isn't acting like I'd expect it to. The maximum mapped numbers are returning values higher than it should, whereas it also occasionally goes below what it should. I am very confused.
But slightly more importantly to my short attention span and need for immediate results, the goddamn fill and rect functions aren't working producing anything and I can't figure out why.
Please help?
Many thanks
Code:
import processing.opengl.*;
import promidi.*;
int bpm = 120;
int frate = 30;
float fmath;
float lPha = 0;
int fram = 0;
float pulse;
void setup() {
size(640,480,P2D);
frameRate(frate);
colorMode(HSB);
background(0,255,255);
smooth();
noStroke();
rectMode(CORNER);
}
void draw() {
pulse = bpm / frate;
for(int i = 0; fram-1 <= i; i++) {
fmath = (bpm / pulse) - fram;
lPha = ceil(map(fmath,0,frate-1,0,255));
fill(0,lPha,lPha);
rect(0,0,width,height);
if(fram > (bpm / pulse)) { i = 0;}
if(fram-1 >= (bpm / pulse)) { fram = 0;} else{ fram++; };
println(fram + " - " + pulse + " - " + fmath + " - " + lPha);
}
}