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: SPEC vol.5 投稿用コード

card_action  /////////////////////////////////////

@author okasuke
即興で...すません...
たぶんいろいろ使い方まちがってる...

まだできてなできてなかった
import caurina.transitions.Tweener;
import flash.motion.MatrixTransformer;
Get Adobe Flash player
by OKASUKE 20 Sep 2012
  • Forked from Event's SPEC vol.5 投稿用コード
  • Diff: 677
  • Related works: 12
  • Talk

    mousepancyo at 20 Sep 2012 17:51
    Stage3Dが表示されないときは、エディタ右側上部にあるタイトルを編集するところの +more をクリックしたら下に出てくるメニューの wmode を direct に変更すると表示できるようになりますよ。 あ、見当違いだったらごめんなさい。
    OKASUKE at 20 Sep 2012 18:07
    mousepancyoさん、ありがとうございます! wmodeをdirectに変更したところうまく表示されました! MBAでいじっていると+moreで表示するところの 下の部分のメニューが隠れてきがつかなかったです... ありがとうございます!!><感謝!!
    romatica at 20 Sep 2012 18:55
    自分もMBAで作業してて+moreが隠れて最初つまずいたっすw
    OKASUKE at 20 Sep 2012 19:28
    romaticaさん、 ですよねー。 下にスクロールしてくれないのは罠ですよねw

    Tags

    Embed
/**
 * Copyright OKASUKE ( http://wonderfl.net/user/OKASUKE )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/otmL
 */

// forked from Event's SPEC vol.5 投稿用コード
//////////////////////////////////////////////////////
//  forked from Takema.Terai's flash on 2012-7-4  ////
//////////////////////////////////////////////////////
//  card_action  /////////////////////////////////////
//////////////////////////////////////////////////////

/**
 *@author okasuke
 *即興で...すません...
 *たぶんいろいろ使い方まちがってる...
 */
 //wonderflだとなぜか表示してくれない

package {
    
    import away3d.containers.*;
    import away3d.entities.*;
    import away3d.materials.*;
    import away3d.primitives.*;
    import away3d.filters.*;
    import away3d.utils.*;
    import away3d.debug.AwayStats;
    
    import flash.geom.Vector3D;
    
    import jp.progression.commands.lists.SerialList;
    import jp.progression.commands.net.LoadBitmapData;
    import jp.progression.data.getResourceById;
    
    import a24.tween.Ease24;
    import a24.tween.Tween24;
    
    import com.bit101.components.Label;
    import com.bit101.components.ProgressBar;
    
    import flash.events.Event;
    import flash.display.*;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.system.LoaderContext;
    import flash.utils.*;
    
    [SWF(backGroundColor="0x000000", width="465", height="465", frameRate="30")]    

    public class Spec5 extends Sprite {
       
        private static const IMAGE_LIST:Array = [
            "http://assets.wonderfl.net/images/related_images/a/aa/aa18/aa18e54a74d5ce4a3d47cadb92b0890cc691882f",    
            "http://assets.wonderfl.net/images/related_images/1/1f/1fb0/1fb0efe3daed6fb49a886aa348ba9ebae6e462bb",    
            "http://assets.wonderfl.net/images/related_images/4/46/46e7/46e76c4b6ca7fdc48bc2884ec886119fc37c3cf4"   
        ];
        
        //engine variables
        private var _view:View3D;
        
        //scene objects
        private var _plane:Mesh;
        
        private var _mcard:Mesh;
        private var _scard:Vector.<Mesh> = new Vector.<Mesh>();
        private var _lines:SegmentSet;
        
        public function Spec5() {
            //Wonderfl.capture_delay(18);
            Wonderfl.disable_capture();
            
            if (stage) getImage(null);
            else addEventListener(Event.ADDED_TO_STAGE, getImage);
            //stage.scaleMode = StageScaleMode.NO_SCALE;
            //stage.align = StageAlign.TOP_LEFT;
            //getImage();
        }
        
        private function init():void {
           
            //setup the view
            _view = new View3D();
            addChild(_view);
            _view.backgroundColor = 0;
            _view.antiAlias = 4;
            
            //setup the camera
            _view.camera.z = -600;
            _view.camera.y = 400;
            _view.camera.x = -20;
            _view.camera.lookAt(new Vector3D());
            
            //setup the scene
            _plane = new Mesh(new PlaneGeometry(465, 465), new TextureMaterial(Cast.bitmapTexture(arrImage[2])));
            _plane.material.bothSides = true;
            _view.scene.addChild(_plane);
            
            _plane.rotationX = 90;
            var pt:TextureMaterial = (_plane.material as TextureMaterial);
            pt.alphaBlending = true;
            pt.alpha = 0.0;
            
            _mcard = new Mesh(new PlaneGeometry(465, 465), new TextureMaterial(Cast.bitmapTexture(arrImage[1])));
            _mcard.material.bothSides = true;
            _view.scene.addChild(_mcard);
            
            _mcard.rotationX = 90;
            _mcard.rotationZ = 90;
            var mt:TextureMaterial = (_mcard.material as TextureMaterial);
            mt.alphaBlending = true;
            mt.alpha = 0.0;
            
             _lines = new SegmentSet();
            _view.scene.addChild( _lines );
            
            for(var n:uint=0; n<=13; n++) {    
                _scard.push(new Mesh(new PlaneGeometry(64, 64), new TextureMaterial(Cast.bitmapTexture(arrImage[0]))));
                _scard[n].material.bothSides = true;
                
                _view.scene.addChild(_scard[n]);
                var smt:TextureMaterial = (_scard[n].material as TextureMaterial);
                smt.alpha = 0.0;
                smt.alphaBlending = true;
                //Tweener.addTween(smt, {alpha:1.0, transition:"linear", time:2});
                Tween24.tween(_scard[n].material, 2.0,Ease24._3_CubicInOut).alpha(1.0).play();
                _scard[n].y = Math.sin(30 * n * 200) * 200;
                _scard[n].x = Math.cos(30 * n * 200) * 200; 
                
                _scard[n].z = -100;
                _scard[n].rotationX = 90;
            }
            
            _view.filters3d = [new BloomFilter3D()];
            var awayStats:AwayStats = new AwayStats(_view);
            addChild(awayStats);
            //setup the render loop
            addEventListener(Event.ENTER_FRAME, _onEnterFrame);
            //stage.addEventListener(Event.RESIZE, onResize);
            //onResize();
        }
        
        //画像取得        
        private function getImage(Event:*):void {            
            removeEventListener(flash.events.Event.ADDED_TO_STAGE, getImage);
            _progbar = new ProgressBar(this, 200, 200);    
            _progbar.visible = true;            
            
            var list:SerialList = new SerialList();    
            list.onPosition = function():void {
                _progbar.value = list.position / list.numCommands;                
            }
            for (var i:int = 0; i < IMAGE_LIST.length; i++) {
                list.addCommand(new LoadBitmapData(new URLRequest(IMAGE_LIST[i]), { context: new LoaderContext(true)}));
            } 
            list.onComplete = function():void {     ImageComplete(IMAGE_LIST); }
            list.onError = function():void { errimg();}
            list.execute();    
        }
        private var _progbar:ProgressBar;        
        private var arrImage:Vector.<BitmapData> = new Vector.<BitmapData>(); 
        private function ImageComplete(images:Array):void {
            _progbar.visible = false;            
            
            for (var i:int = 0; i < images.length; ++i) {
                //trace(images[i]);
                var bmd:BitmapData = getResourceById(images[i]).toBitmapData();    
                arrImage.push(bmd);
            }            
            init();
        }
        
        private var _err:Label;
        private function errimg():void {            
            _err = new Label(this, 200, 200, "Error! Not Image");            
            _progbar.visible = false;            
        }        

        private function lineDraw(x:Number=1, y:Number=1, z:int=-50, col:uint=0x7766FF):void
        {
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( 0*x, 200*y, z ),
                    new Vector3D( -85*x, 180*y, z),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( -85*x, 180*y, z ),
                    new Vector3D( -155*x, 127*y, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( -155*x, 127*y, z ),
                    new Vector3D( -194*x, 49*y, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( -194*x, 49*y, z),
                    new Vector3D( -196*x, -39*y, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( -196*x, -39*y, z ),
                    new Vector3D( -160*x, -119*y, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( -160*x, -119*y, z ),
                    new Vector3D( -94*x, -176*y, z),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( -94*x, -176*y, z ),
                    new Vector3D( -10*x, -199*y, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( -10*x, -199*y, z ),
                    new Vector3D( 77*x, -184*y, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( 77*x, -184*y, z ),
                    new Vector3D( 148*x, -134*y, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( 148*x, -134*y, z ),
                    new Vector3D( 191*x, -58*y, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( 148*x, -134*y, z ),
                    new Vector3D( 191*x, -58*y, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( 191*x, -58*y, z ),
                    new Vector3D( 198*x, 30*y, z),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( 198*x, 30*y, z ),
                    new Vector3D( 166*x, 111*y, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( 166*x, 111*y, z),
                    new Vector3D( 102*x, 171*x, z ),
                    col,
                    col,
                    2
                )
            )
            _lines.addSegment(
                new LineSegment(
                    new Vector3D( 102*x, 171*y, z ),
                    new Vector3D( 0*x, 200*y, z ),
                    col,
                    col,
                    2
                )
            )
        }
        
        
        private var _countx:Number = 1.8; 
        private var _county:Number = 1.8;
        private var _countz:Number = -480;
        private var col:uint = 0x7766FF;
        private var flg:Boolean = false;
        private var n:uint;
        private var s:uint;
        private var f:uint;
        private function _onEnterFrame(e:Event):void
        {
            _view.camera.x = 500 * Math.sin(getTimer() / 2000);
            _view.camera.y = 500 * Math.sin(getTimer() / 5000) - 200;
            _view.camera.lookAt(new Vector3D());
            _view.render();
            
            if(flg == false) {
            _countx -= 0.2;
            _county -= 0.2;
            _countz += 10;
            }
            
            if(_countz <= 1200) {
                lineDraw(_countx, _county, _countz, col);
                _countz += 10;
            }
            if(_countx >= 0 || _county >= 0) {
                lineDraw(_countx, _county, _countz, col);
                _countz += 10;
                for(n=0; n<=13; n++) {
                    _scard[n].rotationX += 20;
                    //_scard[n].rotationZ += 30;
                    _scard[n].rotationY += 10;
                }
            } else {
                if(_countx >= -20) {
                    for(f=0; f<=13; f++) {
                    _scard[f].rotationY -= 5;
                    _scard[f].rotationZ += 5;
                    }
                    lineDraw(_countx, 1, 10, col);
                } else {
                    if(_county >= -40) {
                        lineDraw(0.1, _county, 2, col);
                        
                        //_plane.material.blendMode =BlendMode.LIGHTEN;
                    } else {
                        if(flg==false) {
                        for(s=0; s<=13; s++) {
                            Tween24.tween(_scard[s],1.5,Ease24._3_CubicInOut).x(0).y(0).z(0).play();
                            Tween24.tween(_plane.material, 1.0,Ease24._3_CubicInOut).alpha(1.0).play();
                            
                            Tween24.tween(_mcard.material, 2.0,Ease24._3_CubicInOut).alpha(1.0).play();
                            Tween24.tween(_mcard, 7.0,Ease24._3_CubicInOut).z(-420).play();
                        }
                        flg = true;
                        }
                    }
                }
            }
        }
        
        private function onResize(event:Event = null):void
        {
            //_view.width = stage.stageWidth;
            //_view.height = stage.stageHeight;
        }
    }
}
// 以下の画像素材は自由に使っていただいて構いません
// http://jsdo.it/img/event/spec/vol5/material_fl/bg.jpg
// http://jsdo.it/img/event/spec/vol5/material_fl/bg02.jpg
// http://jsdo.it/img/event/spec/vol5/material_fl/card01.jpg
// http://jsdo.it/img/event/spec/vol5/material_fl/card02.jpg
// http://jsdo.it/img/event/spec/vol5/material_fl/kira.png
// http://jsdo.it/img/event/spec/vol5/material_fl/kira02.png
// http://jsdo.it/img/event/spec/vol5/material_fl/lvup.png
// http://jsdo.it/img/event/spec/vol5/material_fl/lvup02.png
// http://jsdo.it/img/event/spec/vol5/material_fl/magic.png