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: いっぱい丸出す

Shaderでやったがこれはひどい
使い方いまいちわからない。学習しながらつかう
Get Adobe Flash player
by uwi 16 May 2010
/**
 * Copyright uwi ( http://wonderfl.net/user/uwi )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/tcXH
 */

// Shaderでやったがこれはひどい
// forked from gbone's いっぱい丸出す
//
// 使い方いまいちわからない。学習しながらつかう
//
package {
	//importってたぶんincludeみたいなもの
	import flash.display.*;
	import flash.events.*;
	import flash.geom.*;
	import flash.filters.*;
	import flash.text.*;
	
	//iroirosettei
	[SWF(width=465,height=465,backgroundColor=0xFFFFFF,frameRate=60)]

	//entry point兼ねてるらしい
	public class Main extends Sprite 
	{
		//画面大きさとか
		private const WIDTH:int = 465;
		private const HEIGHT:int = 465;
		
		private var _shader : Shader;
		private var _sf : ShaderFilter;
		
		//toriaezu
		private var canvas:BitmapData;
		private var time:Number = 12;
		
		//速くなる?わからない
		private var x1:Number;
		private var y1:Number;
		private var dx:Number;
		private var dy:Number;
		private var sn:Number;
		private var cn:Number; 
		private var t10:Number;
		private var col:Number;
		
		private var _sd : ShaderData;
		
		private var _bmp : Bitmap;
		//ep
		public function Main():void 
		{
			//描画箇所作ってbitmap作成して割り当てるっぽい
			canvas = new BitmapData(WIDTH, HEIGHT, false, 0xffffffff);
			_bmp = addChild(new Bitmap(canvas)) as Bitmap;
			
//			var tf : TextField = new TextField();
			
			_shader = new MarudashiFilter();
			_sf = new ShaderFilter(_shader);
//			tf.appendText(_sf.toString());
			_sd = _shader.data;
			_sd.w.value = [canvas.width];
			_sd.h.value = [canvas.height];
			
			//CreateThreadみたいなかんじ?
			addEventListener(Event.ENTER_FRAME, update);
		}

		//こいつがなんどもコールされるらしい
		private function update(e:Event):void 
		{
			var x:int;
			var y:int;
			var scale:int = 2;
			t10 = time * 0.15;	
			sn = Math.sin(t10) * 0.5;
			cn = Math.cos(t10) * 0.5;
			time += 0.01666666 * 1.2;

			//inchiki
			dx = 2.0 / WIDTH;
			dy = 2.0 / HEIGHT;
			
			_sd.ez.value = [-time * 0.1];
			_sd.cn.value = [cn];
			_sd.sn.value = [sn];
			
			// どっちでもおなじ
//			_bmp.filters = [_sf];
			canvas.applyFilter(canvas, canvas.rect, new Point(), _sf);
		}
	}
}

import flash.display.Shader;
import flash.utils.ByteArray;
import mx.utils.Base64Decoder;

class MarudashiFilter extends Shader{
	static private var code:ByteArray;

	// static initializer
	{
		static var dec:Base64Decoder = new Base64Decoder() ;
		dec.decode(
					"pQEAAACkDwBNYXJ1ZGFzaGlGaWx0ZXKgDG5hbWVzcGFjZQAAoAx2ZW5kb3IAVXdpAKAIdmVyc2lv" +
					"bgABAKAMZGVzY3JpcHRpb24ASXBwYWlNYXJ1ZGFzaGkAoQECAAAMX091dENvb3JkAKEBAQAAAmV6" +
					"AKIBZGVmYXVsdFZhbHVlAAAAAAChAQEAAAFjbgCiAWRlZmF1bHRWYWx1ZQAAAAAAoQEBAQAIc24A" +
					"ogFkZWZhdWx0VmFsdWUAP4AAAKEBAQEABHcAogFkZWZhdWx0VmFsdWUAQ+iAAKEBAQEAAmgAogFk" +
					"ZWZhdWx0VmFsdWUAQ+iAAKMABHNyYwChAgQCAA9kc3QAMgMAgD+AAAAyAwBAP4AAAB0DADEDABAA" +
					"HQMAwQAAEAAEAQAQAQBAAAMBABADAAAAMgQAEEAAAAAdBQCAAQDAAAMFAIAEAMAAMgEAED+AAAAd" +
					"BAAQBQAAAAIEABABAMAAHQQAgAQAwAAEAQAQAQCAAAMBABADAEAAMgQAEEAAAAAdBQCAAQDAAAMF" +
					"AIAEAMAAMgEAED+AAAAdBAAQBQAAAAIEABABAMAAHQQAQAQAwAAyAQAQP4AAAB0EACABAMAAHQUA" +
					"4gQAGAAdAQAQAADAAAMBABAFAAAAHQQAEAEAAAADBAAQBQCAAB0FABABAMAAAQUAEAQAwAAdBACA" +
					"BQDAAB0BABAAAMAAAwEAEAUAgAAdBAAQAQAAAAMEABAFAAAAHQUAEAEAwAACBQAQBADAAB0EAEAF" +
					"AMAAHQQAIAUAQAAdBQDiBAAYAB0BABAAAMAAAwEAEAUAAAAdBAAQAQAAAAMEABAFAIAAHQUAEAEA" +
					"wAABBQAQBADAAB0EAIAFAMAAHQEAEAAAwAADAQAQBQCAAB0EABABAAAAAwQAEAUAAAAdBQAQAQDA" +
					"AAIFABAEAMAAHQQAQAUAwAAdBAAgBQBAAB0FAOIEABgAMgEAED8AAAAdBACAAQDAADIBABA/AAAA" +
					"HQQAQAEAwAAdBAAgAACAAB0GAOIEABgAMgEAEAAAAAAyBACAPCPXCh0EAHIFABgAAwQAcgQAAAAd" +
					"BwDiBgAYAAEHAOIEAGwAHQQA4gcAGAAyBAAQQ0gAAB0FABAEAAAAAwUAEAQAwAAMBAAQBQDAADIF" +
					"ABBDSAAAHQYAEAQAgAADBgAQBQDAAAwFABAGAMAAHQYAEAQAwAABBgAQBQDAAB0EABAGAMAAKwQA" +
					"EAQAQAAdAYCAAIAAADQAAAABgAAAMgUAEDz1wo8dBwDiBQAYAAMHAOIFAPwAHQgA4gYAGAABCADi" +
					"BwAYAB0EAOIIABgAMgUAEENIAAAdBgAQBAAAAAMGABAFAMAADAUAEAYAwAAyBgAQQ0gAAB0HAIAE" +
					"AIAAAwcAgAYAwAAMBgAQBwAAAB0HAIAFAMAAAQcAgAYAwAAdBAAQBwAAACsEABAEAEAAHQGAQACA" +
					"AAA0AAAAAYBAADIFABA9dcKPHQcA4gUAGAADBwDiBQD8AB0IAOIGABgAAQgA4gcAGAAdBADiCAAY" +
					"ADIFABBDSAAAHQYAEAQAAAADBgAQBQDAAAwFABAGAMAAMgYAEENIAAAdBwCABACAAAMHAIAGAMAA" +
					"DAYAEAcAAAAdBwCABQDAAAEHAIAGAMAAHQQAEAcAAAArBAAQBABAAB0BgCAAgAAANAAAAAGAgAAy" +
					"BQAQPczMzR0HAOIFABgAAwcA4gUA/AAdCADiBgAYAAEIAOIHABgAHQQA4ggAGAAyBQAQQ0gAAB0G" +
					"ABAEAAAAAwYAEAUAwAAMBQAQBgDAADIGABBDSAAAHQcAgAQAgAADBwCABgDAAAwGABAHAAAAHQcA" +
					"gAUAwAABBwCABgDAAB0EABAHAAAAKwQAEAQAQAAdAYAQAIAAADQAAAABgMAAMgUAED4ZmZodBwDi" +
					"BQAYAAMHAOIFAPwAHQgA4gYAGAABCADiBwAYAB0EAOIIABgAMgUAEENIAAAdBgAQBAAAAAMGABAF" +
					"AMAADAUAEAYAwAAyBgAQQ0gAAB0HAIAEAIAAAwcAgAYAwAAMBgAQBwAAAB0HAIAFAMAAAQcAgAYA" +
					"wAAdBAAQBwAAACsEABAEAEAAHQKAgACAAAA0AAAAAoAAADIFABA+Vwo9HQcA4gUAGAADBwDiBQD8" +
					"AB0IAOIGABgAAQgA4gcAGAAdBADiCAAYADIFABBDSAAAHQYAEAQAAAADBgAQBQDAAAwFABAGAMAA" +
					"MgYAEENIAAAdBwCABACAAAMHAIAGAMAADAYAEAcAAAAdBwCABQDAAAEHAIAGAMAAHQQAEAcAAAAr" +
					"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" );
		code = dec.toByteArray();
		dec = null;
	}

	public function MarudashiFilter(){
		super( code );
	}


	public function get name():String{
		return data[ "name" ];
	}

	public function get nameSpace():String{
		return data[ "nameSpace" ];
	}

	public function get vendor():String{
		return data[ "vendor" ];
	}

	public function get version():String{
		return data[ "version" ];
	}

	public function get description():String{
		return data[ "description" ];
	}

	public function get cn():Array{
		return data[ "cn" ].value;
	}
	public function set cn( value:Array ):void{
		data[ "cn" ].value = value;
	}

	public function get h():Array{
		return data[ "h" ].value;
	}
	public function set h( value:Array ):void{
		data[ "h" ].value = value;
	}

	public function get w():Array{
		return data[ "w" ].value;
	}
	public function set w( value:Array ):void{
		data[ "w" ].value = value;
	}

	public function get ez():Array{
		return data[ "ez" ].value;
	}
	public function set ez( value:Array ):void{
		data[ "ez" ].value = value;
	}

	public function get sn():Array{
		return data[ "sn" ].value;
	}
	public function set sn( value:Array ):void{
		data[ "sn" ].value = value;
	}

	public function src( input:*,  width:int, height:int):void{
		data[ "src" ].input = input;
		data[ "src" ].width = width;
		data[ "src" ].height = height;
	}
	public function get srcChannels():int{
		return data[ "src" ].channels;
	}
}

/*
<languageVersion : 1.0;>

kernel MarudashiFilter
<   namespace : "";
    vendor : "Uwi";
    version : 1;
    description : "IppaiMarudashi";
>
{
    parameter float ez < defaultValue : 0.0; >;
    parameter float cn < defaultValue : 0.0; >;
    parameter float sn < defaultValue : 1.0; >;
    parameter float w < defaultValue : 465.0; >;
    parameter float h < defaultValue : 465.0; >;

    input image4 src; // dummy
    output pixel4 dst;

    void evaluatePixel()
    {
        float2 tekitou = pixelSize(src);
        float2 c = outCoord();
        float3 r = float3(c.x / w * 2.0 - 1.0, c.y / h * 2.0 - 1.0, 1.0);
        r = float3(cn * r.x + sn * r.z, cn * r.z - sn * r.x, r.y);
        r = float3(cn * r.x + sn * r.z, cn * r.z - sn * r.x, r.y);
        float3 e = float3(0.5, 0.5, ez);
        float3 p;
        float d;
        float ret = 0.0;
        
        p = e + r * 0.01;
        d = sin(p.x * 200.0) + sin(p.z * 200.0);
        if(p.y >= d){
            p = e + r * 0.03;
            d = sin(p.x * 200.0) + sin(p.z * 200.0);
            if(p.y >= d){
                p = e + r * 0.06;
                d = sin(p.x * 200.0) + sin(p.z * 200.0);
                if(p.y >= d){
                    p = e + r * 0.10;
                    d = sin(p.x * 200.0) + sin(p.z * 200.0);
                    if(p.y >= d){
                        p = e + r * 0.15;
                        d = sin(p.x * 200.0) + sin(p.z * 200.0);
                        if(p.y >= d){
                            p = e + r * 0.21;
                            d = sin(p.x * 200.0) + sin(p.z * 200.0);
                            if(p.y >= d){
                                p = e + r * 0.28;
                                d = sin(p.x * 200.0) + sin(p.z * 200.0);
                                if(p.y >= d){
                                    p = e + r * 0.36;
                                    d = sin(p.x * 200.0) + sin(p.z * 200.0);
                                    if(p.y >= d){
                                        p = e + r * 0.45;
                                        d = sin(p.x * 200.0) + sin(p.z * 200.0);
                                        if(p.y >= d){
                                            p = e + r * 0.55;
                                            d = sin(p.x * 200.0) + sin(p.z * 200.0);
                                            if(p.y >= d){
                                                p = e + r * 0.66;
                                                d = sin(p.x * 200.0) + sin(p.z * 200.0);
                                                if(p.y >= d){
                                                    p = e + r * 0.78;
                                                    d = sin(p.x * 200.0) + sin(p.z * 200.0);
                                                    if(p.y >= d){
                                                        p = e + r * 0.91;
                                                        d = sin(p.x * 200.0) + sin(p.z * 200.0);
                                                        if(p.y >= d){
                                                            p = e + r * 1.05;
                                                            d = sin(p.x * 200.0) + sin(p.z * 200.0);
                                                            if(p.y >= d){
                                                                p = e + r * 1.20;
                                                                d = sin(p.x * 200.0) + sin(p.z * 200.0);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        ret = d * 0.3;
        
        dst = pixel4(0.0, ret, 0.0, 1.0);
    }
}
*/