Ants with Alpha or Shaders with Strokes

Hi,

Sorry, I guess this is kind of two questions…

** Marching Ants Effect

The ‘Marching Ants’ effect as defined here gives a black/white effect.

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

The effect I would like to achieve is a white/alpha effect.

The link referred to on this post, is dead - https://forums.coronalabs.com/topic/62537-marching-ants-configurability/

I assume it’s supposed to point to the link above, but there’s no configurability documented there?

** Shaders on strokes

I’ve come up with this (likely terrible) shader - https://f25j6.app.goo.gl/LyEM - black/alpha for testing

I don’t know a lot about shaders - and I’m having a hell of a time getting it to apply to a newRoundedRect stroke.

local ants = {} ants.category = "generator" ants.name = "antspantz" ants.isTimeDependent = true ants.fragment = [[P\_COLOR vec4 FragmentKernel( P\_UV vec2 texCoord ){   vec4 CoronaVertexUserData = vec4(0,0,0,0);   P\_COLOR vec4 ret = vec4(0, 0, 0,     sin((CoronaTotalTime\*5.)+(texCoord.x\*50.)+(texCoord.y\*50.))   );   return CoronaColorScale(ret); }]] graphics.defineEffect( ants ) -- display.setDefault("background", .7, .7, .7) obj = display.newRoundedRect( 200, 200, 320, 320, 20 ) obj.fill = { 1,0,0,1 } obj.stroke = { 0,1,1,1 } obj.strokeWidth = 20 obj.stroke.effect = "generator.custom.antspantz"

produces different results in the simulator every time you run it ?!

change that last line to fill instead of stroke and it works - so I guess strokes are broken?  :frowning:

are you aware that the source is available?  i think if you simply replace the constant “1.0” alpha value of the returned color with the variable “gray” then it’ll effectively be a strokecolor-or-transparent effect (which seems like what you’re after).

Ahh, I was not aware, that will be useful thanks!

FYI: https://forums.coronalabs.com/topic/62537-marching-ants-configurability/ seems to work for me. It may have been a temporary outage.

Rob

Hi Rob, yes that page works - but the link referred to on that page, doesn’t.

i.e. how is the generator effect configurable?

are you aware that the source is available?  i think if you simply replace the constant “1.0” alpha value of the returned color with the variable “gray” then it’ll effectively be a strokecolor-or-transparent effect (which seems like what you’re after).

Ahh, I was not aware, that will be useful thanks!

FYI: https://forums.coronalabs.com/topic/62537-marching-ants-configurability/ seems to work for me. It may have been a temporary outage.

Rob

Hi Rob, yes that page works - but the link referred to on that page, doesn’t.

i.e. how is the generator effect configurable?