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

水滴みたいに見えるかしら

久々に来てみたらエディタが進化しててビックリ。
Get Adobe Flash player
by knd 19 Oct 2010
    Embed
/**
 * Copyright knd ( http://wonderfl.net/user/knd )
 * GNU General Public License, v3 ( http://www.gnu.org/licenses/quick-guide-gplv3.html )
 * Downloaded from: http://wonderfl.net/c/qx02
 */

package {
     import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BitmapDataChannel;
    import flash.display.GradientType;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.filters.BitmapFilterQuality;
    import flash.filters.BlurFilter;
    import flash.filters.DropShadowFilter;
    import flash.geom.Matrix;
    import flash.geom.Point;
    import flash.media.Camera;
    import flash.media.Video;
    public class FlashTest extends Sprite {
        private static const _BLUR_RADIUS:uint = 12.0;
        private static const _PT0:Point = new Point();
        private static const _BLUR:BlurFilter = new BlurFilter(_BLUR_RADIUS, _BLUR_RADIUS, BitmapFilterQuality.LOW);
        private static const _SHADOW_IN:DropShadowFilter = new DropShadowFilter(4, 270, 0, 0.25, 4, 4, 1, BitmapFilterQuality.MEDIUM, true, true);
        private static const _SHADOW_OUT:DropShadowFilter = new DropShadowFilter(2, 90, 0, 0.5, 4, 8, 1, BitmapFilterQuality.MEDIUM, false, true);
        private static const _HIGHLIGHT:DropShadowFilter = new DropShadowFilter(2, 90, 0xffffff, 0.75, 4, 8, 1, BitmapFilterQuality.MEDIUM, true, true);
        private static const _HIGHLIGHT2:DropShadowFilter = new DropShadowFilter(1, 80, 0xffffff, 0.9, 1, 1.5, 1, BitmapFilterQuality.MEDIUM, true);
        private static const _ALPHA_MAP:Array = [];
        
        private static var _s_i: int = 0;
        private static var _s_a: uint = 0;
        {
            for (; _s_i< 121; _s_i++) 
            {
                _ALPHA_MAP.push(0);
            }
            for (_s_i = 0; _s_i < 14; _s_i++)
            {
                _s_a += 0x11000000;
                _ALPHA_MAP.push(_s_a);
            }
            for (_s_i = 0; _s_i< 121; _s_i++) 
            {
                _ALPHA_MAP.push(0xff000000);
            }
        }
        public function FlashTest() {
            // write as3 code here..
             var _w:Number = 240;
            var _h:Number = _w;
            var _camera:Camera = Camera.getCamera();
            _camera.setMode(_w, _h, 30);
            var _video:Video = new Video(_w, _h);
            _video.attachCamera(_camera);
            
            var _canvas:BitmapData = new BitmapData(_w, _h);
            var _innerShadow:BitmapData = new BitmapData(_w, _h, true, 0);
            var _outerShadow:BitmapData = new BitmapData(_w, _h, true, 0);
            var _highLight:BitmapData = new BitmapData(_w, _h, true, 0);

            var mat:Matrix = new Matrix();
            mat.createGradientBox(_w, _h, Math.PI/2);
            graphics.beginGradientFill(GradientType.LINEAR, [0x8096080, 0x90cbab], [1.0, 1.0], [0, 255], mat);
            graphics.drawRect(0, 0, _w, _h);
            graphics.endFill();
            addChild(new Bitmap(_canvas));
            addEventListener(Event.ENTER_FRAME, 
                function(e:Event):void 
                {
                    _canvas.draw(_video);
                    _canvas.applyFilter(_canvas, _canvas.rect, _PT0, _BLUR);
                    _canvas.copyChannel(_canvas, _canvas.rect, _PT0, BitmapDataChannel.GREEN, BitmapDataChannel.ALPHA); 
                    _canvas.paletteMap(_canvas, _canvas.rect, _PT0, null, null, null, _ALPHA_MAP);
                    _innerShadow.applyFilter(_canvas, _canvas.rect, _PT0, _SHADOW_IN);
                    _outerShadow.applyFilter(_canvas, _canvas.rect, _PT0, _SHADOW_OUT);
                    _highLight.applyFilter(_canvas, _canvas.rect, _PT0, _HIGHLIGHT);
                    _highLight.applyFilter(_highLight, _highLight.rect, _PT0, _HIGHLIGHT2);
                    _canvas.fillRect(_canvas.rect, 0x0);
                    _canvas.draw(_innerShadow);
                    _canvas.draw(_outerShadow);
                    _canvas.draw(_highLight);
                } 
            );
            
            scaleX = scaleY = 465.0 / _w;
           
        }
    }
}