Computers && Coding == Art

PC Affinity [email protected]
Menu
  • Home
  • Downloads
  • Projects
  • About Me

ConsoleWriter

Download latest version from Github

Generate text animations in your console application.

Animate your console app.


Need more pizazz in your Console application? I got you. Want your Console to pop? I got you. Try this easy to use ConsoleWriter resource. It’ll change your life.


Note: So far I’ve only created a few single-line animations. Have not yet ventured to create elaborate multi-line animations.


Still image of completed example

Settings


  • Variables:
    • AniTextColorExplicit = Set color of current character being animated. (Color)
    • TextColorExplicit = Set color of text before/after animation. (Color)
    • BackgroundColor = Set background color of line. (Color)
    • GarbledCharacterString = String of characters used in the Garbled animations. (string)

  • Animation Types:
    • Linear = Display each character at a time from left to right.
    • GarbledRandom = Garbled characters that randomly change to text.
    • GarbledLinear = Garbled characters that change to text from left to right.
    • SlideIn = Characters slide into place from the right side of the screen.

Functions


WriteAnimated(string text, int speed = 100, ConsoleColor? textColor = null, ConsoleColor? animationColor = null, AnimationType aniType = AnimationType.Linear)

WriteLineAnimated(string text, int speed = 100, ConsoleColor? textColor = null, ConsoleColor? animationColor = null, AnimationType aniType = AnimationType.Linear)

WriteLineAnimated(string[] text, int speed = 100, ConsoleColor?[] textColor = null, ConsoleColor?[] animationColor = null, AnimationType aniType = AnimationType.Linear)
  • WriteAnimated
    • text = Text (string)
    • speed = Animation speed (int)
    • textColor = Line text color (ConsoleColor)
    • animationColor = Color of animated character (ConsoleColor)
    • aniType = Custom animation type (AnimationType)

  • WriteLineAnimated
    • text = Line text (string or string[])
    • speed = Animation speed (int)
    • textColor = Line text color (ConsoleColor or ConsoleColor[])
      • If using array, the textColor array location will match the string array location
    • animationColor = Color of animated character (ConsoleColor or ConsoleColor[])
      • If using array, the animationColor array location will match the string array location
    • aniType = Custom animation type (AnimationType)

Simple Example:

ConsoleWriter cw = new ConsoleWriter()
cw.WriteLineAnimated("Animate this line.");

Multiple Animated Examples:

using (ConsoleWriter cw = new ConsoleWriter())
            {
                cw.WriteLineAnimated("".PadRight(Console.BufferWidth - 1, '+'), 20, null, ConsoleColor.Red, AnimationType.GarbledRandom);

                string welcome = "This is my Console Writer script.";
                int padding = ((Console.BufferWidth - 1) / 2) + (welcome.Length / 2);
                welcome = welcome.PadLeft(padding);

                cw.WriteLineAnimated(welcome, 150, null, ConsoleColor.Red, AnimationType.GarbledRandom);
                cw.WriteLineAnimated("");
                Thread.Sleep(500);

                cw.TextColorExplicit = ConsoleColor.Black;
                cw.BackgroundColor = ConsoleColor.Gray;

                cw.WriteLineAnimated("Written by Derrick Ducote for PC Affinity.", 40);
                Thread.Sleep(500);

                cw.GarbledCharacterString = "#";
                cw.BackgroundColor = ConsoleColor.Blue;

                cw.WriteLineAnimated("These are a few examples of it's usage.", 80, null, null, AnimationType.GarbledLinear)
                    .WriteLineAnimated("Please use it responsibly.", 90, null, null, AnimationType.GarbledRandom);
                Thread.Sleep(500);

                cw.BackgroundColor = ConsoleColor.Black;
                cw.WriteLineAnimated("");

                cw.WriteAnimated("Stacking animations/colors: ", 1, ConsoleColor.White, ConsoleColor.Red, AnimationType.SlideIn)
                    .WriteAnimated("1", 100, ConsoleColor.Blue)
                    .WriteAnimated("2", 100, ConsoleColor.Green)
                    .WriteAnimated("3", 100, ConsoleColor.Yellow)
                    .WriteAnimated("4", 100, ConsoleColor.Magenta)
                    .WriteAnimated("5", 100, ConsoleColor.Red)
                    .WriteAnimated("6", 100, ConsoleColor.Blue)
                    .WriteAnimated("7", 100, ConsoleColor.Green)
                    .WriteAnimated("8", 100, ConsoleColor.Yellow)
                    .WriteAnimated("9", 100, ConsoleColor.Magenta)
                    .WriteLineAnimated("0", 100, ConsoleColor.Red);
                Thread.Sleep(500);

                cw.WriteLineAnimated("");

                cw.WriteAnimated("Press ", 10, ConsoleColor.Green, ConsoleColor.Blue)
                    .WriteAnimated("Any Key", 10, ConsoleColor.White, ConsoleColor.Blue)
                    .WriteLineAnimated(" to exit.", 10, ConsoleColor.Green, ConsoleColor.Blue);
                cw.WriteAnimated("Press ", 10, ConsoleColor.Green, ConsoleColor.Blue)
                    .WriteAnimated("'x'", 10, ConsoleColor.White, ConsoleColor.Blue)
                    .WriteLineAnimated(" to repeat.", 10, ConsoleColor.Green, ConsoleColor.Blue);

                cw.WriteLineAnimated(new string[3] { "Array Test: ", "This is a Green string and ", "this is a Yellow string." }, 100, new ConsoleColor?[3] {ConsoleColor.White, ConsoleColor.DarkGreen, ConsoleColor.Yellow });

                cw.WriteLineAnimated("");

            }
Still image of Garbled animation



Please feel free to view the source code over at GitHub. Completely available. Let me know if you have any questions or concerns. And please share with your friends!



Share this:

  • Twitter
  • Facebook
  • SMS
  • Email

Like this:

Like Loading...

Leave a Reply Cancel reply

My LinkedIn Profile


'Derrick Ducote'

Tags

API ASP.NET C# Clipboard Cycler Cloudflare Coding ColorFadeCalculator ConsoleWriter DLL Downloads First FMOL Assistant FMOL Marquee FP Time Tracker Gaming Hotkey Commands HTML Learning MagicHat MagicWheel Mouse Commands NGINX Other Personal PHP Picket Projects RegistryCommands RoundedButtons Server Site Information Synology Toolkit Cleanup

Categories

  • Apps
  • Coding
  • Configurations
  • Other
  • PHP
  • Server
  • Site Information

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

PC Affinity 2023 . Powered by WordPress

%d bloggers like this: