Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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,866
    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!