0

Corona Graphics 2.0: Composite.reflect

Posted by Dr. Burton on June 30, 2014 in Corona, Mobile |

While I have made an effort to document all of the composite, effects, and generators for Graphics 2.0 in my Corona books (see the Books tab above), there were a few that do not have a direct translation to a similar effect in Photoshop or other graphic editing tool.  Thus, I thought I would take this opportunity to provide a little bit of guidance for these effects.

In this post we will look at the composite.reflect effect.  To clearly see what was happening, I created a simple graphic to show the impact of light, dark, and grayed areas when the texture is applied to an image.
My base image is the book cover for Learning Mobile Application & Game Development with Corona.  The texture image is a simple png file that goes from red, to green, to blue, to grey.

LMGADCtexture2

 

 

 

 

The output of reflect is similar to using a colored light on an object.  The end product will show the color saturated with the texture color.

output

 

 

 

 

 

The Code Example

local object = display.newRect( 100, 100,600, 600)
object.x = display.contentCenterX
object.y = display.contentCenterY
-- Set up the composite paint (distinct images)
local compositePaint = {
    type="composite",
    paint1={ type="image", filename="LMGADC.png" },  -- bottom image
    paint2={ type="image", filename="texture2.png" }     -- top image
    }

-- Apply the composite paint as the object's fill
object.fill = compositePaint

-- Set a composite blend as the fill effect
object.fill.effect = "composite.reflect"
									

For more details about various composites, effects, and generators, check out Learning Mobile Application & Game Development with Corona!

 

 

 

 

Leave a Reply

Copyright © 2010-2017 Burtons Media Group All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.