flash on 2011-1-4
BlendMode.ADDのテスト
/**
* Copyright takashi08 ( http://wonderfl.net/user/takashi08 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/l3ZS
*/
// forked from KoheiTAKAMIYA's BlendMode.ADDのテスト
//BlendMode.ADDのテスト
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.easing.*;
import org.libspark.betweenas3.tweens.*;
[SWF(backgroundColor="0x000000")]
public class FlashTest extends Sprite{
public function FlashTest() {
Wonderfl.capture_delay(5);
stage.addEventListener(MouseEvent.CLICK, drawCircle);
//ProjectNyaさんのコメントの通り
//背景を黒く塗ってみる
this.graphics.beginFill(0x000000);
this.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
this.graphics.endFill();
}
public function drawCircle(event:MouseEvent):void{
for(var i:int = 0;i < 10;i++){
var circle:BlendModeTest = new BlendModeTest();
circle.x = mouseX;
circle.y = mouseY;
this.addChild(circle);
var spreadTween:ITween = BetweenAS3.tween(circle,{scaleX:2,scaleY:2,_blurFilter:{blurX: 10, blurY: 10}},null,0.3);
//var totalTween:ITween = BetweenAS3.serial(spreadTween,hideTween);
spreadTween.play();
spreadTween.onComplete = completeHanlder;
spreadTween.onCompleteParams = [circle];
}
}
private function completeHanlder(obj:Object):void{
var hideTween:ITween = BetweenAS3.tween(obj,{scaleX:3,scaleY:3,_blurFilter:{blurX: 0, blurY: 0}},null,1);
hideTween.play();
// obj.visible = false;
}
}
}
import flash.text.TextField;
import flash.display.Sprite;
import flash.display.BlendMode;
import flash.filters.BlurFilter;
import flash.text.*;
class BlendModeTest extends Sprite{
private var blur:BlurFilter = new BlurFilter(10,10,3);
public function BlendModeTest(color:uint = 0x000000){
if(color == 0x000000) color = Math.round(Math.random()*0xffffff);
//this.graphics.lineStyle(5,color,0.8);
this.graphics.beginFill(color,0.5);
this.graphics.drawCircle(1+Math.round(Math.random()*30),1+Math.round(Math.random()*20),1+Math.round(Math.random()*2));
this.graphics.endFill();
this.filters = [blur];
this.blendMode = BlendMode.ADD;
var tf:TextField = new TextField();
addChild(tf);
tf.textColor = color;
tf.text = "text";
}
}