Copy link to clipboard
Copied
Hey everyone,
I have done a lot of searching and trying out, but still can not seem to figure out how to get this to work (while using only one layer).
Simply said: I want to create an expression for a Checkbox Control that allows me to check it on every 24th frame and hold it for 2 frames (before it goes off again).
To check it on every 24th frame was not that hard, but to hold it for 2 extra frames just does not seem to work for me.
Code (to turn it on every 24th frame):
frameCount = timeToFrames(time);
if (frameCount%24 == 0) {
value == 1
} else {
value == 0
}
Any help is appreciated!
Yoshi
Since the frame count starts at 0, the 24th frame would be frame 23. So it would be on at frames 23,24,47,48, etc. I think this does that:
f = timeToFrames(time);
(f%24 == 23) || ((Math.floor(f/24) > 0) && (f%24 == 0))
If that's not exactly what you wanted, it should be easy to adjust...
Dan
Copy link to clipboard
Copied
Since the frame count starts at 0, the 24th frame would be frame 23. So it would be on at frames 23,24,47,48, etc. I think this does that:
f = timeToFrames(time);
(f%24 == 23) || ((Math.floor(f/24) > 0) && (f%24 == 0))
If that's not exactly what you wanted, it should be easy to adjust...
Dan
Copy link to clipboard
Copied
Dan,
I appreciate the quick answer. It was exactly what I was looking for.
I was staring myself blind on finding a way to fix this within the if-statement (with delays, time offsets, etc.). This seems so logical, but still I could not figure it out haha. And you are right, I meant the 23th frames instead of the 24th (keep forgetting counting the 0 frame).
Thank you so much!
Yoshi