• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSXA draw dynamic rectangle in opposite direction

Messages
205
Country
netherlandsantilles
Hi XML gurus,
Im struggling with this animation and decided to post here see wether somebody can give me an idea how to do it.
I want an animation, where a rectangle is dynamically draw starting from a width,height of (0,0) to (20,12), but it has to grow from both side (Left and right).

To have an idea what I want to achieve look at this video (min. 4.59 -5.00) where the baro min box apears on the copilots PFD:

Now I have it partialy working with this code snipet from my PFD but the rectangle animates from left to right and I need it to be both side like in the video.

Code:
        (* Piece in my update section that Draws the  Baro Minimun box regtangle *)
        (A:Decision height, feet) (A:Decision height, feet) 100 + (A:Radio height, feet) rng if{ (L:tel,number) ++ (>L:tel,number) } els{ 0 (>L:tel,number)    } 
      
      (* Piece in the PFD guage that take cares of the rectangle *)
      <Element>
        <Visible>(A:SIM ON GROUND, bool) 0 == if{ (A:Decision height, feet) (A:Decision height, feet) 100 + (A:Radio height, feet) rng } </Visible>
          <Position X="65" Y="55"/>
          <Rectangle Width="20" Height="12" Bright="Yes" FillColor="black">
            <WidthCode>(L:tel,number) 2 / </WidthCode>
            <HeightCode>(L:tel,number) 3.6 / </HeightCode>
          </Rectangle>
      </Element>

Don't put much attention on my coding my way of programming in XML is somewhat goofy but it works. I'm dividing (L:tel, number) just to create some delay since I use simulator frequency for animation 1/18.

Any idea how i can achieve what is seen in the video using a more efficient code in XML?
thanks.
Adino
 
Try to add a Shift code. With Shift (X and Y) and Width/HeightCode you should be able to have full control of the rectangle.
 
Hi Luka,
Thank you for pointing me in the right direction, However I have never seen a code snippet with the shift code being used together with the rectangle code I have no idea how I would combine those two to achieve the animation. Any gauge (pseudo) code or snippet that can point me into the right direction?
 
Code:
<Element>
    <Visible>(A:SIM ON GROUND, bool) 0 == if{ (A:Decision height, feet) (A:Decision height, feet) 100 + (A:Radio height, feet) rng }</Visible>
    <Position X="65" Y="55"/>
    <Rectangle Width="20" Height="12" Bright="Yes" FillColor="black">
        <WidthCode>(L:tel,number) 2 / </WidthCode>
        <HeightCode>(L:tel,number) 3.6 / </HeightCode>
    </Rectangle>
    <Shift><Value>(L:tel,number) 2 / 20 min 2 /</Value><Scale X="-1"/></Shift>
    <Shift><Value>(L:tel,number) 3.6 / 12 min 2 /</Value><Scale Y="-1"/></Shift>
</Element>
 
Hi Luka,
Brilliant! worked like a charm! I never knew you could use the code that way, it opens a world of posibilities for me now.
Thank you so much awesome knowledge around here.
 
Back
Top