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

[ff]: Revolution

/**
 * Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/efGU
 */






package
{
    import flash.display.Sprite;
    
    [SWF(width="600",height="600",frameRate="120")]


    public class Main extends Sprite
    {
        private const WIDTH  :Number  =  stage.stageWidth;   //600;
        private const HEIGHT :Number  =  stage.stageHeight;  //600;

        
        public function Main()
        {
            var s:Sprite = new Revolution( 160 );
            stage.addChild(s);
            s.x = WIDTH / 2;
            s.y = HEIGHT / 2;
        }
    }
}



import flash.display.Sprite;
import flash.events.Event;
class Revolution extends Sprite
{
    private var ball:Sprite = new Sprite();
    private var circleLine:Sprite = new Sprite();
    private var xLine:Sprite = new Sprite();
    private var yLine:Sprite = new Sprite();
    private var earth:Sprite = new Sprite();
    private var circleSize:Number = 100;
    private var count:Number = 0;
    private var angle:Number = 0;
    
    public function Revolution(_radius:Number=100)
    {
        circleSize = _radius ;
        
        circleLine.graphics.lineStyle( 0.5,0x131413,0.6,true );
        circleLine.graphics.drawCircle(0,0,circleSize);
        circleLine.graphics.endFill();
        
        earth.graphics.beginFill( 0xFF0000,0.6 );
        earth.graphics.drawCircle( 0,0,circleSize/10 );
        earth.graphics.endFill();
        
        ball.graphics.lineStyle( 0.6,0x131413,0.5);
        ball.graphics.beginFill( 0x000000,0.6 );
        ball.graphics.drawCircle(0,0,circleSize/30);
        ball.graphics.endFill();
        
        xLine.graphics.lineStyle(2,0x000000);
        xLine.graphics.moveTo(0,-circleSize -circleSize/4);
        xLine.graphics.lineTo(0,circleSize +circleSize/4);
        
        yLine.graphics.lineStyle(2,0x000000);
        yLine.graphics.moveTo(-circleSize -circleSize/4,0);
        yLine.graphics.lineTo(circleSize +circleSize/4,0);
        
        addChild(circleLine);
        addChild(earth);
        addChild(xLine);
        addChild(yLine);
        addChild(ball);
        
        addEventListener(Event.ENTER_FRAME,onEnterFrame);
    }
    
    private function onEnterFrame(e:Event):void
    {
        angle = count * Math.PI / 180;
        
        ball.x = Math.cos(angle) * circleSize;
        ball.y = Math.sin(angle) * circleSize;
        
        xLine.x = Math.cos(angle) * circleSize;
        yLine.y = Math.sin(angle) * circleSize;
        
        count++;  
        //count++;
    }
}