Created
January 27, 2025 14:17
-
-
Save JustinJohnWilliams/06fa4cd4e1bc542a9a6d9b222350e924 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.Threading; | |
class Program | |
{ | |
static void Main() | |
{ | |
Console.OutputEncoding = Encoding.UTF8; // Ensure proper encoding for ANSI colors | |
Console.CursorVisible = false; // Hide the cursor for better visual effect | |
int width = Console.WindowWidth; | |
int height = Console.WindowHeight; | |
int tickCount = 0; | |
// List of color and position functions to create patterns | |
Func<int, int, int, int>[] colorFunctions = | |
{ | |
(x, y, t) => (x * y + t) % 16, // Spiral-like | |
(x, y, t) => (x ^ y + t) % 16, // Diagonal waves | |
(x, y, t) => ((x + t) * (y + t)) % 16, // Expanding grid | |
(x, y, t) => (x * x + y * y + t) % 16, // Circular waves | |
(x, y, t) => (x + y + t) % 16, // Horizontal waves | |
(x, y, t) => (x | y | t) % 16, // Flickering pattern | |
(x, y, t) => ((x - t) * (y + t)) % 16, // Flowing diagonals | |
}; | |
while (true) | |
{ | |
int T = tickCount; | |
int patternIndex = (T / 60) % colorFunctions.Length; // Change pattern every few seconds | |
var colorFunction = colorFunctions[patternIndex]; | |
// Clear the screen for a fresh pattern | |
Console.Clear(); | |
// Generate the current pattern | |
for (int y = 0; y < height; y++) | |
{ | |
for (int x = 0; x < width; x++) | |
{ | |
int colorValue = colorFunction(x, y, T); | |
Console.SetCursorPosition(x, y); | |
Console.ForegroundColor = (ConsoleColor)(colorValue % 16); | |
Console.Write("█"); // Draw a colored block | |
} | |
} | |
Thread.Sleep(50); // Control frame rate | |
tickCount++; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment