using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Threading; namespace ConsoleApp11 { class Program { static void Main(string[] args) { while (true) { string defaultString = "A moving line"; for (int i = 0; i < 2; i++) { if (i == 0) { for (int a = 7; a <= 20; a++) { WriteTextInPosition(defaultString, a); Thread.Sleep(42); } } if (i == 1) { for (int a = 19; a > 7; a--) { WriteTextInPosition(defaultString, a); Thread.Sleep(42); } } } } } public static void WriteTextInPosition(string text, int bot) { Console.Clear(); for (int i = 1; i <= bot; i++) { Console.WriteLine(); } Console.WriteLine(String.Format("{0," + ((Console.WindowWidth / 2) + (text.Length / 2)) + "}", text)); } } }