steven_EXC Posted October 19, 2016 Share Posted October 19, 2016 Hey guys, just wondering if there's a way to set the transparency of a Text2D object (or a ScreenSpaceCanvas2D object) after it has been created? I'm assuming this functionality is somewhere but I can't find it or figure it out. Kemal UÇAR 1 Quote Link to comment Share on other sites More sharing options...
Steffen Posted October 20, 2016 Share Posted October 20, 2016 Hi @steven_EXC there is a ScreenSpaceCanvas2D.opacity property. A value of 0.5 equals to 50% transparency. The Text2D object has this property too. But I don't know whether you can change the Text2D opacity after it has been used inside a ScreenSpaceCanvas2D object. I think it's internally baked or something... Then use simply the canvas.opacity property. Kemal UÇAR 1 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted October 21, 2016 Share Posted October 21, 2016 can you create a playground ?http://babylonjs-playground.com/#TQFJR#1 Steffen 1 Quote Link to comment Share on other sites More sharing options...
Steffen Posted October 21, 2016 Share Posted October 21, 2016 @Nabroski Thanks, I did not know you can simply change the content after all. I really can use it for one of my projects. But I have a some questions: 1. Is there any reason for the rect2D? Why not setting the text2D directly as a child of the canvas2D? -> http://babylonjs-playground.com/#TQFJR#2 2. Why did you use onAfterCameraRenderObservable and not registerBeforeRender? Quote Link to comment Share on other sites More sharing options...
steven_EXC Posted October 21, 2016 Author Share Posted October 21, 2016 So this is a little embarrassing. Here's basically what I was doing in my code before I posted: http://babylonjs-playground.com/#TQFJR#3 As you can see, it works. I should've just created a playground with my issue and I would've seen that it was working fine. My issue was that I wasn't using the right version of babylon. As soon as I grabbed an updated version, it all worked fine. There must've been something wonky in the version I was using before. Sorry for the mix-up. Thanks for your help guys! Quote Link to comment Share on other sites More sharing options...
Nabroski Posted October 21, 2016 Share Posted October 21, 2016 Hey Steffen, Greetings to Hanover, i remember we started here in the Forum at the same time! "Why did you use onAfterCameraRenderObservable and not registerBeforeRender? " I use Scene Optimization and sometimes, it happens my models wont load when Babylon don't CompileAndRun after(CameraRender) - so the 1Frame is ready, this way i never facing problems. I'm also an experimental nature, i have to keep a basic work set from witch i expect a working behavior when turning the knobs all the way up in other areas. You also see at my post count i have contribute some of playgrounds here, so, basically i copy paste stuff that i already got few month ago.http://babylonjs-playground.com/#TQFJR#5 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.