Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How Do I Horizontally Scroll Text Like A News Ticker?

Discussion in 'UI Toolkit' started by ShokWayve, Nov 22, 2023.

  1. ShokWayve

    ShokWayve

    Joined:
    Jan 16, 2013
    Posts:
    136
    Greetings,

    I want to create a news ticker where the text scrolls up vertically into the ticker area, then horizontally moves to the left until it is off the screen.

    Any suggestions on how I might do this in UI Toolkit?

    Thanks!
     
  2. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    476
    Hi @ShokWayve!

    Have you thought about using USS transitions ? You could do something like this to move a VisualElement from left to right.

    Code (CSharp):
    1. .animated-text {
    2.     position: absolute;
    3.     left: 0%;
    4.     transition: left 2s ease-in-out;
    5. }
    6.  
    7. .animated-text.move-right {
    8.     left: 100%;
    9. }
    The move-right class, when added to the element, will animate it to the right of the screen.