/src/com/greensock/plugins/BlurFilterPlugin.as
ActionScript | 62 lines | 19 code | 4 blank | 39 comment | 1 complexity | 4ec4842693698d3a556985ddbb1f50e9 MD5 | raw file
1/**
2 * VERSION: 2.0
3 * DATE: 8/18/2009
4 * ACTIONSCRIPT VERSION: 3.0
5 * UPDATES AND DOCUMENTATION AT: http://www.TweenMax.com
6 **/
7package com.greensock.plugins {
8 import com.greensock.*;
9
10 import flash.filters.BlurFilter;
11/**
12 * Tweens a BlurFilter. The following properties are available (you only need to define the ones you want to tween):
13 * <code>
14 * <ul>
15 * <li> blurX : Number [0]</li>
16 * <li> blurY : Number [0]</li>
17 * <li> quality : uint [2]</li>
18 * <li> index : uint</li>
19 * <li> addFilter : Boolean [false]</li>
20 * <li> remove : Boolean [false]</li>
21 * </ul>
22 * </code>
23 *
24 * Set <code>remove</code> to true if you want the filter to be removed when the tween completes. <br /><br />
25 *
26 * <b>USAGE:</b><br /><br />
27 * <code>
28 * import com.greensock.TweenLite; <br />
29 * import com.greensock.plugins.TweenPlugin; <br />
30 * import com.greensock.plugins.BlurFilterPlugin; <br />
31 * TweenPlugin.activate([BlurFilterPlugin]); //activation is permanent in the SWF, so this line only needs to be run once.<br /><br />
32 *
33 * TweenLite.to(mc, 1, {blurFilter:{blurX:10, blurY:10}}); <br /><br />
34 * </code>
35 *
36 * <b>Copyright 2011, GreenSock. All rights reserved.</b> This work is subject to the terms in <a href="http://www.greensock.com/terms_of_use.html">http://www.greensock.com/terms_of_use.html</a> or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
37 *
38 * @author Jack Doyle, jack@greensock.com
39 */
40 public class BlurFilterPlugin extends FilterPlugin {
41 /** @private **/
42 public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
43 /** @private **/
44 private static var _propNames:Array = ["blurX","blurY","quality"];
45
46 /** @private **/
47 public function BlurFilterPlugin() {
48 super();
49 this.propName = "blurFilter";
50 this.overwriteProps = ["blurFilter"];
51 }
52
53 /** @private **/
54 override public function onInitTween(target:Object, value:*, tween:TweenLite):Boolean {
55 _target = target;
56 _type = BlurFilter;
57 initFilter(value, new BlurFilter(0, 0, value.quality || 2), _propNames);
58 return true;
59 }
60
61 }
62}