More than one effect

Hi all,

How i can on a picture create several effects?

for example:

First applied grayscale then use composite.exclusion ?

You may need to use a snapshot (see: https://docs.coronalabs.com/api/library/display/newSnapshot.html) to create a new object to apply your next effect too.

Rob

Hey Rob, I could not understand how this works. it dumb for me .

please provide a sample? :unsure:

Did you follow the link to read the guide?    https://docs.coronalabs.com/guide/graphics/snapshot.html

This should explain what a snapshot is and how it works.  But basically you put things into a snapshot much like putting them into a group, but what you get out is a flattened image with all the things in the group being a single image.  Now with that single image, you can apply another fill effect.

local imageA = display.newRect( 100, 100, 100, 100 ) local paint = {     type = "gradient",     color1 = { 1, 0, 0.4 },     color2 = { 1, 0, 0, 0.2 },     direction = "down" } imageA.fill = paint local imageB = display.newSnapshot( 100, 100 ) imageB.x = 100 imageB.y = 100 imageB.group:insert( imageA ) local paint2 = {     type = "composite",     paint1 = { type="image", filename="wood.png" },     paint2 = { type="image", filename="dust.png" } } imageB.fill = paint2 imageB.effect = "composite.average"

or something like that.   Now at the end, imageB is your fully rendered image (untested code).

Rob

You could also experiment with this: Multi-pass effects

You may need to use a snapshot (see: https://docs.coronalabs.com/api/library/display/newSnapshot.html) to create a new object to apply your next effect too.

Rob

Hey Rob, I could not understand how this works. it dumb for me .

please provide a sample? :unsure:

Did you follow the link to read the guide?    https://docs.coronalabs.com/guide/graphics/snapshot.html

This should explain what a snapshot is and how it works.  But basically you put things into a snapshot much like putting them into a group, but what you get out is a flattened image with all the things in the group being a single image.  Now with that single image, you can apply another fill effect.

local imageA = display.newRect( 100, 100, 100, 100 ) local paint = {     type = "gradient",     color1 = { 1, 0, 0.4 },     color2 = { 1, 0, 0, 0.2 },     direction = "down" } imageA.fill = paint local imageB = display.newSnapshot( 100, 100 ) imageB.x = 100 imageB.y = 100 imageB.group:insert( imageA ) local paint2 = {     type = "composite",     paint1 = { type="image", filename="wood.png" },     paint2 = { type="image", filename="dust.png" } } imageB.fill = paint2 imageB.effect = "composite.average"

or something like that.   Now at the end, imageB is your fully rendered image (untested code).

Rob

You could also experiment with this: Multi-pass effects