forked from: DOF
// forked from peko's DOF
// forked from Hitokita's 初Tweener
package{
import flash.display.*;
import caurina.transitions.properties.DisplayShortcuts;
import caurina.transitions.properties.FilterShortcuts;
import caurina.transitions.properties.CurveModifiers;
import net.hires.debug.Stats;
import flash.utils.setInterval;
import flash.filters.*;
import flash.geom.*;
public class Field extends Sprite{
private var canvas:Bitmap = new Bitmap(new BitmapData(stage.stageWidth,stage.stageHeight,true));
public function Field() {
FilterShortcuts.init();
DisplayShortcuts.init();
CurveModifiers.init();
// addChild(canvas);
// setInterval(drawCanvas, 30);
for (var i:uint = 0; i<50; i++){
var f:Fooler = new Fooler();
addChild(f);
f.foolAround();
}
var s:Stats = new Stats();
addChild(s);
}
private function drawCanvas():void {
canvas.bitmapData.draw(this);
canvas.bitmapData.applyFilter(canvas.bitmapData, canvas.bitmapData.rect, new Point(0), new BlurFilter(
4,4,2
));
canvas.bitmapData.applyFilter(canvas.bitmapData, canvas.bitmapData.rect, new Point(), new ColorMatrixFilter([
2, 0, 0, 0, -120,
0, 2, 0, 0, -120,
0, 0, 2, 0, -120,
0, 0, 0, 1, 0
]));
}
}
}
import flash.display.*;
import caurina.transitions.Tweener;
class Fooler extends Sprite {
private var tx:Number;
private var ty:Number;
private var tz:Number;
private var bx:Number;
private var by:Number;
private var bz:Number;
private var palette:Array = [0xCC0000, 0x000000,0x000000,0x000000,0x000000,0x000000];
public static var foolers:Array = [];
function Fooler()
{
x = 0;
y = 0;
z = 0;
// x = Math.random()*400;
// y = Math.random()*400;
// z = Math.random()*1000;
alpha = 0;
draw();
foolers.push(this);
}
private function draw():void{
var g:Graphics = graphics;
g.beginFill(palette[Math.floor(Math.random()*palette.length)], 0.75);
var r:Number = 10;//Math.random()*10+5;
g.drawCircle(0,0,r);
if (Math.random()<0.5) g.drawCircle(0,0,r+3);
g.endFill();
};
public function foolAround():void {
bx = Math.random()*stage.stageWidth;
by = Math.random()*stage.stageHeight;
bz = Math.random()*1000;
tx = Math.random()*stage.stageWidth;
ty = Math.random()*stage.stageHeight;
tz = Math.random()*1000;
var z:Number = Math.random();
Tweener.addTween(this,
{
x : tx,
y : ty,
z : tz,
_bezier : [{x:bx, y:by, z:bz}],
_scale : 0.5+0.5*z,
alpha : 0.5+0.5*z,
time : 15+Math.random()*5,
delay : Math.random()*5,
_Blur_blurX : Math.abs((0.75-z)*20),
_Blur_blurY : Math.abs((0.75-z)*20),
_Blur_quality : 2,
transition : 'easeoutelastic',
onComplete : foolAround
});
}
}