Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Animating slide-in from side of screen

Discussion in 'UGUI & TextMesh Pro' started by hamstar, Aug 25, 2014.

  1. hamstar

    hamstar

    Joined:
    Sep 25, 2013
    Posts:
    84
    I animated a Text object to slide in from the left of the screen, stop at the centre, then slide out the other side. It all worked perfectly until I started testing with different aspect ratios and resolutions. I can't think of how to ensure the the Text RectTransform lines up with the screen edge at the start and end of the animation.

    Has anyone got any tips on how to do slide in/out animations for GUI elements?
     
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    The anchors can be animated. You can set the anchors to be at the left side at the start, stop in the center, and then go to the right side at the end.

    Basically, the same way you use anchors to ensure correct placement for different aspect ratios in a static layout can also be used with animation.
     
  3. hamstar

    hamstar

    Joined:
    Sep 25, 2013
    Posts:
    84
    Thank you that worked perfectly!