forked from: フォントぐるぐる

by bunta
♥0 | Line 53 | Modified 2010-02-05 18:37:00 | MIT License
play

ActionScript3 source code

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

// forked from maccyan's フォントぐるぐる
package{
	import flash.events.*;
	import flash.utils.*;
	import org.papervision3d.objects.primitives.*;
	import org.papervision3d.materials.*;
	import org.papervision3d.materials.special.*;
	import org.papervision3d.typography.fonts.*;
	import org.papervision3d.typography.*;
	import org.papervision3d.view.*;
	
	[SWF(backgroundColor=0xffffff,frameRate=30)]
	public class Font3DSample extends BasicView{
		private var word1:Text3D;
		private var word2:Text3D;
		private var word3:Text3D;
		public function Font3DSample():void{
			
			camera.zoom = 100;
			
			var material2:Letter3DMaterial = new Letter3DMaterial(0x000000);
			material2.doubleSided = true;
			
			var font:HelveticaBold = new HelveticaBold();
			word1 = new Text3D("bunta",font,material2);
			word1.x = -160;
			word1.y = 130;
			word1.z = 90;
			scene.addChild(word1);
			
			word2 = new Text3D("Scratchin",font,material2);
			word2.x = 110;
			word2.y = 0;
			word2.z = -30;
			scene.addChild(word2);
			
			word3 = new Text3D(".Com",font,material2);
			word3.x = -80;
			word3.y = -100;
			word3.z = -110;
			scene.addChild(word3);
			
			var plane:Plane = new Plane(new WireframeMaterial(0x0066FF),1000,1000,15,15);
			plane.rotationX = 90;
			plane.y = -230;
			scene.addChild(plane);
			
			startRendering();
			addEventListener(Event.ENTER_FRAME,loop);
		}
		
		private function loop(e:Event):void{
			word1.rotationY += 2.3;
			word2.rotationY -= 0.9;
			word3.rotationY += 1.5;
			var rot:Number = mouseX / stage.stageWidth * 360;
			camera.x = 3000 * Math.sin(rot * Math.PI / 180);
			camera.z = 3000 * Math.cos(rot * Math.PI / 180);
			camera.y = mouseY / stage.stageHeight * 3000;
			camera.zoom = mouseY / stage.stageHeight * 600;
		}
	}
}

Forked