1////////////////////////////////////////////////////////////////////////////////
2//
3//  ADOBE SYSTEMS INCORPORATED
4//  Copyright 2008 Adobe Systems Incorporated
5//  All Rights Reserved.
6//
7//  NOTICE: Adobe permits you to use, modify, and distribute this file
8//  in accordance with the terms of the license agreement accompanying it.
9//
10////////////////////////////////////////////////////////////////////////////////
11package spark.effects
12{
13import flash.utils.ByteArray;
14
15/**
16 *  The CrossFade effect uses Pixel Bender,
17 *  which is not supported for AIR mobile applications.
18 */
19[DiscouragedForProfile("mobileDevice")]
20
21/**
22 * The CrossFade effect performs a bitmap transition effect by running a
23 * <i>crossfade</i> between the first and second bitmaps.
24 * The crossfade blends the two bitmaps over the duration of the
25 * animation.
26 *
27 * <p>At any point in the animation, where the
28 * elapsed and eased fraction of the animation is <code>f</code> and the pixel
29 * values in the first and second bitmaps are <code>v1</code> and <code>v2</code>,
30 * the resulting pixel value <code>v</code> for any pixel in the image is:</p>
31 *
32 * <pre>v = v1 &#42; (1 - f) + v2 &#42; f</pre>
33 *
34 * <p>The bitmap effect is run by a pixel-shader program
35 * that is loaded by the effect.
36 * You can specify a different crossfade behavior by specifying
37 * a pixel-shader program to the <code>shaderByteCode</code> property.
38 * That pixel-shader program must meet the requirements defined in the
39 * AnimateTransitionShader effect. </p>
40 *
41 * @see spark.effects.AnimateTransitionShader
42 * @see spark.effects.AnimateTransitionShader#shaderByteCode
43 *
44 *  @includeExample examples/CrossFadeExample.mxml
45 *
46 *  @langversion 3.0
47 *  @playerversion Flash 10
48 *  @playerversion AIR 1.5
49 *  @productversion Flex 4
50 */
51public class CrossFade extends AnimateTransitionShader
52{
53    [Embed(source="CrossFade.pbj", mimeType="application/octet-stream")]
54    private static var CrossFadeShaderClass:Class;
55    private static var crossFadeShaderCode:ByteArray = new CrossFadeShaderClass();
56
57    /**
58     *  Constructor.
59     *
60     *  @param target The Object to animate with this effect.
61     *
62     *  @langversion 3.0
63     *  @playerversion Flash 10
64     *  @playerversion AIR 1.5
65     *  @productversion Flex 4
66     */
67    public function CrossFade(target:Object=null)
68    {
69        super(target);
70        // Note that we do not need a separate CrossFadeInstance; the only
71        // addition that CrossFade adds is specifying the Crossfade
72        // Pixel Bender shader. Everything else needed is in the
73        // superclass already.
74        shaderByteCode = crossFadeShaderCode;
75    }
76
77}
78}
79