topical media & game development

talk show tell print

#graphic-flex-image-effects-07-source-aether-effects-shaders-SpherizeEffect.ax

#graphic-flex-image-effects-07-source-aether-effects-shaders-SpherizeEffect.ax [swf] [flash] flex


  package aether.effects.shaders {
  
          import aether.utils.MathUtil;
  
          import flash.geom.Point;
  
          public class @ax-graphic-flex-image-effects-07-source-aether-effects-shaders-SpherizeEffect extends ShaderEffect {
  
                  public static var shaderClass:String = "SpherizeKernel";
                  public static var shaderFile:String = "spherize.pbj";
  
                  private var _amount:Number;
                  private var _center:Point;
                  private var _radius:Number;
                  
                  public function @ax-graphic-flex-image-effects-07-source-aether-effects-shaders-SpherizeEffect(
                          center:Point,
                          radius:Number,
                          amount:Number=1,
                          blendMode:String=null,
                          alpha:Number=1
                  ) {
                          _shaderClass = shaderClass;
                          _shaderFile = shaderFile;
                          this.amount = amount;
                          this.radius = radius;
                          this.center = center;
                          init(blendMode, alpha);
                  }
                  
                  override protected function configureShader(data:Object):void {
                          data.center.value = [_center.x, _center.y];
                          data.radius.value =  [radius];
                          data.amount.value =  [amount];
                  }
                  
                  public function set amount(amount:Number):void {
                          _amount = MathUtil.clamp(amount, -1, 1);
                  }
  
                  public function set radius(radius:Number):void {
                          _radius = radius;
                  }
  
                  public function set center(center:Point):void {
                          _center = center;
                  }
  
          }
  
  }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.