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

Sakura

Sakura
* @author Masayuki Komatsu / sekiryou.com
* https://twitter.com/sekiryou_com
Get Adobe Flash player
by sekiryou 31 Aug 2010
/**
 * Copyright sekiryou ( http://wonderfl.net/user/sekiryou )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/7G7u
 */

/**
* Sakura
* @author Masayuki Komatsu / sekiryou.com
* https://twitter.com/sekiryou_com
*/
package {
    import flash.text.*;
    import flash.filters.BlurFilter;
    import flash.geom.Point;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.display.Graphics;
    import flash.events.Event;
    import flash.geom.ColorTransform;
    import flash.geom.Matrix;
    import flash.geom.Matrix3D;
    import flash.geom.PerspectiveProjection;
    import flash.geom.Utils3D;
    import flash.geom.Vector3D;
    public class Sakura extends Sprite {
        private const STAGE_WIDTH:Number = stage.stageWidth;
        private const STAGE_HEIGHT:Number = stage.stageHeight;
        private const STAGE_CENTER_X:Number = stage.stageWidth / 2;
        private const STAGE_CENTER_Y:Number = stage.stageHeight / 2;
        private var _canvas:BitmapData;
        private var projection:PerspectiveProjection;
        private var projectionMatrix3D:Matrix3D;
        private var mtx3D:Matrix3D = new Matrix3D();
        private var cnt:Number = 1;
        
        private var traceTF:TextField;
        
        public function Sakura() {
            Wonderfl.capture_delay(8);
            stage.scaleMode = "noScale";
            init()
        }
        private function init():void {
            {
                //var syuin:BitmapData = new BitmapData(80, 80, true);
                //syuin.setVector(
                    //syuin.rect,
                    //Vector.<uint>([
                        //0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,546242560,1620377600,2157248512,2157248512,2157248512,2157248512,2157248512,1620377600,546242560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,276758528,2157248512,3767861248,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,3767861248,2157248512,276758528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,276758528,1083375616,276758528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,546242560,1083375616,546242560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1620377600,3767861248,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,3767861248,1620377600,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,276758528,3499425792,4288151552,2962554880,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,814678016,4036362240,4288151552,1351811072,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2694053888,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,2694053888,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,546242560,4288151552,4288151552,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2425683968,4288151552,3230990336,0,0,0,0,0,276758528,1083375616,546242560,0,0,0,0,0,0,0,0,1888747520,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,1888747520,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3499425792,4288151552,0,546242560,1083375616,1083375616,2157248512,2157248512,2425683968,2962554880,814678016,0,0,0,0,0,0,0,276758528,276758528,0,0,0,0,0,1620377600,4288151552,1888747520,276758528,1083375616,1620377600,2157248512,3230990336,3767861248,4288151552,4036362240,814678016,0,0,0,0,0,0,1351811072,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,2425683968,814678016,0,0,0,0,0,814678016,2425683968,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,1351811072,0,0,0,0,0,0,0,1620377600,0,0,0,546242560,1083375616,2157248512,3767861248,3767861248,3230990336,2694053888,2157248512,2157248512,1351811072,1083375616,1351811072,4288151552,4288151552,1351811072,0,0,0,0,0,0,1620377600,1888747520,0,1083375616,1351811072,2157248512,2962554880,3499425792,4288151552,3230990336,2962554880,2157248512,2157248512,1083375616,1083375616,1888747520,4288151552,4288151552,4036362240,276758528,0,0,0,0,546242560,4036362240,4288151552,4288151552,4288151552,4288151552,2962554880,276758528,0,0,0,0,0,0,0,0,0,276758528,2962554880,4288151552,4288151552,4288151552,4288151552,4036362240,546242560,0,0,0,0,0,276758528,4036362240,3230990336,2962554880,2962554880,2694053888,2157248512,1083375616,0,0,0,0,0,0,0,0,2962554880,4288151552,4288151552,3767861248,0,0,0,0,0,0,3230990336,4288151552,3230990336,3230990336,2694053888,1888747520,1083375616,0,0,0,0,546242560,1888747520,546242560,276758528,4036362240,3499425792,2157248512,1888747520,0,0,0,0,0,3230990336,4288151552,4288151552,4288151552,4288151552,3230990336,0,0,0,0,0,0,0,0,0,0,0,0,0,3230990336,4288151552,4288151552,4288151552,4288151552,3230990336,0,0,0,0,0,2425683968,4036362240,0,0,0,0,0,0,0,0,0,0,0,0,0,2425683968,3767861248,2425683968,1351811072,546242560,0,0,0,0,0,1620377600,4288151552,1888747520,0,0,0,2157248512,2157248512,546242560,1083375616,2157248512,3499425792,4288151552,4288151552,4288151552,1888747520,276758528,0,0,0,0,0,0,0,1083375616,4288151552,4288151552,4288151552,4288151552,4288151552,3499425792,3230990336,3230990336,3230990336,3230990336,3230990336,3230990336,3230990336,2962554880,2157248512,814678016,0,0,0,276758528,3767861248,4288151552,4288151552,4288151552,4288151552,1083375616,0,0,0,546242560,4288151552,3230990336,0,2157248512,2157248512,276758528,0,0,0,0,0,0,0,0,0,814678016,0,0,0,0,0,0,0,0,0,3230990336,4288151552,1083375616,546242560,2425683968,4036362240,4036362240,4288151552,2694053888,1083375616,1083375616,814678016,0,2962554880,3230990336,0,0,0,0,0,0,0,0,0,2962554880,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,3499425792,0,0,0,0,1083375616,4288151552,4288151552,4288151552,4288151552,2962554880,0,0,0,1083375616,4288151552,2425683968,0,546242560,4288151552,2962554880,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1888747520,4288151552,0,1888747520,2157248512,1083375616,0,4288151552,2157248512,1083375616,2694053888,2157248512,1083375616,3230990336,3230990336,0,0,0,0,0,0,0,0,0,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,0,0,0,0,0,3230990336,4288151552,4288151552,4288151552,4288151552,0,0,0,0,2157248512,276758528,0,0,4288151552,2157248512,546242560,2962554880,3230990336,276758528,0,0,0,0,546242560,814678016,0,0,0,0,0,0,0,0,0,0,0,0,1888747520,2157248512,1620377600,0,4288151552,2157248512,0,546242560,2157248512,1888747520,3230990336,3230990336,0,0,0,0,0,0,0,0,1083375616,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,3767861248,0,0,0,0,0,1620377600,4288151552,4288151552,4288151552,4288151552,1083375616,0,0,0,0,0,0,0,4288151552,3767861248,4036362240,3230990336,2694053888,276758528,0,546242560,2425683968,3230990336,4036362240,4288151552,3230990336,814678016,0,0,0,0,0,0,0,0,0,0,814678016,1083375616,814678016,546242560,4288151552,2157248512,546242560,1083375616,276758528,0,3230990336,3230990336,0,0,0,0,0,0,0,0,2157248512,4288151552,4288151552,4288151552,4288151552,3230990336,3230990336,3230990336,3230990336,3230990336,3230990336,3230990336,3230990336,3230990336,3230990336,3230990336,2962554880,546242560,0,0,0,0,0,276758528,4288151552,4288151552,4288151552,4288151552,2157248512,0,0,0,0,0,0,0,4288151552,2157248512,0,0,0,2425683968,3767861248,3767861248,2694053888,1351811072,2694053888,4288151552,3230990336,0,0,0,0,0,0,0,0,0,0,0,0,276758528,2694053888,3499425792,4288151552,2157248512,0,2425683968,4288151552,2425683968,3230990336,3230990336,0,0,0,0,0,0,0,0,2157248512,4288151552,4288151552,4288151552,4288151552,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4288151552,4288151552,4288151552,4288151552,2157248512,0,0,0,0,0,0,0,4288151552,1620377600,0,0,0,0,0,0,0,0,3499425792,4288151552,1351811072,0,0,0,0,0,0,0,0,0,276758528,1083375616,2157248512,4036362240,3230990336,276758528,3767861248,3499425792,0,0,0,0,3230990336,3230990336,0,0,0,0,0,0,0,0,2157248512,4288151552,4288151552,4288151552,4288151552,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4288151552,4288151552,4288151552,4288151552,2157248512,0,0,0,0,0,0,814678016,4288151552,1888747520,1888747520,3230990336,4288151552,4288151552,2694053888,276758528,0,1083375616,4288151552,3767861248,0,0,0,0,0,0,0,0,0,0,276758528,2157248512,3230990336,2962554880,276758528,0,3499425792,4288151552,2962554880,546242560,0,0,1351811072,1083375616,0,0,0,0,0,0,0,0,2157248512,4288151552,4288151552,4288151552,4288151552,0,0,0,0,0,0,0,0,814678016,1083375616,1083375616,1083375616,1083375616,1083375616,1083375616,1083375616,1083375616,1083375616,1083375616,4288151552,4288151552,4288151552,4288151552,2157248512,0,0,0,0,1351811072,2425683968,3499425792,4288151552,2694053888,1351811072,1083375616,1083375616,1083375616,1351811072,3230990336,0,2694053888,4288151552,2157248512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2694053888,4288151552,3499425792,2157248512,3767861248,1083375616,0,0,0,0,0,0,0,0,0,0,0,1351811072,4288151552,4288151552,4288151552,4288151552,1083375616,0,0,0,0,0,1351811072,3499425792,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,1351811072,0,2157248512,3230990336,3767861248,2962554880,1888747520,1888747520,4288151552,1083375616,0,0,0,0,0,1888747520,2962554880,4288151552,3767861248,276758528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1620377600,4288151552,3499425792,546242560,4036362240,1083375616,3499425792,3230990336,546242560,0,0,0,0,0,0,0,0,0,546242560,4288151552,4288151552,4288151552,4288151552,1888747520,0,0,0,0,0,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,546242560,0,0,0,0,0,0,1083375616,4288151552,1083375616,0,0,0,0,0,0,3767861248,4288151552,1083375616,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2694053888,4288151552,2962554880,546242560,3499425792,4288151552,2157248512,276758528,2694053888,4288151552,2694053888,546242560,0,0,0,0,0,0,0,0,3767861248,4288151552,4288151552,4288151552,3767861248,0,0,0,0,0,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,3767861248,0,0,0,0,1620377600,1620377600,0,1083375616,4288151552,1083375616,2157248512,3499425792,2962554880,276758528,0,814678016,4288151552,4288151552,2694053888,276758528,0,0,0,0,0,0,0,0,0,0,0,0,2157248512,4288151552,2157248512,814678016,4036362240,3767861248,2962554880,2425683968,0,0,2425683968,4288151552,4288151552,2962554880,1620377600,546242560,0,0,0,0,0,2157248512,4288151552,4288151552,4288151552,4288151552,1888747520,0,0,0,0,2157248512,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,2157248512,0,0,0,814678016,4288151552,546242560,0,1083375616,4288151552,1083375616,0,3499425792,4288151552,1620377600,0,3230990336,3499425792,2425683968,4288151552,3230990336,276758528,0,0,0,0,0,0,0,0,0,276758528,3230990336,3767861248,1351811072,1351811072,3499425792,1620377600,0,2694053888,4288151552,1888747520,0,0,1351811072,4036362240,4288151552,4288151552,4288151552,3499425792,2425683968,1351811072,276758528,0,276758528,4036362240,4288151552,4288151552,4288151552,4036362240,814678016,0,0,0,0,814678016,1083375616,1083375616,1083375616,1083375616,1083375616,1083375616,1083375616,1083375616,1888747520,4288151552,4288151552,4288151552,4288151552,4036362240,276758528,0,0,546242560,4036362240,3499425792,0,0,1083375616,4288151552,1083375616,0,546242560,3767861248,2157248512,2157248512,4036362240,276758528,0,3230990336,4288151552,3499425792,546242560,0,0,0,0,0,0,0,814678016,3767861248,2157248512,276758528,0,1083375616,0,276758528,2694053888,4036362240,2694053888,2694053888,276758528,0,0,814678016,4036362240,4288151552,4288151552,3767861248,2694053888,1351811072,276758528,0,0,2157248512,4288151552,4288151552,4288151552,4288151552,4036362240,1620377600,0,0,0,0,0,0,0,0,0,0,0,1620377600,4036362240,4288151552,4288151552,4288151552,4288151552,2157248512,0,0,0,546242560,4288151552,2425683968,0,0,2157248512,4288151552,1083375616,0,0,0,1083375616,3767861248,814678016,0,0,546242560,4036362240,4288151552,4036362240,1620377600,0,0,0,0,0,1620377600,2694053888,814678016,0,0,0,0,276758528,3230990336,2962554880,546242560,276758528,4288151552,3230990336,0,0,0,546242560,1083375616,546242560,0,0,0,0,0,0,0,3230990336,4288151552,4288151552,4288151552,4288151552,4288151552,1888747520,276758528,0,0,0,0,0,0,0,276758528,1888747520,4288151552,4288151552,4288151552,4288151552,4288151552,3230990336,0,0,0,0,0,2694053888,546242560,1083375616,1083375616,2694053888,4288151552,1083375616,0,0,814678016,3230990336,276758528,0,0,0,0,1620377600,4288151552,4288151552,4288151552,2962554880,546242560,0,0,546242560,1083375616,0,0,0,0,0,814678016,2425683968,546242560,0,276758528,3499425792,4288151552,3230990336,0,0,0,0,0,0,0,0,0,0,0,0,0,276758528,3499425792,4288151552,4288151552,4288151552,4288151552,4288151552,4036362240,2694053888,1083375616,1083375616,1083375616,1083375616,1083375616,2694053888,4036362240,4288151552,4288151552,4288151552,4288151552,4288151552,3499425792,276758528,0,0,0,0,0,0,0,1888747520,4288151552,4288151552,4288151552,0,0,0,2157248512,276758528,0,0,0,0,0,0,2425683968,4288151552,4288151552,4288151552,4036362240,2157248512,276758528,0,0,0,0,0,0,0,276758528,0,0,814678016,3767861248,4288151552,2157248512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,276758528,2694053888,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,2694053888,276758528,0,0,0,0,0,0,0,0,0,1620377600,4288151552,3499425792,0,0,0,0,0,0,0,0,0,0,0,0,2157248512,3230990336,3230990336,3230990336,3230990336,2425683968,0,0,0,0,0,0,0,0,0,1083375616,4036362240,3499425792,814678016,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2694053888,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,2694053888,0,0,0,0,0,0,0,0,0,0,0,0,1351811072,814678016,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,276758528,2694053888,4036362240,2157248512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1620377600,4036362240,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4036362240,1620377600,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1888747520,3767861248,2157248512,276758528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1620377600,3499425792,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,4288151552,3499425792,1620377600,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,546242560,1083375616,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,546242560,1083375616,1083375616,1083375616,1083375616,1083375616,546242560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,814678016,1083375616,1083375616,1083375616,1083375616,1083375616,276758528,0,1083375616,1083375616,1083375616,1083375616,1083375616,0,276758528,546242560,0,0,0,0,546242560,546242560,814678016,0,276758528,1083375616,1083375616,1083375616,1083375616,1083375616,814678016,276758528,546242560,0,0,0,0,546242560,546242560,0,1083375616,1083375616,1083375616,1083375616,1083375616,0,276758528,546242560,0,0,0,0,546242560,546242560,0,0,276758528,1083375616,1083375616,1083375616,1083375616,1083375616,814678016,0,546242560,1083375616,1083375616,1083375616,1083375616,546242560,0,0,1083375616,1083375616,1083375616,1083375616,1083375616,0,0,2157248512,2425683968,1083375616,1083375616,1083375616,1083375616,1083375616,276758528,3230990336,1620377600,1083375616,1083375616,1083375616,1351811072,4288151552,1351811072,2157248512,0,0,0,0,2157248512,2157248512,3230990336,0,3767861248,1351811072,1083375616,1083375616,1083375616,1083375616,814678016,1083375616,2157248512,0,0,0,0,2157248512,2157248512,3230990336,1620377600,1083375616,1083375616,1083375616,1351811072,4288151552,1351811072,2157248512,0,0,0,0,2157248512,2157248512,0,0,3767861248,1351811072,1083375616,1083375616,1083375616,1083375616,814678016,1083375616,3230990336,1083375616,1083375616,1083375616,1083375616,2962554880,2425683968,3230990336,1620377600,1083375616,4288151552,1083375616,1351811072,4288151552,276758528,1083375616,2157248512,2157248512,2157248512,2157248512,2157248512,3230990336,1083375616,3230990336,1083375616,2157248512,2157248512,2157248512,2157248512,1888747520,1083375616,3230990336,2157248512,2157248512,2157248512,2157248512,2962554880,1620377600,3230990336,0,3230990336,0,0,0,0,0,0,814678016,3230990336,2157248512,2157248512,2157248512,2157248512,3230990336,2157248512,3230990336,0,0,0,0,0,4288151552,1083375616,2157248512,0,0,0,0,2157248512,2157248512,0,0,3230990336,0,0,0,0,0,0,1083375616,2157248512,0,0,0,0,2157248512,2157248512,3230990336,0,0,4288151552,0,0,4288151552,0,1083375616,2157248512,2157248512,2157248512,2157248512,2157248512,2962554880,546242560,2425683968,2157248512,2157248512,2157248512,2157248512,2157248512,1620377600,814678016,1620377600,0,0,0,0,1620377600,1620377600,2425683968,0,2425683968,0,0,0,0,0,0,0,2157248512,2157248512,2157248512,2157248512,2157248512,2694053888,1351811072,2425683968,2157248512,2157248512,2157248512,2157248512,2157248512,2962554880,814678016,2694053888,2157248512,2157248512,2157248512,2157248512,2694053888,1351811072,1620377600,814678016,2962554880,2157248512,2157248512,2157248512,2157248512,2157248512,1620377600,814678016,2694053888,2157248512,2157248512,2157248512,2157248512,2694053888,1351811072,2425683968,0,0,3230990336,0,0,3230990336,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
                    //])
                //);
                //syuin.applyFilter(syuin, syuin.rect, new Point(0, 0), new BlurFilter(2, 1, 2));
                
                var branchBMD:BitmapData = new BitmapData(110, 10, true, 0x00000000);
                graphics.beginFill(0xFFEEEE);
                graphics.lineStyle(10,0x000000)
                graphics.moveTo(0, 0);
                graphics.lineTo(105, 0);
                graphics.endFill();
                
                var mtrx:Matrix = new Matrix(1,0,0,1,0,5);
                branchBMD.draw(this, mtrx);
                //addChild (new Bitmap(branchBMD));
                graphics.clear();
                
                var fSize:int = 4;
                var flwBMD:BitmapData = new BitmapData(fSize, fSize, true, 0x44DD4444);
                graphics.beginFill(0xFFEEEE);
                graphics.drawCircle(0, 0, fSize * 0.5);
                graphics.endFill();
                
                var ctf:ColorTransform = new ColorTransform();
                ctf.alphaMultiplier = 0.3;
                mtrx = new Matrix(1,0,0,1,fSize * 0.5,fSize * 0.5);
                flwBMD.draw(this, mtrx, ctf);
                //addChild (new Bitmap(flwBMD));
                graphics.clear();
            }
            
            projection = new PerspectiveProjection();
            projection.fieldOfView = 60;
            projectionMatrix3D = projection.toMatrix3D();
            
            //var world:Sprite = new Sprite();
            //addChild(world);
            //world.x = 223;
            //world.y = 400;
            var offsetX:Number = STAGE_CENTER_X;
            var offsetY:Number = STAGE_CENTER_Y + 200;
            
            //
            addChild (new Bitmap (new BitmapData ( STAGE_WIDTH, STAGE_HEIGHT, false, 0x333333)));
            
            _canvas = new BitmapData ( STAGE_WIDTH, STAGE_HEIGHT, true, 0x000000);
            addChild (new Bitmap (_canvas));
            
            var i:int;
            var j:int;
            
            var branchs:Array;
            var genDiv:Array = [1, 3, 3, 3, 3];
            
            generate();
            function generate():void {
                branchs = [];
                var ground:Branch = new Branch(1, null, new Vector3D(0, 0, 0), new Vector3D(0, 0, 0));
                branchs.push(new Branch(1, ground, new Vector3D(0, 0, 0), new Vector3D(0, -100, 0)));
                for (i = 0; i < genDiv[1]; i++) {
                    branchs.push(new Branch(2, branchs[0], new Vector3D(0, 0, 0), new Vector3D(0, -85, 0)));
                }
                for (i = 0; i < genDiv[1] * genDiv[2]; i++) {
                    branchs.push(new Branch(3, branchs[genDiv[0] + i % genDiv[1]], new Vector3D(0, 0, 0), new Vector3D(0, -70, 0)));
                }
                for (i = 0; i < genDiv[1] * genDiv[2] * genDiv[3]; i++) {
                    branchs.push(new Branch(4, branchs[genDiv[0] + genDiv[1] + i % (genDiv[1] * genDiv[2])], new Vector3D(0, 0, 0), new Vector3D(0, -55, 0)));
                }
                for (i = 0; i < genDiv[1] * genDiv[2] * genDiv[3] * genDiv[4]; i++) {
                    branchs.push(new Branch(5, branchs[genDiv[0] + genDiv[1] + (genDiv[1] * genDiv[2]) + i % (genDiv[1] * genDiv[2] * genDiv[3])], new Vector3D(0, 0, 0), new Vector3D(0, -40, 0)));
                }
            }
        
            var projectedVerts:Vector.<Number> = new Vector.<Number>();
            var projectedVerts2:Vector.<Number> = new Vector.<Number>();
            var branchVerts:Vector.<Number> = new Vector.<Number>();
            var flowerVerts:Vector.<Number> = new Vector.<Number>();
            var uvts:Vector.<Number> = new Vector.<Number>();
            var len:int = branchs.length;
            var angle:int = 50;
            
            trans();
            function trans():void {
            projectedVerts = new Vector.<Number>();
            projectedVerts2 = new Vector.<Number>();
            branchVerts = new Vector.<Number>();
            flowerVerts = new Vector.<Number>();
            uvts = new Vector.<Number>();
                for (i = 0; i < len; i++) {
                    var ratio:Number = (branchs[i]._generation - 0.8) * 1.6;
                    mtx3D.identity();
                    mtx3D.appendRotation(Math.random() * ratio * angle - ratio * angle * 0.5, Vector3D.X_AXIS);
                    mtx3D.appendRotation(Math.random() * ratio * angle - ratio * angle * 0.5, Vector3D.Y_AXIS);
                    mtx3D.appendRotation(Math.random() * ratio * angle - ratio * angle * 0.5, Vector3D.Z_AXIS);
                    mtx3D.appendTranslation(branchs[i]._parent._ev3.x, branchs[i]._parent._ev3.y, branchs[i]._parent._ev3.z);
                    bugfix(mtx3D);
                    branchs[i]._bv3 = mtx3D.transformVector(branchs[i]._bv3);
                    branchs[i]._ev3 = mtx3D.transformVector(branchs[i]._ev3);
                    
                    for (j = 0; j < (branchs[i]._generation - 2) * 6; j++) {
                        var fPos:Vector3D = new Vector3D(Math.random() * 8 - 4, Math.random() * (-115 + branchs[i]._generation * 15), Math.random() * 8 - 4);
                        fPos = mtx3D.transformVector(fPos);
                        
                        var facs:int = int(flowerVerts.length / 3 * Math.random());
                        flowerVerts.splice(facs*3+0,0, fPos.x);
                        flowerVerts.splice(facs*3+1,0, fPos.y);
                        flowerVerts.splice(facs*3+2,0, fPos.z);
                    }
                    
                    branchVerts.push(branchs[i]._bv3.x, branchs[i]._bv3.y, branchs[i]._bv3.z);
                    branchVerts.push(branchs[i]._ev3.x, branchs[i]._ev3.y, branchs[i]._ev3.z);
                }
            }
            
            //var g:Graphics = world.graphics;
            var dpLen:Number = 0.1;
            var renewcount:int = 0;
            var stampPosX:Number = 325;
            var stampPosY:Number = 380;
            
            var posX:Number = 0;
            var posY:Number = 0;
            var posZ:Number = 0;
            var rotX:Number = 0;
            var rotY:Number = Math.sin(cnt) * 60;
            var rotZ:Number = 0;
            var offsetZ:Number = 360;
            
            addEventListener(
                Event.ENTER_FRAME,
                function():void {
                    rotY = Math.sin(cnt) * 60;
                    cnt += 0.0025;
                    
                    mtx3D.identity();
                    mtx3D.appendRotation(rotX, Vector3D.X_AXIS);
                    mtx3D.appendRotation(rotY, Vector3D.Y_AXIS);
                    mtx3D.appendRotation(rotZ, Vector3D.Z_AXIS);
                    mtx3D.appendTranslation(posX, posY, posZ + offsetZ);
                    mtx3D.append(projectionMatrix3D);
                    bugfix(mtx3D);
                    
                    Utils3D.projectVectors(mtx3D, branchVerts, projectedVerts, uvts);
                    
                    //g.clear();
                    _canvas.fillRect(_canvas.rect, 0x00000000);
                    
                    var len:int = projectedVerts.length;
                    //g.lineStyle();
                    for (i = 0; i < len; i += 4) {
                        //g.lineStyle(((5.2-branchs[i / 4]._generation) * 2.6), 0x000000);
                        //g.moveTo(projectedVerts[i] + offsetX, projectedVerts[i + 1] + offsetY);
                        //g.lineTo(projectedVerts[i + 2] + offsetX, projectedVerts[i + 3] + offsetY);
                        
                        var dx:Number = projectedVerts[i + 2] - projectedVerts[i];
                        var dy:Number = projectedVerts[i + 3] - projectedVerts[i + 1];
                        var dist:Number = Math.sqrt(dx * dx + dy * dy);
                        var ang:Number = Math.atan2(dy, dx);
                        mtrx.identity();
                        mtrx.translate(-5, -5);
                        mtrx.scale(dist / 100, (5.6-branchs[i / 4]._generation) * 0.24);
                        mtrx.rotate(ang);
                        mtrx.translate(projectedVerts[i] + offsetX, projectedVerts[i + 1] + offsetY);
                        _canvas.draw(branchBMD, mtrx);
                    }
                    
                    Utils3D.projectVectors(mtx3D, flowerVerts, projectedVerts2, uvts);
                    
                    len = projectedVerts2.length;
                    dpLen += dpLen / 16; 
                    if (dpLen > len) {
                        dpLen = len;
                        //mtrx.a = 0.925;
                        //mtrx.b = 0;
                        //mtrx.c = 0;
                        //mtrx.d = 0.925;
                        //mtrx.tx = stampPosX;
                        //mtrx.ty = stampPosY;
                        //_canvas.draw(syuin, mtrx);
                        renewcount += 1;
                        if (renewcount > 90) {
                            renewcount = 0;
                            generate();
                            trans();
                            dpLen = 0.2;
                        }
                    }
                    
                    for (i = 0; i < int(dpLen); i += 2) {
                        //g.beginFill(0xFF9999, Math.random() * 0.4 + 0.4);
                        //g.drawCircle(projectedVerts2[i], projectedVerts2[i + 1], Math.random() * 3 + 1);
                        //g.endFill();
                        //mtrx.identity();
                        //mtrx.translate(projectedVerts2[i] - fSize * 0.5 + offsetX, projectedVerts2[i + 1] - fSize * 0.5 + offsetY);
                        _canvas.copyPixels(flwBMD, flwBMD.rect, new Point(projectedVerts2[i] - fSize * 0.5 + offsetX,projectedVerts2[i + 1] - fSize * 0.5 + offsetY),null,null,true);
                        //_canvas.draw(flwBMD, mtrx);
                    }
                }
            );
        }
        private var flowers:Array = [];
        private function bugfix(matrix:Matrix3D):void {
            var m1:Matrix3D = new Matrix3D(Vector.<Number>([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]));
            var m2:Matrix3D = new Matrix3D(Vector.<Number>([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]));
            m1.append( m2 );
            if (m1.rawData[15] == 20) {
                var rawData:Vector.<Number> = matrix.rawData;
                rawData[15] /= 20;
                matrix.rawData = rawData;
            }
        }
    }
}
import flash.geom.Vector3D
class Branch {
    public var _generation:int;
    public var _parent:Branch;
    public var _bv3:Vector3D;
    public var _ev3:Vector3D;
    public var _rv3:Vector3D;
    public var _partition:int;
    public function Branch(generation:int, parent:Branch, bv3:Vector3D, ev3:Vector3D) {
        _generation = generation;
        _parent = parent;
        _bv3 = bv3;
        _ev3 = ev3;
    }
}