Transparent Stack

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Transparent Stack

Post by bidgeeman » Wed Jul 15, 2009 7:00 am

Hello.
I am trying to make a little desktop toy that is made up of an animated character that walks around on the desktop. I have a set of png images with Alpha channels for the animation but I cannot find out how to set the background of the stack to transparent. Anyone have any ideas other than using image masks to maks out the stack?

Many thanks
Bidge :)

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 8:42 am

Hi Bidge,

"windowshape" is what you are looking for, just like three days before:
http://forums.runrev.com/phpBB2/viewtopic.php?t=3353

:D

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Wed Jul 15, 2009 8:46 am

Hi Klaus.
Actually, what I would like is to be able to somehow adjust the Blend level of the background of the stack or card so that the .png is the only thing visible on the stack. I guess this is not possible though?

EDIT: Using the window shape means I have to double the amount of images I import into the stack, one for the image and 1 for te mask and then also make sure they match up perfectly. This is quite hard and time consuming. I thought there might be another possible way around this technique.

Cheers
Bidge

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Jul 15, 2009 9:21 am

You may well already have seen this, from what you mention above, but this RevUp article by Scott Rossi http://www.runrev.com/newsletter/may/is ... NW70S38853 should help you get to grips with everything involved here.

Also the mask image is not necessarily a duplicate image. You can just set the mask image by reference, ie you have imported the image you want to use as the window shape (the mask image). Then set the window shape to the id of the imported image. You don't have to do this with a separate image imported solely for making the window shape.
Last edited by SparkOut on Wed Jul 15, 2009 9:28 am, edited 1 time in total.

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 9:26 am

bidgeeman wrote:EDIT: Using the window shape means I have to double the amount of images I import into the stack, one for the image and 1 for te mask and then also make sure they match up perfectly. This is quite hard and time consuming. I thought there might be another possible way around this technique.

Cheers
Bidge
You only need ONE transparent PNG image which will act as the image AND the mask. So they will always match perfectly!

But see also SparkOut's link, Scott Rossi is THE graphics god! :)

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Jul 15, 2009 9:30 am

Snap Klaus! I just edited above to add that info to my previous post!

Snap or Schnapps?!

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 9:33 am

It is "Schnaps" (booze) in german :)

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Wed Jul 15, 2009 9:36 am

Sparkout....that was very useful. Thanks.
Klaus....If you have an animated image sequence where the shape changes constantly you also need a masking image sequence that matches the shape of each image. Just one image as a mask would only mask out the first image in the sequence but would not match the rest.

Cheers
Bidge

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Jul 15, 2009 9:38 am

Ja Klaus, das hab' ich gewusst, obwohl ich oft Fehler mache, das weiss ich auch!

and Bidge... there is some info about animated stacks in that same newsletter, just repeatedly set the windowshape of the stack to the new image reference on a timed basis. As Scott notes, if you keep all the images the same (rectangular) size regardless of the non-transparent image within the rect, then you avoid problems with having to control the window location versus the image location.

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 9:45 am

@SparkOut

hey your german is pretty good!


@Bidge

yes, but you were talking about PNG files and that format does not
(unfortunately) animation per se like the animated GIF format.

So I thought you would like to make an animation from PNG images***
like your animation inside of a button we were talking aboput a
couple of days before.

Which is definitviely possible and also looks very smooth!
Check some of Scott Rossi's examples on his website:
http://www.tactilemedia.com
-> Software ->Tutorials

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Wed Jul 15, 2009 9:51 am

Klause.
Thanks for the link. Yes you are right re: png images.The animation I am doing is more of a character based...I am just working on a stack now. I will post it to show you what I mean. Maybe there is something else you could suggets when you see it.

Cheers
Bidge

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Jul 15, 2009 9:58 am

If you have access to the "old" RevOnline (version 3.0 or lower) then also look for Malte Brille's info stack about "the disadvantages of gif images" with a comparison of animated gifs versus a step by step manipulation of png images to achieve smooth animation.

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Wed Jul 15, 2009 10:06 am

Oh...I'm not sure how to get to the old revonline...I wish I could. I bought my copy of Rev a couple of weeks ago so it has the latest version of revonline. I might email Malte and see if he could emal me a copy.

Thanks anyways

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Jul 15, 2009 10:13 am

Ah well, I'm sure there's a way.

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Wed Jul 15, 2009 11:10 am

Ok....here's a really rough Idea of what I'm trying to do....Klaus you will scream when you see my code :)

but it enough works to get the idea across. Although I'm getting some strange flickering in there that I can't explain.

http://www.errolgray.com.au/teststack.zip

Cheers
Bidge

Post Reply