Graphics

 View Only
  • 1.  Bounding Box -> Scale VL

    Posted 07-11-2018 18:24
    Howdy,

    I often use the Bounding Box Width Scaled function of one object to drive the Position of another object with VL. This is quite easy to do, but now I need the bounding box of a piece of text to control the Scale X of another object, and this is proving to be a bit trickier, since bounding box is presented as pixel width, and scale is presented as 1=100 and 0=0. I imagine there is some manner of math operation which makes this work, anyone have any ideas?


  • 2.  RE: Bounding Box -> Scale VL

    Posted 07-11-2018 19:01

    See screenshot:


    #XPression


  • 3.  RE: Bounding Box -> Scale VL

    Posted 07-11-2018 21:09
    Interesting... I get why this would work in looking at it. It didn't for me, however, i and I thunk I know why. The text is Left justified, and the quad has it's pivot point all the way over to its right edge.
    #XPression


  • 4.  RE: Bounding Box -> Scale VL

    Posted 07-17-2018 23:41
    So, I have a clearer picture of why this setup isn't working for me... this makes the quad scale larger on X as the width of the text's bounding box increases. I need the opposite to happen, I need a quad to decrease it's x scale as the text bounding box width increases.

    The quad in question is really a line which stretches between the category and the stat, like "INT -------- 1" except the line is solid of course. I have the INT text justified to the Left and, and the pivot point of the line on it's far right. The Idea being that if they choose to put a longer category name in there like Comp/Att, the line separator would need to be shorter, like "COMP/ATT --- 9/10".

    I've tried subtraction and negative multipliers (which ostensibly is just another kind of subtraction) but these result in negative scaling values, which I don't want. I need the scaling value to stay positive, but decrease relative to the length of the category text bounding box width.

    head scratcher
    #XPression


  • 5.  RE: Bounding Box -> Scale VL

    Posted 07-18-2018 00:24
    I would still use the method from the earlier post, but apply it to a mask instead. The mask you use here would be just for that solid line and would mirror the bounding box of the text field.
    #XPression


  • 6.  RE: Bounding Box -> Scale VL

    Posted 07-18-2018 00:33
    Yeah, I considered doing masks and stuff, and I probably will have to, but I already have all of those things neatly organized, revealing with masks in a certain way and with a particular hierarchy, this means unraveling a considerable amount of work and rebuilding, so I was hoping before deploying that nuclear option, I might find an elegant solution with VL... hey, a boy can dream...
    #XPression


  • 7.  RE: Bounding Box -> Scale VL

    Posted 07-18-2018 08:29

    Scale can be computed as "width between the 2 texts" divide by "quad width". Following the description of your project (with use of pivot...) Visual Logic would be something like :


    To avoid using pivot, and manual positioning of the line , you can tell Visual Logic to automatically compute position and width of the line :


    With this solution, line will follow the two texts if you change their position.

    See project attached : [ATTACH]n16634[/ATTACH]

    Hope it helps.


    #XPression


  • 8.  RE: Bounding Box -> Scale VL

    Posted 07-18-2018 17:18
    THAT'S what I'm talking about, Amignon! Thanks for this, i will be dissecting it shortly. Cheers!
    #XPression


  • 9.  RE: Bounding Box -> Scale VL

    Posted 07-24-2018 17:50
    Amignon, you should really write a book man, your solutions to these VL mysteries are consistently spot on. I owe you many libations my friend. Brilliant.
    #XPression


  • 10.  RE: Bounding Box -> Scale VL

    Posted 07-24-2018 18:15

    So, my final setup for this varied a bit from your example (I used your #2 setup), as I needed the line width to change with both the cat text length and the stat text length while also respecting auto squeeze limits, and I needed to offset the stat text in this manner as that bit was right justified, so the line was extending through the text field. Here's where my rig ended up, for the sake of helping anyone else who comes across this thread:


    #XPression