Search code examples
actionscript-3flashtransitionalphatween

as3 wipe fade alpha using tween


Is it possible to fade the alpha with a soft wipe transition using as3 tween?

I thought maybe http://www.greensock.com might have the answer but I have found nothing. I would like the image to slowly fade away from one side to the other. A soft dissolve.

I thought maybe its possible using a mask but I don't think masks accept alphas otherwise it could be done that way.


Solution

  • Actually masks allow alphas. It's kind of a hack. You should try writing this in code:

    maskMC.cacheAsBitmap = true;
    objMC.cacheAsBitmap = true;
    objMC.mask = maskMC;
    

    Where objMC is your animated MovieClip and maskMC is your Mask that contains a gradient shape with transparency. See an example here: Link

    You can also achieve this effect using Greensock. Code would look like this:

    TweenLite.to(objMC, 1, {"alpha":0, "x":objMC.x + 10});
    

    When using TweenLite, you need to provide object to animate, duration of animation and an instance of an Object class (that's stuff we write between curly braces). This instance contains all the values we want to change gradually.