Search code examples
cocoaanimationselectionmarching-ants

Cocoa: Animated path (moving dotted line)


I am making an image editing application, and need to show selection areas on the screen. In Illustrator, Photoshop, GIMP, and everything else this is shown using an animated dotted line that kind of crawls around the selection.

I need to do this same thing. How do I put an animated line like that on a view in Cocoa?


Solution

  • Sometimes this effect is called "marching ants", if that helps you search at all.

    Here's how to do it with Core Animation.