-
Syntax for returning value that alternates 0,1,0,1,0,1?
(I accidentally posted this in the wrong forum earlier. Sorry.)
I have a project in which I must find a way of returning an alternating value (like 0,1,0,1) based on the frame number (ie, Frame 0: zero. Frame 1: one. Frame 2: zero. Frame 3: one. Etc.) I thought I had solved the problem through the use of relevant posts in this forum. At first, I was trying this:
positionEven = 239;
positionOdd = 240;
f = thisComp.frameDuration;
if (f%2 == 0) [360,positionEven] else [360,positionOdd]Unfortunately, a further problem is that I am forced to make use of AE6 because a plugin I wish to use will only work in AE6 (it breaks interestingly in AE7). Sadly, AE6 does not appear to possess syntax which covers “thisComp.frameDuration”. So I instead made a slider and based the formula off that:
positionEven = 239;
positionOdd = 240;
f = thisComp.layer(“blargh”).effect(“Slider Control”)(“Slider”);
if (f%2 == 0) [360,positionEven] else [360,positionOdd]Now, the real trouble here is that I am not sure what f%2 is supposed to return. My assumption was that it was a sort of shortcut which essentially spat out the even/odd status of whatever number “f” is. An inspection of the results would seem to confirm this as first. But as I sadly discovered after a six hour render, the formula stops working reliably after a few seconds’ worth of frames. Suddenly, instead of a consistent 0,1,0,1,0,1 we start getting a lot of 0,1,1,1,0,1,0,1,1,1. So whatever f%2 does (and believe me: it’s tough to Google “%2” and find out), it’s not what I thought.
So that’s where I’m at. I still very much need a way of returning a solid 0,1,0,1 from start to finish, and the %2 function is not the solution. Please help. ;p I was hoping to have it all wrapped up by today and this fun problem is killing me.