How to add dashes as a stroke for a shape without using an image?

I’m creating a modal. The background of the modal is a rectangle with rounded edges and the strokes are dashes, its size depends on the amount of text in it at that point.
Hence, I am looking for alternatives to create the stroke with dashes without using an image.

Something like this?

https://docs.coronalabs.com/guide/graphics/effects.html#generator.marchingants

@ponywolf
I did come across marching ants.
Any idea on how to stop the movement?

If the image is rectangular or circular, then you could always write a function that adds dashes along the sides via display.newLine().

Maybe the checkerboard generator with the right settings would do that without moving. Just a guess…

https://docs.coronalabs.com/guide/graphics/effects.html#generator.checkerboard

Oh yes!
With one of the two colors having red (for example) and the other having an alpha of 0. This would more or less do the job.
I was looking to have the length of red color dash to be more than the transparent’s length. I don’t think that’s possible with this approach.
Nevertheless, thanks a lot, @ponywolf! This was super helpful.

1 Like