⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 move_in_axis_direction.java

📁 一个java3D的动画程序
💻 JAVA
字号:
/*
 * Created on 2005-7-17
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package Move;

/**
 * @author carso
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
import com.sun.j3d.utils.geometry.ColorCube; 
import javax.media.j3d.*; 
import javax.vecmath.*;


public class Move_In_Axis_direction {
	
	 public BranchGroup Move_in_direction(float startpoint,float endpoint){
	 	BranchGroup objRoot=new BranchGroup();
	 	BranchGroup bg_createAnim=null;
	 	//set bounding sphere
	 	BoundingSphere bound=new BoundingSphere(new Point3d(0.0,0.0,0.0),400.); 

	 	//create a TransformGroup
	 	Transform3D tr1=new Transform3D();
	 	TransformGroup trans1=new TransformGroup(tr1);
	 	trans1.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	 	
	 	//create a Color cube
	 	ColorCube cube1=new ColorCube(0.5);
	 	trans1.addChild(cube1);
	 	
	 	//set cube1 to move 
	 	Alpha xtranAlpha = new Alpha(-1, 
                Alpha.DECREASING_ENABLE|Alpha.INCREASING_ENABLE, 
				 0, 0,0, 0, 0,2000, 0, 0);
	 	PositionInterpolator pos1=new PositionInterpolator(xtranAlpha,trans1,tr1,startpoint,endpoint);
	 	pos1.setSchedulingBounds(bound);
	 	trans1.addChild(pos1);
   
   
	 	objRoot.addChild(trans1);
        return objRoot;
	 }
	 public Move_In_Axis_direction()
	 {
	 	System.out.println("Move_In_Axis_direction Class draw a cube and move in a direction");
	 	
	 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -