Gradients with transparency?

Alejandro Tejada capellan2000 at gmail.com
Mon Apr 3 18:41:25 EDT 2017


Hi Terry,

Terry Judd wrote:
> I want to overlay a graphic with a vertical gradient
> that blends from transparent to white to give the effect
> that the underlying content is fading out as you move
> down the screen. I’m able to achieve this effect using a
> black and white linear gradient in combination with the
> blendScreen ink but I need to be able to export the object
> (gradient plus underlying controls) as an image keeping the
> effect intact. When I export it now the ink effect is lost.

In LiveCode, there is another way to do this:

1- Import an Image without Transparency... or
create a snapshot of a group, vector graphic,
field, or any other control inside the card.

2A- Import a transparent PNG... or
2B- Take a snapshot of a vector graphic that
contains a Green to transparent gradient

For example:

on mouseUp
import snapshot from grc 1 with effects
end mouseUp

3- Put that transparent PNG on top of
the image without transparency...

4- Run this script from a button
to create a mask from PNG...

on mouseUp
set the locklocation of img 1 to true
import snapshot from img 1
set the loc of last img to the loc of img 1
delete img 1
-- after deleting img 1 (an image without transparency),
-- then img 2 (a transparent png) becomes img 1

crop img 2 to the rect of img 1

set the width of img 1 to the width of img 2
set the height of img 1 to the height of img 2

set the alphadata of image 2 to the alphadata of image 1
end mouseUp

Download a stack from this forum thread:
http://forums.livecode.com/viewtopic.php?f=10&t=28352

 Alphamask from Transparent PNG.livecode.zip (1k)

Al



More information about the use-livecode mailing list