Tweening transition of Brightness in ActionScript with Tweener

来源:互联网 发布:南水北调 知乎 编辑:程序博客网 时间:2024/06/10 07:08

The trial is designed  for e-Notice project. And the target is to transit the brightness of a MovieClip, it is now can be done with Tweener pretty simply.


Here is a download link for Tweener from its Google Project home page:


http://code.google.com/p/tweener/downloads/list


This is the link of document for brightness:

http://hosted.zeh.com.br/tweener/docs/en-us/properties/ColorShortcuts.html


Snapshot:


trans-brightness


Here are the AS code on the timeline:

  

import flash.display.Loader;import flash.net.URLRequest;import flash.events.Event;import flash.events.MouseEvent;import caurina.transitions.Tweener;import caurina.transitions.properties.ColorShortcuts;import caurina.transitions.Equations;var ldr:Loader;var rqt:URLRequest;var lnk:String = "assets/3.jpg";init();function init():void{ColorShortcuts.init();ldr = new Loader();rqt = new URLRequest(lnk);ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);ldr.load(rqt);}function imgLoaded(e:Event):void{imgHolder.addChild(Loader(e.target.loader));transBtnessBtn.addEventListener(MouseEvent.CLICK, onTrans);}function onTrans(me:MouseEvent):void{Tweener.addTween( imgHolder, {time:1.8, _brightness:-2.5,transition:Equations.easeOutBack}  ); }


Link For Fla file:

transition_brightness


reference


http://www.websector.de/blog/2007/08/28/tweener-as3-extension-for-color-properties-_brightness-_contrast-and-_saturation/

http://www.flycan.com.tw/board/modules/newbb/viewtopic.php?topic_id=1210