Hey guys ! =)
I have got a 3D Text ! when I start my program i want that my text is invisible and then becomes visible (animation) !! i thought I can handle it with a TransparencyInterpolator. I found an example where they have used an Interpolator to make a cube visible but it seems that it wont work with text3d because I have 2errors in my code.
this is what i have:
.
.
.
BranchGroup branch = new BranchGroup();
Color3f white = new Color3f(1.0f, 1.0f, 1.0f);
Color3f red = new Color3f(1.0f,0f,0f);
Font3D f4d = new Font3D(new Font("Arial", Font.PLAIN, 1),
new FontExtrusion());
Text3D text1 = new Text3D(f3d, new String("Haunted House"), new Point3f(0,
0, 0));
text1.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
text1.setString("Release the ghosts");
Appearance a2 = new Appearance();
Material m2 = new Material(white, white, white, white, 80.0f);
m2.setLightingEnable(true);
a2.setMaterial(m2);
text1.setAppearance(); // this line is wrong
Shape3D sh1 = new Shape3D();
sh1.setGeometry(text1);
sh1.setAppearance(a2);
TransformGroup tg1 = new TransformGroup();
Transform3D t4d = new Transform3D();
t4d.setScale(0.15);
Vector3f v4f = new Vector3f(0.03f, -0.6f, -4.6f);
t4d.setTranslation(v4f);
t4d.setRotation(new AxisAngle4f(0,1,0,(float)Math.toRadians(-25)));
tg1.setTransform(t4d);
tg1.addChild(sh1);
branch.addChild(tg1);
// TransparencyInterpolator
Alpha objektAlpha = new Alpha(1, 5000);
BoundingSphere view = new BoundingSphere();
TransparencyAttributes objTransp = new TransparencyAttributes();
objTransp.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
objTransp.setTransparencyMode(TransparencyAttributes.BLENDED);
TransparencyInterpolator traInt = new TransparencyInterpolator
(objektAlpha, objTransp);
traInt.setSchedulingBounds(view);
Appearance transpAppear = text1.getAppearance(); // and this line is wrong
transpAppear.setTransparencyAttributes(objTransp);
return branch;
i get this error : The method getAppearance() is undefined for the type Text3D
but why ??? I think i need this lines of code ! =(
can anybody help me with this ?? maybe there is another way ?
ps. sorry for my bad english! im working on it !
cheers, david