TransparencyInterpolator with Text3D

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

It is saying that the method does not exist in the class, are you using an IDE? As an IDE would flag this right away.

im using eclipse do you mean that ? im very new to all this. :persecutioncomplex:

But does it mean that I cant use a transparencyinterpolator for my text 3d ???
is there another solution or what can i do ? =(

Lol don’t worry, you will get the hang of all the terms :o Eclipse is an IDE yes.

It basically means that within the Text3D class, there is no method getAppearance(). What exactly is Text3D? Is this your own class or is it some sort of library you are using?

I hope here is what you need.

Yeah I hope so  :o 

yes Text3d is a library that i am using. 

but i dont know why it doesnt work. as you can see my Text3d object "uses" this appereance so why cant i "get" or "set" it -.- 

[codeAppearance a2 = new Appearance();
			Material m2 = new Material(white, white, white, white, 80.0f);
			m2.setLightingEnable(true);
			a2.setMaterial(m2);

what i know is : with a box or a sphere I can say

box.setAppereance();

there are 0 Problems!

But with Text3d its different ( you can see it in my code ) .

i had to create a Shape3D object and added the appereance “a2” as a paramter.
and the shape3d object is a child of my Transformgroup…

okay i see… it is more complicated with a Text3d… =(

but…but…but…somehow it has to be possible to make a 3dtext visible with an animation ??

oh cool i will take a look on it !!! =) =)

thank you very much Stranger and Gibbo3771 :slight_smile: !!! i hope someday I AM the guy who can help others =)