-
Cinema 4d C.O.F.F.E.E. timer reset / flip flop randomisation
Hello All,
I’m having a little trouble trying to automate an idea I had involving lighting and their intensity.
My idea was that a group of lights would vary in intensity over time as the scene progresses.
I thought my best way of doing so would be to use Xpresso. I got as far as having all the lights change in intensity individually, but I came upon a problem. they would change every single frame which made them flicker as opposed to more smooth transitions I was looking for.I then figured that I could change when the sequence started by using a flip flop at the beginning of the sequence so that it wasn’t changing each frame. I then came upon another problem. with this new addition, the lights would either flicker, or be solid on for a period of time, there was no constant ‘movement’ of the lights.
I then thought that if I could use an equation or script to reset the flip flop, I could get the results I desired. My idea was that I could change the state of the flip flop every 0.134 seconds (4 frames).
(FPS=30
1 second/ 30 = 0.0333333333
ans*4 = 0.13333333)time = x
constant = 0.134 = y
output = nI tried (x-y=0)=1 and other variations. my friend, who is studying Comp Sci, tried some script he had written,
main()
{
if(x%y==0){
n=1;
} else {
n=0;
}
}and
main()
{
n = if ((x%y)==0) then 1 else 0
}
but alas they did not work.
This is where I am stuck, both me and my friend cannot write a script that will do such that.
If anyone has any ideas on anything I can do, it would be most appreciated. As long as the output of the flip flop can be 1 every 0.134 seconds, I will be happy.
I have linked a picture of my Xpresso editor and C.O.F.F.E.E. editor.
In the bottom you will see my C.O.F.F.E.E. test area where the output will replace the Random connected to the Switch on the flip flop.https://i.imgur.com/estGlIV.png
Josh