In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

辺がぼよよんってなる四角

Get Adobe Flash player
by a24 08 Mar 2009
package
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import caurina.transitions.Tweener;
        
        [ SWF( width = "465" , height = "465" , backgroundColor = "0xFFFFFF" , frameRate = "60" ) ]
        
	public class  Main extends Sprite
	{
		public function Main()
		{
			stage.addEventListener( MouseEvent.MOUSE_MOVE , create );
                }
		
		private function create( e:MouseEvent ):void 
		{
			var _cr:CurveRect = new CurveRect();
			_cr.x = stage.mouseX;
			_cr.y = stage.mouseY;
			_cr.scaleX = _cr.scaleY = Math.random();
			_cr.lineStyle( 1.0 , 0x999999 , 1.0 );
			_cr.beginFill( 0xE6E6E6 , 0.5 );
			_cr._width = 80;
			_cr._height = 80;
			_cr._round = Math.random() * 20; // 角丸値
			_cr._curve = -20; // 辺のカーブ値
			_cr.draw( true ); //基準点をセンターで描画
			addChild( _cr );
			
			Tweener.addTween( _cr , { 
				_curve:0 ,
				time:2 ,
				transition:"easeOutElastic",
				transitionParams: { period: 300, amplitude: 40 } ,
				onUpdate:function():void { _cr.draw( true ); } ,
                                onComplete:function():void{ removeChild( _cr ); }
				} );
				
			Tweener.addTween( _cr , {
				alpha:0 ,
				time:1.5 ,
                                delay:0.5
				} );
			
		}
	}
}



import flash.display.Sprite;
import flash.display.Graphics;

class CurveRect extends Sprite
{
	private var _g:Graphics;
	private var _lineStyle:Array;
	private var _beginFill:Array;
	public var _round:Number;
	public var _curve:Number;
	public var _width:Number;
	public var _height:Number;
	
	public function CurveRect()
	{
		_g = this.graphics;
		_lineStyle = [ 1 , 0x000000 , 1.0 ];
		_beginFill = [ 0xFFFFFF , 1.0 ];
		_round = 0;
		_curve = 0;
	}
	
	public function lineStyle( _thickness:Number , _color:uint , _alpha:Number ):void
	{
		_lineStyle = [ _thickness , _color , _alpha ];
	}
	
	public function beginFill( _color:uint , _alpha:Number ):void
	{
		_beginFill = [ _color , _alpha ];
	}
	
	public function draw( _center:Boolean = false  ):void
	{
		var _posX:Number = ( _center ) ?   _width/2 : 0;
		var _posY:Number = ( _center ) ? _height/2 : 0;
		
		_g.clear();
		_g.lineStyle( _lineStyle[0] , _lineStyle[1] , _lineStyle[2] );
		_g.beginFill ( _beginFill[0] , _beginFill[1] );
		
		_g.moveTo  ( 0 - _posX , _round - _posY );
		_g.curveTo ( 0 - _posX , 0 - _posY , _round - _posX , 0 -_posY );
		_g.curveTo ( _width/2 - _posX , -_curve - _posY , _width -_round - _posX , 0 - _posY );
		_g.curveTo ( _width - _posX , 0 - _posY , _width - _posX , _round - _posY );
		_g.curveTo ( _width + _curve - _posX , _height/2 - _posY , _width - _posX , _height -_round - _posY );
		_g.curveTo ( _width - _posX , _height - _posY , _width - _round - _posX , _height - _posY );
		_g.curveTo ( _width/2 - _posX , _height + _curve - _posY , _round - _posX , _height - _posY );
		_g.curveTo ( 0 - _posX , _height - _posY , 0 - _posX , _height - _round - _posY );
		_g.curveTo ( -_curve - _posX , _height/2 - _posY , 0 - _posX , _round - _posY );
		_g.endFill();
	}
}