Jump to content

Ize
 Share

Recommended Posts

Hey,

for my project i need a scrolling text view.

I've managed to get a clunky version working but it's not optimal since you have to play around with the values every time the text changes:

http://playground.babylonjs.com/#DZ7134

Is there a better way (there must be, i just suck at js :D) to do this?

Thanks in advance.

Link to comment
Share on other sites

cool but coming back to my original question... how do i improve it?

if you change the  gameDesc.text variable and put in shorter or longer text the timing will be off or, depending on how short the text is, it will fit in the rectangle and doesn't even need to scroll.

can i calculate how big the text / texttexture? will be given the font size / width of the object and use that so it won't truncate my text if it's longer or stop the setinterval if the text fits within it's parent?

Link to comment
Share on other sites

So you have font size info in the textblock object. It is inside control.fontOffset.height

This is the height for one line.

Then after rendering, you can get the number of lines with control.lines

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...