まる - 黒ベース Circller Scratch * by ish-xxxx ish_xxxx forked:6favorite:11lines:123license : All rights reserved modified : 2009-02-17 19:44:42 Embed Tweet /** * Circller Scratch * by ish-xxxx */ package { import flash.display.*; import flash.net.*; import flash.text.*; import flash.events.*; import flash.geom.*; import net.hires.debug.*; public class App extends Sprite { //SWF SETTING CONSTANTS////////////////// public static const BGCOLOR:uint = 0x020202; private const FRAMERATE:uint = 60; private const WIDTH:uint = 465; private const HEIGHT:uint = 465; /////////////////////////////////////////// //SWF SETTING VARS///////////////////////// private var CANVAS:Graphics; /////////////////////////////////////////// //CONSTANTS////////////////////////////// private const REPEAT:uint = 20; /////////////////////////////////////////// //VARS//////////////////////////////////// private var counter:uint = 0; /////////////////////////////////////////// public function App() { //CANVAS Setting//////////////////// stage.frameRate = FRAMERATE; CANVAS = graphics; CANVAS.beginFill( BGCOLOR , 1.0 ); CANVAS.drawRect( 0 , 0 , WIDTH , HEIGHT ); CANVAS.endFill(); //////////////////////////////////// init(); } private function init() : void { setup(); } private function setup() : void { // addEventListener( "enterFrame" , render ); } private function render( ev:Event ) : void { if( counter % 3 == 0 ) { for ( var i:uint = 0 ; i < REPEAT ; i++ ) { var c:Circle = new Circle(); c.addEventListener( Circle.TRANSITION_COMPLETE , erase , false , 0 , false ); c.x = mouseX; c.y = mouseY; addChild( c ); c.run(); } } counter++; } public function erase( ev:Event ) : void { var target:Circle = Circle( ev.currentTarget ); target.removeEventListener( Circle.TRANSITION_COMPLETE , erase ); removeChild( target ); target = null; } } } /////////////////////////////////////////////// //Optional Classes /////////////////////////////////////////////// import flash.display.*; import flash.events.*; import flash.filters.*; import caurina.transitions.Tweener; import caurina.transitions.properties.*; class Circle extends Shape { public static const TRANSITION_COMPLETE : String = "transitioncomplete"; private const MAX_WIDTH:uint = 30; private var target:DisplayObjectContainer; private var canvas:Graphics; public function Circle() : void { alpha = 0; DisplayShortcuts.init(); } public function run() : void { drawCanvas(); ( Utils.getRandom( 10 ) | 0 ) < 4 ? filters = [ Utils.getBlur() ] : filters = []; } private function drawCanvas() : void { var w:uint = Utils.getRandom( MAX_WIDTH ) | 0; canvas = graphics; canvas.beginFill( Utils.getColor() , 1.0 ); canvas.drawCircle( 0 , 0 , w ); canvas.endFill(); trans(); } private function trans() :void { Tweener.addTween( this , { x : Utils.getRandom( stage.stageWidth ) , y : Utils.getRandom( stage.stageHeight ) , alpha : 1 , _scale : 0 , time : 1 , transition : "easeInOutQuad" , onComplete : suiside } ); } private function suiside() : void { dispatchEvent( new Event( TRANSITION_COMPLETE ) ); } } class Utils { public function Utils() { //Can't Create Instance } public static function getColor() : uint { var ranR:String = String( uint( Math.random() * 255 | 0 ) ); var ranG:String = String( uint( Math.random() * 255 | 0 ) ); var ranB:String = String( uint( Math.random() * 255 | 0 ) ); var res:uint = uint( ranR + ranG + ranB ); return res; } public static function getRandom( threshold:Number ) : Number { var res:Number; res = Math.random() * threshold; return res; } public static function getBlur() : BlurFilter { var b:BlurFilter = new BlurFilter(); b.blurX = b.blurY = getRandom( 20 ) | 0; b.quality = BitmapFilterQuality.LOW; return b; } } Code Fullscreen Preview Fullscreen smallwind191.. alwAYs djankey FlashFit yasusic vexwex pippo micmac88 juvial hacker_fgear.. : circleパーティクル祭 clockmaker : きれい circle パーティクル祭 target SpreadMethod.REPEAT threshold Tweener.init filters dispatchEvent currentTarget BitmapFilterQuality.LOW graphics blurY blurX DisplayShortcuts.init transition DisplayObjectContainer frameRate removeEventListener quality removeChild mouseY mouseX sort new page view favorite forked pv499 forked from: まる - 黒ベース test12 forked:3 favorite:2lines:123 (diff:3) pv180 forked from: まる - 黒ベース kohie_yamashima forked:0 favorite:0lines:123 (diff:1) pv0 forked from: まる - 黒ベース ninjamygga forked:0 favorite:0lines:123 (diff:1) pv1689 気分転換に作り直し - particle ish_xxxx forked:0 favorite:16lines:130 (diff:142) tag: effect following particle pv257 forked from: まる - 黒ベース Nao forked:0 favorite:0lines:123 (diff:13) pv577 まる - 白ベース ish_xxxx forked:1 favorite:0lines:119 (diff:28)