hello, i’m totally new to openframeworks. I’ve a good background with processing and i’m very interested in computer vision that why i decided to shift to OF.
anyhow, I’m trying to achieve Time delay color but no luck.
is there any code for this? or any similar effect?
also, can i link it with Realsense camera?
sorry if my questions are pretty dumb but all the books out there is kinda outdated
You mean, fading from grayscale to color, or from color to color, over time?
I don’t know of a method or extension that does that for you, but you can code it yourself.
I have done it by calculating the change in color values per time or per tick, and then changing the color every frame in the Update function, and redrawing it every frame in the Draw function.
This is probably one of the least optimal solutions, but it has worked for me most of the time.
Haven’t tested this one yet, so there might be some bugs. But it’s simple enough and the idea is there. I hope it helps.
Inceptionizta81 just posted an example of the type of thing I meant.
I’m not sure what aspects might not be clear to you.
OpenFrameworks calls Setup once when your program starts, and then calls Update and the Draw over and over many times (typically 60) per second. So if you want an effect over time, you draw something in the Draw function that uses variables whose values you update each time, generally in Update.
you can try this add-on to create a gradient adding some colors, then you can get the color on a percent of the full gradient:
ofxColorGradient<ofColor> gradient;
//first, fill in the gradient with colors, left to right
gradient.addColor( ofColor::red );
gradient.addColor( ofColor::green );
gradient.addColor( ofColor::yellow );
//query the gradient for a color at a specific spot
ofColor color = gradient.getColorAtPercent(0.2);
//rinse and repeat to draw the full gradient
for(float i = 0.0f; i < 1.0f; i+= 0.1f){
ofSetColor( gradient.getColorAtPercent(i) );
//draw using that color
}