Package | spark.effects |
Class | public class AnimateTransitionShader |
Inheritance | AnimateTransitionShader ![]() ![]() ![]() ![]() |
Subclasses | CrossFade, Wipe |
Language Version: | ActionScript 3.0 |
Product Version: | Flex 4 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
![]() | The AnimateTransitionShader effect uses Pixel Bender, which is not supported for AIR mobile applications. |
The AnimateTransitionShader effect animates a transition between two bitmaps, one representing the start state (
bitmapFrom
), and
the other representing the end state (bitmapTo
).
The animation is performed by running a pixel-shader program,
specified by the shader
property,
using the two bitmaps as input.
The bitmaps are represented by an instance of the flash.display.BitmapData class.
You can create your own pixel-shader program
by using Adobe Pixel Bender Toolkit.
If either bitmap is not supplied, that value is determined dynamically from either the appropriate state of the target in a transition or, if the effect is not running in a transition, from the target directly. If the effect is run in a transition and the target object either goes away or comes into existence during that state change, then a fully-transparent bitmap is used to represent that object when it does not exist.
This effect can only be run on targets that are either UIComponents or GraphicElements, since capturing the bitmap of the object requires information about the object that only exists in these classes.
Because the effect is bitmap-based, and the underlying pixel-shader program expects both bitmaps to be the same size, the effect only works correctly when both bitmaps are of the same size. This means that if the target object changes size or changes orientation leading to a different size bounding box, then the effect might not play correctly.
This effect and its subclasses differ from other effects in Flex in that they are intended to work on their own, and may not have the intended result when run in parallel with other effects. This constraint comes from the fact that both of the before and after bitmaps are captured before the start of the effect. So if something happens to the target object after these bitmaps are calculated, such as another effect changing the target's properties, then those changes are not be accounted for in the pre-calculated bitmap and the results might not be as expected. To ensure correct playing of these bitmap-based effects, they should be played alone on their target objects.
MXML Syntax
The <s:AnimateTransitionShader>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<s:AnimateTransitionShader Properties id="ID" bitmapFrom="no default" bitmapTo="no default" shaderByteCode="no default" sahderProperties="no default" />
Default MXML PropertymotionPaths
Related API Elements
spark.effects.supportClasses.AnimateTransitionShaderInstance
spark.primitives.supportClasses.GraphicElement
Property | Defined By | ||
---|---|---|---|
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object |
Method | Defined By | ||
---|---|---|---|
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | |
![]() |
Dispatches an event into the event flow. | EventDispatcher | |
![]() |
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | |
![]() |
Indicates whether an object has a specified property defined. | Object | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
Removes a listener from the EventDispatcher object. | EventDispatcher | |
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
![]() |
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
![]() |
Returns the string representation of the specified object. | Object | |
![]() |
Returns the primitive value of the specified object. | Object | |
![]() |
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"> <s:states> <s:State name="default"/> <s:State name="flipped"/> </s:states> <s:transitions> <s:Transition id="t1"> <s:AnimateTransitionShader target="{holder}" duration="1000" shaderByteCode="@Embed(source='assets/twist.pbj', mimeType='application/octet-stream')"/> </s:Transition> </s:transitions> <s:Panel title="AnimateTransitionShader Example" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:HGroup width="100%" height="100%" top="5" left="5" right="5"> <s:Group id="holder"> <s:BitmapImage source="@Embed('assets/back2.png')" visible="true" visible.flipped="false"/> <s:BitmapImage source="@Embed('assets/c2.png')" visible="false" visible.flipped="true"/> </s:Group> <!-- Directions --> <s:VGroup id="detailsBox" width="50%" left="0"> <s:Label width="99%" color="blue" text="AnimateShaderTransition animates a shader between two images. Click the 'Animate Shader' button to see the effect."/> </s:VGroup> </s:HGroup> <s:Rect left="0" right="0" bottom="0" height="30"> <s:fill> <s:LinearGradient rotation="90"> <s:GradientEntry color="0xE2E2E2" /> <s:GradientEntry color="0xD9D9D9" /> </s:LinearGradient> </s:fill> </s:Rect> <s:Button id="playButton" left="5" bottom="5" label="Animate Shader" click="currentState = (currentState == 'flipped') ? 'default' : 'flipped';"/> </s:Panel> </s:Application>
Wed Nov 21 2018, 06:34 AM -08:00