Ink Tween
// 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();
// s.alpha = 0.25;
// 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 bx:Number;
private var by:Number;
private var palette:Array = [0xCC0000, 0x000000, 0x000000, 0x002200, 0x000022, 0x220000, 0xFFFFFF,0xFFFFFF,0xFFFFFF, 0x0022CC];
public static var foolers:Array = [];
function Fooler() {
x = Math.random()*400;
y = Math.random()*400;
// alpha = 0;
draw();
foolers.push(this);
}
private function draw():void{
var g:Graphics = graphics;
g.beginFill(palette[Math.floor(Math.random()*palette.length)], 1);
g.drawCircle(0,0,Math.random()*10+5);
g.endFill();
};
public function foolAround():void {
bx = Math.random()*stage.stageWidth;
by = Math.random()*stage.stageHeight;
tx = Math.random()*stage.stageWidth;
ty = Math.random()*stage.stageHeight;
var z:Number = Math.random();
Tweener.addTween(this, {
x: tx,
y: ty,
_bezier: [{x:bx, y:by}],
_scale:0.5+0.5*z,
// alpha: 1,
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
});
}
}