[ActionScript 3.0] using ColorTransform to achieve exposure transitions for objects (Pictures)

Source: Internet
Author: User

Original effect

Transition effect

This effect can be implemented with frame animation is relatively simple, only need to adjust the color effect of this movie clip inside the advanced options of the three channel values, the following code simple test, can be used as a document class:

1  Package2 {3     ImportCom.tweener.transitions.Tweener;4     ImportFlash.display.Loader;5     ImportFlash.display.SimpleButton;6     ImportFlash.display.Sprite;7     Importflash.events.Event;8     Importflash.events.MouseEvent;9     ImportFlash.geom.ColorTransform;Ten     Importflash.net.URLRequest; One     /** A      * ... - * @author Frostyen -      */ the   -      Public classColortransformexampleextendsSprite -     { -         Private varLdr:loader =NewLoader (); +         Private varSp:sprite =NewSprite (); -         Private varBtn:sprite =NewSprite (); +         Private varColortransform:colortransform =NewColorTransform (1, 1, 1, 1, 255, 255, 255, 0); A         Private varframe:int=15;//the number of frames equivalent to the movie clip animation at          Public functioncolortransformexample () { -Ldr.load (NewURLRequest ("Image/farewell-to-fall.jpg")); -Sp.transform.colorTransform =ColorTransform; -Btn.graphics.beginFill (0x666666); -Btn.graphics.drawRect (0, 0, 100, 50); - Btn.graphics.endFill (); inBtn.buttonmode =true; -btn.x = 700; toBTN.Y = 100; +              This. AddChild (BTN); -              This. AddChild (sp); the Sp.addchild (LDR); *Stage.framerate = 36;//Frame Frequency $    Panax Notoginseng Ldr.contentLoaderInfo.addEventListener (Event.complete, onimageloaded); - Btn.addeventlistener (Mouseevent.click, OnClick); the         } +    A         Private functionOnClick (e:mouseevent):void the         { + AddEventListener (Event.enter_frame, onEnter); -         } $    $         Private functionOnEnter (e:event):void -         { -             if(Colortransform.redoffset > 0) { theColortransform.redoffset-= 255/Frame -Colortransform.greenoffset-= 255/FrameWuyiColortransform.blueoffset-= 255/Frame theSp.transform.colorTransform =ColorTransform; -}Else { WuColorTransform =NewColorTransform (1, 1, 1, 1, 255, 255, 255, 0); - RemoveEventListener (Event.enter_frame, onEnter); About             } $         } -    -         Private functionOnimageloaded (e:event):void -         { A     +         } the     } -}

[ActionScript 3.0] using ColorTransform to achieve exposure transitions for objects (Pictures)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.