Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.

 

senocular.com ActionScript Library

InterpolateGlowFilter.as

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.senocular.gyro {

	import flash.filters.GlowFilter;
	
	public class InterpolateGlowFilter extends AbstractInterpolateFilter {
	
		public var target:GlowFilter;
		public var start:GlowFilter;
		public var end:GlowFilter;
			
		public function InterpolateGlowFilter(target:GlowFilter, start:GlowFilter = null, end:GlowFilter = null, owner:* = null, property:Object = null){
			this.target = target;
			this.start = (start) ? start : this.target;
			this.end = (end) ? end : this.start;
			
			super(owner, property);
		}
		
		public override function interpolate(t:Number):void {
			target.alpha = start.alpha + (end.alpha - start.alpha)*t;
			target.blurX = start.blurX + (end.blurX - start.blurX)*t;
			target.blurY = start.blurY + (end.blurY - start.blurY)*t;
			target.quality = int(start.quality + Math.round((end.quality - start.quality)*t));
			target.strength = start.strength + (end.strength - start.strength)*t;
			
			assign(target);
		}
	}
}