Marching ants, the dashed lines that slowly travel over any selection you make in Photoshop. I'm trying to recreate those in AE.
It's pretty simple right? Well, I'm a big dumb dumb.
I've got a square, it is stroked with dashes. If I animate the "offset" parameter, the dashed stroke will travel across my shape much like the Marching ants travel across a selection in photoshop. THE ONLY DIFFERENCE! The Marching ants move in small intervals, as opposed to one continuous smooth motion. Much like a clock hands ticks from one second to the next, it's not smooth.
I can easily get what I want by just animating the offset and applying posterize time with a super low number.
But this seems like a really useful thing to know how to do with an expression. I'm assuming it's kind of like a blink expression, except instead of oscillating between two values, we just want our value to continue growing/shrinking in those stuttering intervals.
Basically an expression that is a counter, that counts up/down at a rate you define, and will pause at an interval you define, how long the pause is would also be a value you define.
If you look closely at Marching Ants, you'll notice that they're not actually doing the same as the offset on a dashed line.
A dashed line turns around corners, and continuous along the path until it's back where it started,
whereas the marching ants are a 45° slanted zebra pattern that is masked within a 1px stroke.
The easiest way to get the effect is to use an animated pattern, and use your shape as a track matte.
Alternatively, if you want to keep it in 1 layer I have a solution using Gradients and Colorama effect.
(see attached FFX) 12828_marchingants.ffx.zip