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

forked from: forked from: Saqoosha challenge for amateurs

鳥のつもり
CHECKMATE参加作品ではありません
/**
 * Copyright awef ( http://wonderfl.net/user/awef )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/doKU
 */

// forked from awef's forked from: Saqoosha challenge for amateurs
// forked from checkmate's Saqoosha challenge for amateurs
package
{
    //鳥のつもり
    //CHECKMATE参加作品ではありません
    
    import flash.display.Sprite;
    import gs.TweenMax;
    import gs.easing.*;
    
    [SWF(width=465, height=465, backgroundColor=0xeeeeec, frameRate=60)]
    public class main extends Sprite
    {
        public function main()
        {
            var grad:Gradation = new Gradation(0xff0000, 0xff4400, 0xffbb00, 0xbbbb00, 0x00bb00, 0x0000ff);
            var color:uint;
            var delay:Number;
            var sp:Sprite;
            var spsp:Sprite;
            for (var i:int = 0; i < 75; i++)
            {
                sp = new Sprite();
                sp.x = -20;
                sp.y = Math.random() * 200 + 100;
                sp.rotation = -20;
                color = grad.getColor((sp.y - 100) / 200);
                //ボディ
                sp.graphics.beginFill(color);
                sp.graphics.drawRect(-10, -5, 20, 10);
                sp.graphics.endFill();
                //目
                sp.graphics.beginFill(0xeeeeec);
                sp.graphics.drawCircle(4, -1, 2);
                sp.graphics.endFill();
                //羽
                spsp = new Sprite();
                spsp.x = -5;
                spsp.graphics.beginFill(color);
                spsp.graphics.drawRect(0, 0, 10, 12);
                spsp.graphics.endFill();
                sp.addChild(spsp);
                
                addChild(sp);
                
                delay= Math.random() * 3;
                //はばたき
                TweenMax.to(spsp, 0.2, { delay : delay, yoyo : 0, rotationX : 180, ease : Linear.easeNone } );
                //飛行
                TweenMax.to(sp, 3, { delay : delay, loop : 0, x : 465 + 20, y : sp.y + Math.random() * 60 - 30, ease : Linear.easeNone } );
            }
        }
    }
}

import frocessing.color.ColorLerp;

import org.libspark.betweenas3.core.easing.IEasing;
import org.libspark.betweenas3.easing.Linear;

class Gradation {
    
    private var _colors:Array;
    private var _easing:IEasing;
    
    public function Gradation(...args) {
        _colors = args.concat();
        _easing = Linear.linear;
    }
    
    public function setEasing(easing:IEasing):void {
        _easing = easing;
    }
    
    public function getColor(position:Number):uint {
        position = (position < 0 ? 0 : position > 1 ? 1 : position) * (_colors.length - 1);
        var idx:int = position;
        var alpha:Number = _easing.calculate(position - idx, 0, 1, 1);
        if (alpha == 0) {
            return _colors[idx];
        } else {
            return ColorLerp.lerp(_colors[idx], _colors[idx + 1], alpha);
        }
    }
}