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: forked from: forked from: forked from: forked from: Text3Dの練習

Get Adobe Flash player
by bunta 08 Feb 2010
    Embed
// forked from bunta's forked from: forked from: forked from: forked from: Text3Dの練習
// forked from bunta's forked from: forked from: forked from: Text3Dの練習
// forked from Stepan's forked from: forked from: Text3Dの練習
// forked from paq's forked from: Text3Dの練習
// forked from rsakane's Text3Dの練習
package 
{
	import org.papervision3d.view.*;
	import org.papervision3d.materials.special.Letter3DMaterial;
	import org.papervision3d.typography.Text3D;
	import org.papervision3d.typography.fonts.HelveticaBold;
	import flash.events.*;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import net.hires.debug.Stats;

        [SWF(backgroundColor="#ffffff", frameRate=40)]
	public class PV3D extends BasicView
	{
		private var text:Text3D;
		private var words:Array;
		private const SIZE:int = 14;
		private const GRAVITY:int = -1;
		
		public function PV3D()
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			var letter:Letter3DMaterial = new Letter3DMaterial();
			letter.fillColor = 0x000000;
			letter.doubleSided = true;
			
			var str:String = "FUCKYOUfuckyou0123456789:@)('&%$#!";
			text = new Text3D(str, new HelveticaBold(), letter);
			words = new Array(SIZE);
			for (var i:uint = 0; i < SIZE; i++)
			{
				var char:Char = new Char();
				char.initialize();
				
				words[i] = char;
				
				text.letters[i].x = -200 + Math.random() * 400;
                                text.letters[i].rotationY = -50 + Math.random() * 100
			}

			addChild(new Stats());			
			scene.addChild(text);
			startRendering();

		}

		override protected function onRenderTick(event:Event=null):void
		{
			for (var i:uint = 0; i < SIZE; i++)
			{
				text.letters[i].x += words[i].vx;
				text.letters[i].y += words[i].vy;
				text.letters[i].z += words[i].vz*4;
				text.letters[i].rotationX += words[i].vx;
				text.letters[i].rotationY += words[i].vy;

				words[i].vy += GRAVITY;
				
				if (text.letters[i].y < -500)
				{					
					text.letters[i].x = -200+Math.random()*400;
					text.letters[i].y = 0;
					text.letters[i].z = 0;
					text.letters[i].scaleX = text.letters[i].scaleY = Math.random() * 5;
					
					words[i].initialize();
				}
			}
			
			super.onRenderTick(event);
			
			camera.x += (2000 * Math.sin(mouseX / stage.stageWidth * 360 * Math.PI / 180) - camera.x) * .1;
			//camera.z += (2000 * Math.cos(mouseX / stage.stageWidth * 360 * Math.PI / 180) - camera.z) * .1;
			//camera.y += (2000 * mouseY / stage.stageHeight - camera.y) * .1;
		}
	}
}

class Char
{
	public var vx:int;
	public var vy:int;
	public var vz:int;
		
	public function initialize():void
	{
		this.vx = Math.random() * 30 - 10;
		this.vy = Math.random() * 50;
		this.vz = Math.random() * 50 - 10;
	}
}