Skip to content

Instantly share code, notes, and snippets.

@nadar71
Forked from HoraceBury/shadow.lua
Created July 8, 2016 07:56
Show Gist options
  • Save nadar71/afe3a2178f3c1fadc1d61d6a55404b8d to your computer and use it in GitHub Desktop.
Save nadar71/afe3a2178f3c1fadc1d61d6a55404b8d to your computer and use it in GitHub Desktop.
Create a drop shadow
local function shadow( width, height, size )
local g = display.newGroup()
g.x, g.y = display.contentCenterX, display.contentCenterY
display.newRect( g, 0, 0, width+size, height+size ).fill = {1,1,1,0}
display.newRect( g, 0, 0, width, height ).fill = {0,0,0}
local c = display.capture( g )
g = display.remove( g )
c.fill.effect = "filter.blurGaussian"
c.fill.effect.horizontal.blurSize = size
c.fill.effect.horizontal.sigma = size
c.fill.effect.vertical.blurSize = size
c.fill.effect.vertical.sigma = size
c.alpha = .3
return c
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment