ぶわぁ
/**
* Copyright Kihara ( http://wonderfl.net/user/Kihara )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/oB27
*/
package
{
import flash.events.Event;
import org.papervision3d.view.BasicView;
public class pv3d_sample2_3 extends BasicView
{
private var vector:Vector.<Str>=new Vector.<Str>;
private const N:Number=15;
public function pv3d_sample2_3()
{
for (var i:uint=0; i < N; i++)
{
var abc:Str=new Str(0xFFFFFF * Math.random(), 1500);
vector.push(abc);
for (var j:uint=0; j < vector[i].len; j++)
scene.addChild(vector[i].vec[j]);
}
startRendering();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(e:Event):void
{
for (var i:uint=0; i < N; i++)
{
for (var j:uint=0; j < vector[i].len; j++)
{
vector[i].vec[j].x+=(vector[i].to_x[j] - vector[i].vec[j].x) * 0.05;
vector[i].vec[j].y+=(vector[i].to_y[j] - vector[i].vec[j].y) * 0.05;
vector[i].vec[j].z+=(vector[i].to_z[j] - vector[i].vec[j].z) * 0.05;
vector[i].vec[j].rotationX+=(vector[i].to_x[j] - vector[i].vec[j].rotationX) * 0.05;
vector[i].vec[j].rotationY+=(vector[i].to_y[j] - vector[i].vec[j].rotationY) * 0.05;
vector[i].vec[j].rotationZ+=(vector[i].to_z[j] - vector[i].vec[j].rotationZ) * 0.05;
}
}
camera.x+=(2 * (mouseX - stage.width/2) - camera.x) * 0.2;
camera.y+=(2 * (mouseY - stage.height/2) - camera.y) * 0.2;
}
}
}
import org.papervision3d.materials.special.Letter3DMaterial;
import org.papervision3d.typography.Text3D;
import org.papervision3d.typography.fonts.HelveticaBold;
import org.papervision3d.view.BasicView;
class Str extends BasicView
{
public var vec:Vector.<Text3D>=new Vector.<Text3D>;
public var to_x:Array=[], to_y:Array=[], to_z:Array=[];
public var len:Number;
public function Str(color:Number, r:Number)
{
var material:Letter3DMaterial=new Letter3DMaterial(color);
var font:HelveticaBold=new HelveticaBold();
var string:String=new String("abcdefgABCDEFGunkochinko");
material.doubleSided=true;
len=string.length;
for (var i:uint=0; i < len; i++)
{
vec.push(new Text3D(string.charAt(i), font, material));
to_x.push(r * Math.random() - r / 2);
to_y.push(r * Math.random() - r / 2);
to_z.push(r * Math.random() - r / 2);
}
}
}