BlurFilter-ColorMatrixFilter
...
@author pixelDevil
/**
* Copyright PixelDevil ( http://wonderfl.net/user/PixelDevil )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/fobz
*/
package {
import flash.display.MovieClip;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.MovieClip;
import flash.display.Shape;
import caurina.transitions.*;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.geom.Point;
/**
* ...
* @author pixelDevil
*/
[SWF(width="500", height="500", backgroundColor= 0x000000, frameRate="30")]
public class dancingColor extends MovieClip {
var circle1:Shape = new Shape ();
var circle2:Shape = new Shape ();
var circle3:Shape = new Shape ();
var circle4:Shape = new Shape ();
var bmd:BitmapData = new BitmapData(550, 400, true, 0x00000);
var bm:Bitmap = new Bitmap (bmd);
// FILTERS
var bf:BlurFilter = new BlurFilter (8, 8, 1);
var cmf:ColorMatrixFilter = new ColorMatrixFilter ([1, 0, 0, 0, 0, // red
0, 1, 0, 0, 0, // green
0, 0, 1, 0, 0, // blue
0, 0, 0, 0.9, 0,]); // alpha
// CONSTRUCTEUR
public function dancingColor () {
// CREATION OF 4 CIRCLEs SHAPE
// first
circle1.graphics.beginFill(0xea0011);
circle1.graphics.drawCircle(0, 380, 3); // circle red
this.addChild(circle1);
// second
circle2.graphics.beginFill(0x0000FF);
circle2.graphics.drawCircle(0, 380, 3); // circle blue
this.addChild(circle2);
// third
circle3.graphics.beginFill(0xe60fe9);
circle3.graphics.drawCircle(0, 380, 3); // circle purple
this.addChild(circle3);
// fourth
circle4.graphics.beginFill(0x0fe933);
circle4.graphics.drawCircle(0, 380, 3); // circle green
this.addChild(circle4);
addChild(bm);
// call mover function
mover();
// listener enter_frame
addEventListener(Event.ENTER_FRAME, loop);
}
// ADD EFFECT TO THE SCENE
private function loop(e:Event):void {
bmd.draw(this);
bmd.applyFilter(bmd, bmd.rect, new Point (0, 0), bf);
bmd.applyFilter(bmd, bmd.rect, new Point (0, 0), cmf);
bmd.scroll(0, -5); // direction de l'effet
}
// FUNCTION TWEENER TO MOVE THE SHAPE
private function mover():void {
Tweener.addTween(circle1, { x:200, time:1, onComplete:mover2 } );
Tweener.addTween(circle2, { x:250, time:1, onComplete:mover2 } );
Tweener.addTween(circle3, { x:300, time:1, onComplete:mover2 } );
Tweener.addTween(circle4, { x:250, time:1, onComplete:mover2 } );
}
// FUNCTION TWEENER TO REPLACE THE SHAPE
private function mover2():void {
Tweener.addTween(circle1, { x:250, time:1, onComplete:mover } );
Tweener.addTween(circle2, { x:200, time:1, onComplete:mover } );
Tweener.addTween(circle3, { x:250, time:1, onComplete:mover } );
Tweener.addTween(circle4, { x:300, time:1, onComplete:mover } );
}
}
}