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();
s.alpha = 0.7;
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;
import flash.text.TextField;
class Fooler extends Sprite {
private var tx:Number;
private var ty:Number;
private var bx:Number;
private var by:Number;
private var palette:Vector.<uint> = Vector.<uint>([0xCC0000, 0x000000, 0x000000, 0x000000, 0x003300, 0x000000]);
//private var palette:Array = [0xCC0000, 0x000000,0x000000,0x000000,0x003300,0x000000];
private var oneWordArr:Vector.<String> = Vector.<String>(["a", "t", "s", "u", "m", "o", "n", "e", "t"]);
//private var oneWordArr:Array = ["a", "t", "s", "u", "m", "o", "n", "e", "t"];
public static var foolers:Array = [];
//public static var foolers:Vector<Fooler> = [];
function Fooler() {
x = Math.random()*400;
y = Math.random()*400;
alpha = 0;
//draw();
drawText();
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 = Math.random()*10+5;
g.drawCircle(0,0,r);
if (Math.random()<0.5) g.drawCircle(0,0,r+3);
g.endFill();
};*/
private function drawText():void {
var oneWord:TextField = new TextField();
oneWord.text = oneWordArr[Math.floor(Math.random() * oneWordArr.length)];
oneWord.textColor = palette[Math.floor(Math.random() * palette.length)];
oneWord.cacheAsBitmap = true;
oneWord.scaleX = oneWord.scaleY = Math.random() * 4 + 1;
addChild(oneWord);
}
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: 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
});
}
}