Graphics

 View Only
  • 1.  Xpression Autofollow Text

    Posted 06-01-2023 17:25
      |   view attached

    Hello! I have been trying my best to figure out how to get a quad to auto follow the length/width of a text with a wordwrap through visual logic. The problem I've been running into is that I can't have the quad follow the text again once it word wraps it to the second line. I've attached an animation reference to what I'm talking about. Let me know if it's even possible to do it. Thanks in advance!



    ------------------------------
    Tani Belliston
    ------------------------------


  • 2.  RE: Xpression Autofollow Text

    Posted 06-05-2023 04:56

    Hi Tani.
    In this case you will need to create some text objects. One of them is for input text and you will need to hide it from online render (put it into a layer object with enabled property 'Render Layer in Preview Only').
    Others of them are for output text with auto follows quads (the maximum amount you can be expected, for example 4) and desable on them 'Publish Object' in the 'Template Links' tab. For eache output text object create a quad with autofollow.
    Then put the scrip below into the input text object 'OnSetText' tab in an  'Edit Script Events' 

            Dim intext() As String = Text.Split(Chr(10))
            Dim outtext(3)
            For i As Integer = 0 To 3
                scene.GetObjectByName("OutText_" + CStr(i), outtext(i)) 'output text objects named as 'OutText_0, OutText_1, OutText_2 and etc'
                outtext(i).Text = ""
            Next
            For i As Integer = 0 To intext.Length - 1
                outtext(i).Text = intext(i)
            Next


    ------------------------------
    Roman Yaroshenko
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------



  • 3.  RE: Xpression Autofollow Text

    Posted 28 days ago

    hello, thank you for the script, I am trying to implement it on xpression 8.5 but somehow it doesn't  work,  even the compilation is ok,



    ------------------------------
    Gerond Taci
    ------------------------------



  • 4.  RE: Xpression Autofollow Text

    Posted 27 days ago

    The layer names are missing the _ underscore i.e. OutText_1 to match what is in the script.



    ------------------------------
    Paul
    ------------------------------



  • 5.  RE: Xpression Autofollow Text

    Posted 27 days ago

    NO I did try it, I don't know what I am doing wrong.

    however I did it may way, the  input text i split anytime you hit enter, so it dos not count the character, I think is more ok like this:

    I put the script on the scene events and in the text events and it worked

    -------------------------------------

    ' Declare variables to reference the text boxes
    dim Text_Input as xpTextObject
    dim Text_Output_1 as xpTextObject
    dim Text_Output_2 as xpTextObject
    dim Text_Output_3 as xpTextObject

    ' Get references to the text boxes
    Self.GetObjectByName("Text_Input", Text_Input)
    Self.GetObjectByName("Text_Output_1", Text_Output_1)
    Self.GetObjectByName("Text_Output_2", Text_Output_2)
    Self.GetObjectByName("Text_Output_3", Text_Output_3)

    ' Split the input text by lines
    dim lines() as string
    lines = Split(Text_Input.Text, vbCrLf)

    ' Assign each line to a different text box
    if UBound(lines) >= 0 then
        Text_Output_1.Text = lines(0)
    else
        Text_Output_1.Text = ""
    end if

    if UBound(lines) >= 1 then
        Text_Output_2.Text = lines(1)
    else
        Text_Output_2.Text = ""
    end if

    if UBound(lines) >= 2 then
        Text_Output_3.Text = lines(2)
    else
        Text_Output_3.Text = ""
    end if

    -------------------------------------------------------------------



    ------------------------------
    Gerond Taci
    Graphic motion designer
    Euronews Albania
    Tirana Albania
    ------------------------------