How do you add background to text that changes length based on length of text?


    May 06 2022 | 2:33 pm
    Hi there! I would like to add black background to white text created via [jit.gl.text] so that the text can be read in all circumstances. But considering that text length changes, how do I keep the background the same size on the x axis as the length of the text? I tried a few trick, but nothing works. The whole idea is to look like the one you see in captures / subtitles on Youtube videos. Here is a screenshot as an example taken from https://www.youtube.com/watch?v=6bT3G4Mep7E
    Here is a patch
    Any suggestions? Thank you so much!

    • May 06 2022 | 4:12 pm
      I would use text mode 3d, query the bounds attribute, and use those values as vertices to a jit.gl.mesh. The bounds will adjust to both text input and line_length. You can then use a simple jit.anim.node structure to scale the text and background mesh (with whatever offsets are needed) as appropriate.
    • May 06 2022 | 8:52 pm
      I guess I will really have to learn how to integrate [jit.anim.node], don't I? :) Thank you so much, Rob!