Graphics

 View Only
  • 1.  Set Key value through visual logic

    Posted 09-06-2018 13:06
    Hi there!
    We ran into a little issue here that we hope to solve through visual logic and not scripting (no one here really knows how to script in Xpression).

    So, we're working on an animation that animates up from a lower-third graphic.
    The height of this block is based on how many lines of text there is (we got this covered in VL).

    However the issue now is that at frame 0 it is out of sight of course, and through 10 frames it animates in to position Y based on the height of the box.
    Now this is no problem if we know how high the box of text allways is, however as this can be from 1 to 10 lines of text, the height of this box changes dynamically.

    How do I define the value of box' position-Y at frame 10?


  • 2.  RE: Set Key value through visual logic

    Posted 09-07-2018 13:39

    Hello astalsberg,

    You can add a parent group (named Group_Parent_ToAnim for exemple ) to the group of objects you want to animate (the box in your case).
    Animate the parent group instead of your box, make sure Group_Parent_ToAnim.y = 0 at the end of the animation.

    With this first approach, this can do the trick for a very simple animation. The animation will be the same for every case, it just applies Y offset defined by your box


    A second approach, is to use Visual Logic to add some dynamics :

    • create a independant group (named Group_Anim_Input for example ) .
    • use Group_Anim_Input.y as input of your logic blocks , and Group_Parent_ToAnim.y as output (and again make sure Group_Parent_ToAnim.y = 0 at the end of the animation).

     



    Your logic blocks can be defined to adjust speed, start position depending on the number of lines.
    This should again to the trick for a simple linear translation.


    If you need to have specific animations for each case , a third approach could be to use VIsual Logic on scene directors :

    • Create one scenedirector/animation for each value of "number of lines" (sceneDir_1Lines, sceneDir_2Lines, ...).
    • Create a main scene director (SceneDir_Main) with "blank" animation
    • In Visual Logic , link SceneDir_Main.position block to sceneDir_XLines.position block
    • Play SceneDir_Main to animate the scene.




    Here is a sample project with the three approachs : [ATTACH]n17030[/ATTACH]

    Hope it helps.


    #XPression


  • 3.  RE: Set Key value through visual logic

    Posted 09-08-2018 23:51
    @amignon Great! Thanks! Really appreciate the effort, and I think I understand it somewhat!
    Option 3, wich would give me the most alternatives arent and option though, as I dont have the "Output Selector" in the version we're using...Gotta work with the version we have atm..
    Thanks anyways..

    Now, first and second option are decent sollutions as well, and should work in my case! However... In both examples, the value of the lines of text are both given by a text field.
    Is there a way to take the text field and extract/get the number of lines it contains though? Again, really appreciate the effort here! :D
    #XPression


  • 4.  RE: Set Key value through visual logic

    Posted 09-10-2018 13:22
    Add a hidden text object to your scene, containing only one line of text, and with the same font as your multi-line text.

    Divide boundingbox.height of the multi-line text by the boundingbox.height of the single line text to get number of lines.
    #XPression


  • 5.  RE: Set Key value through visual logic

    Posted 09-12-2018 10:56
    Hey @amignon

    We used your second alternative for this by the way.

    Was looking through this again today, and set it up for our current project.
    However I looked through the logic and how things set up and what value it gives back..

    For what I could see (in my project), regardless of the amount of lines, the value returned from the Input Selector was allways the same value regardless of the number of lines.
    I also used a different approach to set the height of the lower third background.

    First I positioned the pivot of the background to it's top left corner with Visual Logic, and set it's height based on the texts bounding box heigth + a small offset.
    I also have some other VL to place the text etc. So maybe more boxed, but easier to understand IMO. But!
    This gives me a set height for the box allready! Meaning I dont have to use the upper part of your visual logic either in order to get the height of the box set based on number of lines.
    I still needed the nesting logic of groups etc, so that was immensly helpfull!

    This simplifies the total visual logic down to very few parts.
    I've attached a test file for you where you can see the version I ended up with.
    You can simply add more lines to the text field, and the animation will adapt accordingly, without the need of the number of lines.

    Thanks again for putting me on the right track!
    #XPression