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

wakabaBox

Get Adobe Flash player
by hacker_cobulht0 01 Nov 2011
/**
 * Copyright hacker_cobulht0 ( http://wonderfl.net/user/hacker_cobulht0 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/nKVR
 */

package{    
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;

    [SWF(width = "465", height = "465", backgroundColor = 0x222222, frameRate = "60")]

    public class wakabaBox extends Sprite{
        
        private var container:Sprite;
        private var bmpd:BitmapData;
        private var myArr:Array=new Array();
        
        private var dice1:Sprite=new Sprite();
        private var dice2:Sprite=new Sprite();
        private var dice3:Sprite=new Sprite();
        private var dice4:Sprite=new Sprite();
        private var dice5:Sprite=new Sprite();
        private var dice6:Sprite=new Sprite();
        
        private var _change:Number = 1; 
        private var _radius:Number = 120;
        private var _angel:Array=[0,90,180,270];
        private var kakudoXM:Number=0;
        private var kakudoYM:Number=60;
        private var kakudoX:Number =0;
        private var kakudoY:Number =60;
        private var Ippen = Math.sqrt(2*_radius*_radius);

        public function wakabaBox(){init();}

        private function init():void{
            container = new Sprite();            
            bmpd = new BitmapData(465,465, false, 0xFF000000 );addChild(new Bitmap(bmpd));             
            
            for(var j:int=0; j < 8; j++){
                var _petal:_Leaf_ = new _Leaf_(j);
                _petal.kakudo= _angel [j%4];
                myArr.push(_petal);
                addChild(_petal);
            }
            container.addChild(dice1);container.addChild(dice2);container.addChild(dice3);container.addChild(dice4);container.addChild(dice5);container.addChild(dice6);
            addEventListener(Event.ENTER_FRAME, drawPoint);
        }

        private var colorTransform:ColorTransform = new ColorTransform(1,1,1,1,-10,-10,-10);//(1,1,1,1,-8,-6,-4);
        
        private function drawPoint(e:Event):void{drawFace();
            //ちょっとづつ暗くする
            bmpd.colorTransform( bmpd.rect, colorTransform );
            bmpd.draw(container);
            
            for(var j:int=0; j < 8; j++){
                var dots = myArr[j];
                kakudoXM = mouseX;
                kakudoYM = mouseY;
                kakudoX += (kakudoXM-kakudoX)/10;
                kakudoY += (kakudoYM-kakudoY)/10;
                var Center:Number = Math.sin(kakudoY*Math.PI/180)*Ippen/2;
                var Radian1:Number = (kakudoY+45)*Math.PI/180;
                var Radian2:Number = (kakudoY-45)*Math.PI/180;
                var henpei:Number = (Math.sin(Radian1)-Math.sin(Radian2))*_radius/Ippen;
                var theKakudo:Number = dots.kakudo+kakudoX;
                var theRadian:Number = theKakudo*Math.PI/180;
                    dots.x = Math.cos(theRadian)*_radius +mouseX;
                    if(j>3){
                        dots.y = Math.sin(theRadian)*_radius*henpei+Center +mouseY;
                    }else{
                        dots.y = Math.sin(theRadian)*_radius*henpei-Center +mouseY;
                    }
                dots.kakudo+=_change;
            }
        }
        private function drawFace():void{
                dice1.graphics.clear();                            
                dice1.graphics.beginFill(0xF0F0B0,0.5);
                dice1.graphics.moveTo(myArr[0].x,myArr[0].y);
                dice1.graphics.lineTo(myArr[1].x,myArr[1].y);
                dice1.graphics.lineTo(myArr[2].x,myArr[2].y);
                dice1.graphics.lineTo(myArr[3].x,myArr[3].y);
                dice1.graphics.lineTo(myArr[0].x,myArr[0].y);
                dice1.graphics.endFill();
                
                dice2.graphics.clear();                            
                dice2.graphics.beginFill(0xE3DA37,0.5);
                dice2.graphics.moveTo(myArr[4].x,myArr[4].y);
                dice2.graphics.lineTo(myArr[5].x,myArr[5].y);
                dice2.graphics.lineTo(myArr[6].x,myArr[6].y);
                dice2.graphics.lineTo(myArr[7].x,myArr[7].y);
                dice2.graphics.lineTo(myArr[4].x,myArr[4].y);
                dice2.graphics.endFill();
                
                dice3.graphics.clear();                            
                dice3.graphics.beginFill(0xE5F812,0.5);
                dice3.graphics.moveTo(myArr[0].x,myArr[0].y);
                dice3.graphics.lineTo(myArr[1].x,myArr[1].y);
                dice3.graphics.lineTo(myArr[5].x,myArr[5].y);
                dice3.graphics.lineTo(myArr[4].x,myArr[4].y);
                dice3.graphics.lineTo(myArr[0].x,myArr[0].y);
                dice3.graphics.endFill();
                
                dice4.graphics.clear();                            
                dice4.graphics.beginFill(0xA7E252,0.5);
                dice4.graphics.moveTo(myArr[1].x,myArr[1].y);
                dice4.graphics.lineTo(myArr[2].x,myArr[2].y);
                dice4.graphics.lineTo(myArr[6].x,myArr[6].y);
                dice4.graphics.lineTo(myArr[5].x,myArr[5].y);
                dice4.graphics.lineTo(myArr[1].x,myArr[1].y);
                dice4.graphics.endFill();
                
                dice5.graphics.clear();                            
                dice5.graphics.beginFill(0x6ECE8E,0.5);
                dice5.graphics.moveTo(myArr[2].x,myArr[2].y);
                dice5.graphics.lineTo(myArr[3].x,myArr[3].y);
                dice5.graphics.lineTo(myArr[7].x,myArr[7].y);
                dice5.graphics.lineTo(myArr[6].x,myArr[6].y);
                dice5.graphics.lineTo(myArr[2].x,myArr[2].y);
                dice5.graphics.endFill();
                
                dice6.graphics.clear();                            
                dice6.graphics.beginFill(0xCDE575,0.5);
                dice6.graphics.moveTo(myArr[3].x,myArr[3].y);
                dice6.graphics.lineTo(myArr[0].x,myArr[0].y);
                dice6.graphics.lineTo(myArr[4].x,myArr[4].y);
                dice6.graphics.lineTo(myArr[7].x,myArr[7].y);
                dice6.graphics.lineTo(myArr[3].x,myArr[3].y);
                dice6.graphics.endFill();
        }
    }
}

import flash.display.Sprite;
import flash.filters.BlurFilter;
class _Leaf_ extends Sprite {
    public var kakudo:Number;
    private var arr1=[0xF0F0B0,0xE3DA37,0xE5F812,0xA7E252,0xCDE575,0x6ECE8E,0x44C875,0xADDFAE];
    public function _Leaf_(nums:uint):void {        
        this.graphics.beginFill(arr1[nums],0.5);
        this.graphics.drawCircle(0,0,5);
        this.graphics.endFill();
        this.filters = [new BlurFilter(6,6)];
    }
}