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

リサージュ曲線 Lissajous curve

x座標とy座標を、周期フレームを設定した正弦関数で指定。
フェードアウトはビットマップデータのアルファ値を乗算して薄くしていってます。
インプットフォームは左から、
x軸方向の周期 (period_x)
  y軸方向の周期 (period_y)
    フェードアウト係数 (FOlapse)
を設定できます
Get Adobe Flash player
by KBM 20 Nov 2015
/**
 * Copyright KBM ( http://wonderfl.net/user/KBM )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/UcXZ
 */

package {

    import flash.geom.ColorTransform;
    import flash.text.TextField;
    import flash.geom.Rectangle;
    import flash.events.Event;
    import flash.display.Shape;
    import flash.geom.Point;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.display.Sprite;

    public class FlashTest extends Sprite {

        private var bm:Bitmap;
        private var bd:BitmapData;
        private var period_x:Number = 80; //x軸方向の周期(フレーム)
        private var period_y:Number = 120; //y軸方向の周期(フレーム)
        private var FOlapse:int = 15000; //フェードアウトにかかる時間に関係 大きいほど長い

        

        public function FlashTest() {

            var tx:InputText = new InputText();
            var ty:InputText = new InputText();
            var tl:InputText = new InputText();

            

            tx.text = String(period_x);
            tx.y = stage.stageHeight - tx.height - 20;
            tx.x = stage.stageWidth / 4;



            ty.text = String(period_y);
            ty.y = stage.stageHeight - ty.height - 20;
            ty.x = stage.stageWidth * 2 / 4;
            

            tl.text = String(FOlapse);
            tl.y = stage.stageHeight - tl.height - 20;
            tl.x = stage.stageWidth * 3 / 4;
            

            var sw:int = stage.stageWidth;
            var sh:int = stage.stageHeight;

            bd = new BitmapData(sw,sh,false,0x00000000);
            bm = new Bitmap(bd);
           
            
            var t:int = 0;
            var rect:Rectangle = new Rectangle(100,100,5,5);
            var colorTF:ColorTransform = new ColorTransform(1,1,1,1 - 1 / FOlapse,0,0,0,0)
            

            function enterFrame(e:Event):void{
                t ++;
                rect.x = bd.width / 2 + bd.width / 3 * Math.sin(2 * Math.PI * t / period_x);
                rect.y = bd.height / 2 + bd.height / 3 * Math.sin(2 * Math.PI * t / period_y);
                bd.fillRect(rect,0xaaFFdd);
                bd.colorTransform(bd.rect,colorTF);

            }

            

            addEventListener(Event.ENTER_FRAME,enterFrame);

            tx.addEventListener(Event.CHANGE,function ():void{
               if(int(tx.text) > 0) period_x = int(tx.text)})
            ty.addEventListener(Event.CHANGE,function ():void{
               if(int(ty.text) > 0) period_y = int(ty.text)})
            tl.addEventListener(Event.CHANGE,function ():void{
               if(int(tl.text) > 0) FOlapse = int(tl.text);
               colorTF = new ColorTransform(1,1,1,1 - 1 / FOlapse,0,0,0,0)})
               
            addChild(bm);
            addChild(tx);
            addChild(ty);
            addChild(tl);

        }

    }

        

    }

    import flash.text.TextFormat;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFieldType;

    class InputText extends TextField{

        public function InputText(){
            this.background = true;
            this.backgroundColor = 0xAAAAAA;
            this.border = true;
            this.autoSize = TextFieldAutoSize.LEFT;
            this.type = TextFieldType.INPUT;
            this.defaultTextFormat = new TextFormat(null,20,null,true)

        }
    }