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

Amphisbaena2

Get Adobe Flash player
by k3lab 11 Jan 2010
    Embed
/**
 * Copyright k3lab ( http://wonderfl.net/user/k3lab )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/e5Go
 */

package {
	import flash.display.*;
	import flash.system.LoaderContext;
	import flash.events.Event;
	import flash.filters.BlurFilter;
	import flash.geom.Point;
	import flash.net.URLRequest;
	import jp.progression.data.*;
	import jp.progression.commands.lists.SerialList;
	import jp.progression.commands.net.LoadBitmapData;
	[SWF(width="465", height="465", frameRate="60", backgroundColor="0x000000")] 
	public class Test  extends Sprite{
		public static var GRAPHIC_URL:String ="http://www.k3lab.com/wonderfl/Amphisbaena/photo1.jpg"
		public function Test (){
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		private function init(e:Event = null):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			var list:SerialList = new SerialList(null,
				new LoadBitmapData(new URLRequest(GRAPHIC_URL),{context:new LoaderContext(true)}),
				function ():void {
					var bitmap:Bitmap = new Bitmap(getResourceById(GRAPHIC_URL).data);
					var canvas:BitmapData = bitmap.bitmapData.clone();
					var blur:BlurFilter = new BlurFilter(30, 30, 1);
					canvas.applyFilter(canvas, canvas.rect, new Point(0, 0), blur); 
					var b:Bitmap = addChild(new Bitmap(canvas)) as Bitmap
					b.scaleX = b.scaleY = 3;
					var snake:Snake = addChild(new Snake(bitmap.bitmapData)) as Snake;
				}
			)
			list.execute();
		}
	}
}
import org.papervision3d.events.FileLoadEvent;
import org.papervision3d.core.geom.renderables.Vertex3D;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.materials.BitmapFileMaterial;
import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.materials.shadematerials.EnvMapMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.objects.parsers.Collada;
import org.papervision3d.view.BasicView;
import flash.display.BitmapData;
import flash.events.Event;
import flash.net.URLRequest;
class Snake extends BasicView{
	public static var COLLADA_URL:String ="http://www.k3lab.com/wonderfl/Amphisbaena/Amphisbaena.DAE"
	private var _bmd:BitmapData;
	private var _arr:Array=[];
	private var _collada:Collada;
	private var _light:PointLight3D;
	public function Snake(bmd:BitmapData){
		super(465, 465, false, true);
		_bmd = bmd;
		init();
	}

	private function init():void{
		_light = new PointLight3D(false, false);
		var envMapMaterial:EnvMapMaterial = new EnvMapMaterial(_light, _bmd, _bmd,0);
		var materialsList:MaterialsList = new MaterialsList(); 
		materialsList.addMaterial( envMapMaterial, "Mat"); 
		_collada = new Collada(COLLADA_URL, materialsList, 0.045);
		_collada.addEventListener(FileLoadEvent.LOAD_COMPLETE, DAELoaded);
		_collada.z = 200;
		_collada.y = -200;
		scene.addChild(_light);
		scene.addChild(_collada);
       startRendering();  
	}
	private function loop(e:Event):void {
		_light.copyPosition(camera) 
		_collada.yaw((200- mouseX )/40);
		wavy();
	}
	private function wavy():void {
		var i:int;
		for each (var v:Vertex3D  in _collada.getChildByName("Spring01", true).geometry.vertices){
             v.z = _arr[i].z +Math.random() * 10;
			 v.x = _arr[i].x +Math.random() * 20;
			 i++;
		}
	}
	private function DAELoaded(e:Event):void {
		var i:int;
		for each (var v:Vertex3D  in _collada.getChildByName("Spring01", true).geometry.vertices){
			_arr[i]={x:v.x,y:v.y,z:v.z}
			i++;
		}
		addEventListener(Event.ENTER_FRAME, loop);
	}
}