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

BitmapDataとMath.sin(), Math.cos()

BitmapDataとMath.sin(),Math.cos()でグラフを描こう
画面クリックで描画/非描画の切替え
Get Adobe Flash player
by geko 26 Aug 2010
    Embed
/**
 * Copyright geko ( http://wonderfl.net/user/geko )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/n722
 */

// BitmapDataとMath.sin(),Math.cos()でグラフを描こう
// 画面クリックで描画/非描画の切替え

package {
    import flash.display.*;
    import flash.events.*;
    
    public class FlashTest extends Sprite {
        
        public function FlashTest() {
            var bmd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
            var shape:Shape = new Shape();
            var i:Number = 0;
            var draw:Boolean = true;
            shape.graphics.beginFill(0xDD9900);
            shape.graphics.drawCircle(0, 0, 3);
            shape.graphics.endFill();
            addChild(new Bitmap(bmd));
            addChild(shape);
            
            addEventListener(Event.ENTER_FRAME, function loop(event:Event):void{
                shape.x = stage.stageWidth/2;// + Math.cos(Math.PI/2*i)*100;
                shape.y = stage.stageHeight/2 + Math.sin(Math.PI/2*i)*100;
                bmd.scroll(-2,0);
                if(draw) bmd.draw(stage);
                i += 0.05;
            });
            stage.addEventListener(MouseEvent.CLICK, function click(event:MouseEvent):void{
                draw = !draw;
            });
        }
    }
}