Why stop at a rectangle when the same method can be used to draw animated lines in any angle? So here is a Marching Ants Path class - I don't know if it's of any use - maybe for a lasso tool of some upcoming Flash based "Photoshop Junior" RIA?
BTW - the hardest part was to make the bitmaps line up correctly so that the patterns are moving somehow in sync. There is some under-the-hood stuff going on with beginBitmapFill that I haven't yet fully figured out. It seems like the fill bitmaps get aligned to 0/0, but when they are flipped they don't. Or do they?
Whatever, the current version uses a mixture of try-and-error plus in-theory-this-should-work algorithms and funny enough this seems to work well with short, curvy pathes and a little less well with long straight line segments. But you can see that anyway only with the "long" setting in the demo.
Download the Marching Ants Path source here.Posted at October 06, 2005 02:26 AM | Further reading