I was wondering how configurable the object.stroke.effect = “generator.marchingAnts” are?
I want to draw a simple dotted/dashed line.
I need to have static ants instead of them moving.
I need to be able to change the line colour from black+white to color+transparent.
I need to be able to change the width and distance between dots/dashes.
I guess I have to do this with a repeating image or something.
Hi @danielr0,
As you can see in our guide, there are some configuration options for marching ants:
https://docs.coronalabs.com/daily/guide/graphics/effects.html#generator.marchingants
However, it may not be enough to accomplish every detail you describe. In that case, you may be able to “fill” a stroke (outline) around the object with a bitmap image, or use frames from an image sheet… so yes, basically you’re on the right track with thinking that a repeating image fill could accomplish exactly what you need.
Take care,
Brent
Thanks.
For other people: My solution
Make a 1x2 pixel image of a white and transparent pixel side-by-side.
Use the following code to draw it.
display.setDefault( "textureWrapX", "repeat" ) local dash = display.newRect(xPos, yPos, rectWidth, 1) --I suppose you could rotate it after making it to have more than just a horizontal dashed line dash.fill = {type='image', filename='dash.png'} --must be png(or not jpg) to support transparency dash.fill.scaleX = imagePixelWidth / rectWidth --this preserves pixel size. you can resize it how you want. you need to know pixel width beforehand or find it somehow. dash:setFillColor(0.5,0.5,0.5) --set to whatever color you want. for tables of colors, remember to use unpack(table)
Hi @danielr0,
As you can see in our guide, there are some configuration options for marching ants:
https://docs.coronalabs.com/daily/guide/graphics/effects.html#generator.marchingants
However, it may not be enough to accomplish every detail you describe. In that case, you may be able to “fill” a stroke (outline) around the object with a bitmap image, or use frames from an image sheet… so yes, basically you’re on the right track with thinking that a repeating image fill could accomplish exactly what you need.
Take care,
Brent
Thanks.
For other people: My solution
Make a 1x2 pixel image of a white and transparent pixel side-by-side.
Use the following code to draw it.
display.setDefault( "textureWrapX", "repeat" ) local dash = display.newRect(xPos, yPos, rectWidth, 1) --I suppose you could rotate it after making it to have more than just a horizontal dashed line dash.fill = {type='image', filename='dash.png'} --must be png(or not jpg) to support transparency dash.fill.scaleX = imagePixelWidth / rectWidth --this preserves pixel size. you can resize it how you want. you need to know pixel width beforehand or find it somehow. dash:setFillColor(0.5,0.5,0.5) --set to whatever color you want. for tables of colors, remember to use unpack(table)
thanks danielr, your solution is what I want. 
thanks danielr, your solution is what I want. 