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

flash on 2010-4-24

autor :夏天的树人
Get Adobe Flash player
by summerTree 24 Apr 2010
    Embed
/**
 * Copyright summerTree ( http://wonderfl.net/user/summerTree )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/9W9F
 */

package 
{
	 //autor :夏天的树人
	import flash.display.Sprite;
	import flash.events.*;
	import flash.filters.GlowFilter;
    import com.bit101.components.HSlider;
 
	[SWF(width="550", height="400", backgroundColor="0x000000", frameRate="30")]
	public class Main extends Sprite
	{
		private   var rose:Rose;
		private var angle:Number=0;
		private var hslider:HSlider;
		public function Main()
		{
			init();
		}
		private function init():void
		{

			 rose=new Rose();//创建玫瑰线对象
			rose.CreatRose(200,7,Rose.ANGLE);
			addChild(rose);

			rose.x=stage.stageWidth/2;
			rose.y=stage.stageHeight/2;
           
		    //添加发光滤镜
			var glow:GlowFilter=new GlowFilter();
			glow.alpha=2;
			glow.blurX=150;
			glow.blurY=120;
			glow.color=0x00cc0c0;
			var array:Array=new Array();
			array.push(glow);
			rose.filters=array;
			hslider = new HSlider(this, 20, 20, onChange);
			addEventListener(Event.EXIT_FRAME,Run);

		
		}
         private function Run(event:Event):void
         {
         	rose.rotationY+=1;
         	
         } 
          
		 private function onChange(event:Event):void
         {
         	rose.clear();			 
			rose.CreatRose(200,hslider.value,Rose.ANGLE);
           
         }
	
		
		
	}
}

 
	//玫瑰线绘制
	import flash.display.Sprite;
	import flash.geom.Point;
	internal class Rose extends Sprite
	{
		public static  const RAD:String="rad";
		public static  const ANGLE:String="angle";
		public static  const ANGLE2:String="angle2";
		public function Rose()
		{
			this.graphics.moveTo(0,0);
		}
		//创建2D的玫瑰线
		public function CreatRose(r:Number,num:Number,type:String="rad",lens:int=1,count:int=360):void
		{
			var rad:Number;
			if (type==Rose.RAD)
			{
				rad=lens*Math.PI/180;//角度  
			}
			else if (type==Rose.ANGLE)
			{
				rad=lens;//角度
			}
			else if(type==Rose.ANGLE2)
			{
				 rad=lens*180/Math.PI;//角度  
			}
			for (var j:int=0; j<=count; j++)
			{
				var len:Number=r*Math.sin(num*rad*j);
				var point:Point=Point.polar(len,rad*j);
				drawPoint(point);
			}
		}
		//绘制玫瑰线
		public function drawRose(r:Number,angle:Number,num:int):void
		{
			var len:Number=r*Math.sin(num*angle);
			var point:Point=Point.polar(len,angle);
			drawPoint(point);
		}
		//描点
		private function drawPoint(point:Point):void
		{
			this.graphics.lineStyle(0,0xffffff);
			this.graphics.lineTo(point.x,point.y);
		}
		
		
		
		//清除图像
		public function clear():void
		{
			this.graphics.clear();
		}
	}