Skip to content

Instantly share code, notes, and snippets.

@HoraceBury
Created April 27, 2015 05:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save HoraceBury/d3c6c0714077fa2eb725 to your computer and use it in GitHub Desktop.
Save HoraceBury/d3c6c0714077fa2eb725 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
@sysads
Copy link

sysads commented May 8, 2015

Hi

How do i use this code to create a drop shadow on an object?

Also is there a way one can create a show from side of object?

Thanks

@mk12345678910
Copy link

Where do I input this if I was using Jekyll now by Barry Clarke. Would it be in style.scss or elsewhere

@HoraceBury
Copy link
Author

@sysads This is used explicitly as is to create a shadow object by giving it dimensions.

@mk This is Lua code, not scss.

@scobatron
Copy link

Thank you for this code. It's easy to understand, simple to use, and offers good control. This helped me with my project, thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment