I need to create a blur white border for an object.
Since the blur needs to be in all 4 directions, I was looking to use GradientPaint. But the directions mentioned are “down”, “up”, “left”, or “right”. Link
How do I define the properties, such that gradient color1 starts from the center and turns to color2 as it reaches the edges?
How about these?
local screen = { width = display.contentWidth, height = display.contentHeight,
centerX = display.contentCenterX, centerY = display.contentCenterY }
local object = display.newRect( screen.centerX, screen.centerY, screen.width - 100, screen.height - 100 )
object.fill.effect = "generator.linearGradient"
object.fill.effect.color1 = { 0.8, 0, 0.2, 1 }
object.fill.effect.position1 = { 0, 0.5 }
object.fill.effect.color2 = { 0, 0.5, 1, 1 }
object.fill.effect.position2 = { 1, 0.5 }
You can try different values for color and position to see the various gradient effects. Documentation is here, https://docs.coronalabs.com/guide/graphics/effects.html#generator.lineargradient
I tried using linearGradient, didn’t get the ideal outcome.
Looking for an effect such that, it’s opacity is maximum in the centre and reduces to 0 as it reaches the edges.
Anyway thanks @luantiang, I’ll explore linearGradient a bit more to get the result.