forked from: まる2
"SKETCHNAME"
* by ish-xxxx
// forked from ish_xxxx's まる2
/**
* "SKETCHNAME"
* by ish-xxxx
*/
package {
import flash.display.*;
import flash.net.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
/**
* ...
* @author ish-xxxx
*/
public class App extends Sprite {
//SWF SETTING CONSTANTS//////////////////
private const BGCOLOR:uint = 0xFFFFFF;
private const FRAMERATE:uint = 45;
private const WIDTH:uint = 465;
private const HEIGHT:uint = 465;
///////////////////////////////////////////
//SWF SETTING VARS/////////////////////////
private var CANVAS:Graphics;
///////////////////////////////////////////
//CONSTANTS//////////////////////////////
///////////////////////////////////////////
//VARS////////////////////////////////////
///////////////////////////////////////////
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 {
var ty:Number = 0;
var count:int = 0;
var count2:uint = 0;
while ( ty <= HEIGHT + Circle.w) {
var tx:Number = Circle.w * count;
if ( tx > WIDTH + Circle.w ) {
tx = 0;
ty += Circle.w;
count = 0;
}
var c:Circle = new Circle(count2);
c.x = tx;
c.y = ty;
addChild( c );
c.run();
count++;
count2++;
}
setup();
}
private function setup() : void {
//
}
}
}
///////////////////////////////////////////////
//Optional Classes
///////////////////////////////////////////////
import flash.display.*;
import flash.net.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
import caurina.transitions.Tweener;
import caurina.transitions.properties.*;
class Circle extends Sprite {
private var canvas:Graphics;
private var _alpha:uint = 100;
public static var w:uint = 40
private var time : uint = 0;
private var dt:uint = 100;
private var r:uint;
public function Circle(i:uint) : void {
time = i;
init();
}
private function init() : void {
blendMode = BlendMode.INVERT;
canvas = graphics;
DisplayShortcuts.init();
r = Utils.getRandom(2) | 0;
setup();
}
private function setup() : void {
canvas.beginFill( Utils.getColor() , _alpha / 100 );
canvas.drawCircle( 0 , 0 , w );
}
public function run() : void {
scaleX == 0 ? Tweener.addTween( this , { _scale : 1 , time : 0.5 , delay : r, transition : "easeOutInExpo" , onComplete : run } ) : Tweener.addTween( this , { _scale : 0 , time : 0.5 , delay : r , transition : "easeOutBack" , onComplete : changeColor } ); ;
}
public function changeColor() : void {
canvas.clear();
canvas.beginFill( Utils.getColor() , _alpha / 100 );
canvas.drawCircle( 0 , 0 , w );
run();
}
}
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;
}
}