Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to do cool effects in c#
Bunnytoes

I have alway wondered how to do some cool effects, well today I will teach you some. This has some more advanced-ish stuff. The first thing is a typewriter effects
you do Console.Write(); and enter the first letter of the word ex. Console.Write("H"); then do a delay using System.Threading.thread.Sleep(); I recommend about 183 miliseconds for this. then repeat until you get the desired thing credit to @coder100 for the help with the arrow keys. ex.
using System;

class MainClass {
public static void Main (string[] args) {
Console.Write("H");
System.Threading.Thread.Sleep(183);
Console.Write("e");
System.Threading.Thread.Sleep(183);
Console.Write("l");
System.Threading.Thread.Sleep(183);
Console.Write("l");
System.Threading.Thread.Sleep(183);
Console.Write("o");
System.Threading.Thread.Sleep(183);
System.Threading.Thread.Sleep(250);

}
}

The next thing is a processing effect. You simply type Console.WriteLine("Processing.");
System.Threading.Thread.Sleep(200); // short delay
Console.Clear();
Console.WriteLine("Processing..");
System.Threading.Thread.Sleep(200); // short delay
Console.Clear();
Console.WriteLine("Processing...");
System.Threading.Thread.Sleep(200); // short delay
Console.Clear();
Console.WriteLine("Processing.");
System.Threading.Thread.Sleep(200); // short delay
Console.Clear();
Console.WriteLine("Processing..");
System.Threading.Thread.Sleep(200); // short delay
Console.Clear();
etc.
also you can do Console.ForegroundColor = ConsoleColor.Red // pick any color you want
I will attach a list of all text colors.
That is it and I hope this was helpful.

you can also do
Console.BackgroundColor = ConsoleColor.DarkBlue;
// any color
for the background
you can also check for special keys like arrows look down below for an example

case (ConsoleKey.DownArrow):
Console.WriteLine("You chose down");
break;

Voters
JWZ6
Bunnytoes
Comments
hotnewtop
JWZ6

Nice! You can use 3 backticks (`) to style code

Bunnytoes

@JWZ6 could you please give an example

JWZ6

@Bunnytoes

Bunnytoes

@JWZ6 you can't do that in c#

JWZ6

@Bunnytoes oh yeah just givin an example