PageRenderTime 53ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

/src/com/greensock/plugins/BlurFilterPlugin.as

https://bitbucket.org/HopeSky/mars_nd2d
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. **/
  7. package com.greensock.plugins {
  8. import com.greensock.*;
  9. import flash.filters.BlurFilter;
  10. /**
  11. * Tweens a BlurFilter. The following properties are available (you only need to define the ones you want to tween):
  12. * <code>
  13. * <ul>
  14. * <li> blurX : Number [0]</li>
  15. * <li> blurY : Number [0]</li>
  16. * <li> quality : uint [2]</li>
  17. * <li> index : uint</li>
  18. * <li> addFilter : Boolean [false]</li>
  19. * <li> remove : Boolean [false]</li>
  20. * </ul>
  21. * </code>
  22. *
  23. * Set <code>remove</code> to true if you want the filter to be removed when the tween completes. <br /><br />
  24. *
  25. * <b>USAGE:</b><br /><br />
  26. * <code>
  27. * import com.greensock.TweenLite; <br />
  28. * import com.greensock.plugins.TweenPlugin; <br />
  29. * import com.greensock.plugins.BlurFilterPlugin; <br />
  30. * TweenPlugin.activate([BlurFilterPlugin]); //activation is permanent in the SWF, so this line only needs to be run once.<br /><br />
  31. *
  32. * TweenLite.to(mc, 1, {blurFilter:{blurX:10, blurY:10}}); <br /><br />
  33. * </code>
  34. *
  35. * <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.
  36. *
  37. * @author Jack Doyle, jack@greensock.com
  38. */
  39. public class BlurFilterPlugin extends FilterPlugin {
  40. /** @private **/
  41. public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
  42. /** @private **/
  43. private static var _propNames:Array = ["blurX","blurY","quality"];
  44. /** @private **/
  45. public function BlurFilterPlugin() {
  46. super();
  47. this.propName = "blurFilter";
  48. this.overwriteProps = ["blurFilter"];
  49. }
  50. /** @private **/
  51. override public function onInitTween(target:Object, value:*, tween:TweenLite):Boolean {
  52. _target = target;
  53. _type = BlurFilter;
  54. initFilter(value, new BlurFilter(0, 0, value.quality || 2), _propNames);
  55. return true;
  56. }
  57. }
  58. }