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

Rose Animation2

前回のバラ曲線のアニメーションをラインのみにした
Get Adobe Flash player
by 178ep3 05 Jul 2009
/**
 * Copyright 178ep3 ( http://wonderfl.net/user/178ep3 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2dWL
 */

// forked from 178ep3's Rose Animation
// 前回のバラ曲線のアニメーションをラインのみにした
  
package 
{ 
    import flash.display.Sprite;
    import flash.events.Event; 
[SWF(width=465, height=465, frameRate=30, backgroundColor=0x000000)]     
    public class RoseAni extends Sprite 
    { 
    	private var _rose:Rose;
    	private var _n:Number=1;
    	private var _d:uint=1;
    	
        public function RoseAni() 
        { 
           _rose = addChild(new Rose(200))as Rose;
           _rose.x = stage.stageWidth/2;
           _rose.y = stage.stageHeight/2;
           addEventListener(Event.ENTER_FRAME,loop);
        } 
        
        private function loop(e:Event):void
        {
        	_rose.upD(_n,_d);
        	_n += 0.01;
        	if(_n>=8)
        	{
        		_n = 1;
        		_d++;
        		if(_d>=8)_d=1;
        	}
        }
    } 
} 
import flash.display.Shape; 
class Rose extends Shape 
{ 
	private var _rad:Number;
	
    public function Rose(radius:Number) 
    {
    	_rad = radius; 
    } 
    
    public function upD(n:Number,d:uint):void
    {
    	var c:Number = n/d; 
         
        this.graphics.clear();
        this.graphics.lineStyle(1,0xffffff);  
        this.graphics.moveTo(0,0); 
             
        for(var i:uint=0; i<360*d; i++) 
        { 
            var rad:Number = i * Math.PI /180; 
            var v:Number = Math.sin(c * rad); 
            var r:Number = _rad * v; 
                 
            var x:Number = r * Math.cos(rad); 
            var y:Number = r * Math.sin(rad); 
                 
            this.graphics.lineTo(x,y); 
        } 
        this.graphics.endFill(); 
    }
}