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

Demolish (I need to come up with a proper name)

I was so fed up about how to draw arcs indirectly from one point. Thanks to Sketchpad 5, I got the nasty answer. Here is a small example of me showing off my new skills. Har har.

ずっと、どうすれば間接的に点から弧(まがった線のこと)を書けるか悩んでいました。Sketchpad 5と言う幾何のソフトを使って、答えがわかりました。これは試作品です。
Get Adobe Flash player
by GreekFellows 26 May 2012

    Talk

    bradsedito at 06 Jul 2012 19:45
    Great work!

    Tags

    Arc
    Embed
/**
 * Copyright GreekFellows ( http://wonderfl.net/user/GreekFellows )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2BMi
 */

package 
{
    import flash.display.Sprite;
    import flash.events.Event;
    
    /**
     * ...
     * @author Greek Fellows
     * a project 2012
     * something about radial growth
     * 
     */
    public class Main extends Sprite 
    {
        private var array:Array;
        private var angles:Array;
        
        public function Main():void 
        {
            init();
        }
        
        private function init():void {
            this.array = [];
            this.angles = [];
            
            for (var cre:int = 0; cre < 50; cre++) {
                var cx:Number = 465/2;
                var cy:Number = 465/2;
                var angle:Number = Math.floor(Math.random() * 360);
                var radius:Number = Math.floor(Math.random() * 95) + 5;
                
                this.array.push( { cx:cx + Math.cos(angle * Math.PI / 180) * radius, cy:cy + Math.sin(angle * Math.PI / 180) * radius, radius:radius, speed:Math.floor(Math.random() * 10) - 5, goon:true, exceeded:false } );
                this.angles.push([angle-180]);
            }
            
            this.addEventListener(Event.ENTER_FRAME, demolish);
        }
        
        private function demolish(e:Event):void {
            this.graphics.clear();
            
            this.graphics.lineStyle(1, 0x000000, 1);
            for (var ind:int = 0; ind < this.array.length; ind++) {
                this.graphics.moveTo(this.array[ind].cx + Math.cos(this.angles[ind][0] * Math.PI / 180) * this.array[ind].radius, this.array[ind].cy + Math.sin(this.angles[ind][0] * Math.PI / 180) * this.array[ind].radius);
                for (var dind:int = 1; dind < this.angles[ind].length; dind++) {
                    this.graphics.lineTo(this.array[ind].cx + Math.cos(this.angles[ind][dind] * Math.PI / 180) * this.array[ind].radius, this.array[ind].cy + Math.sin(this.angles[ind][dind] * Math.PI / 180) * this.array[ind].radius);
                }
                
                if (this.array[ind].goon) {
                    this.angles[ind].push(this.angles[ind][this.angles[ind].length - 1] + this.array[ind].speed);
                }
                
                if (this.angles[ind].length >= 100) {
                    this.array[ind].exceeded = true;
                }
                
                if (this.array[ind].exceeded) {
                    this.angles[ind].splice(0, 1);
                    if (Math.floor(Math.random() * 100) == 0) {
                        this.array[ind].goon = false;
                    }
                }
            }
        }
        
    }
    
}