Here's a C++ console script that creates a mesmerizing color animation effect using ASCII characters. While console graphics are limited, this creates a hypnotic pattern with rotating colors:
#include <iostream>
#include <windows.h>
#include <cmath>
using namespace std;
void SetCursorPosition(int x, int y) {
COORD coord = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void SetColor(int color) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
}
int main() {
const int centerX = 40;
const int centerY = 12;
const int radius = 15;
const char symbols[] = ".,:;+*#@";
const int colorCount = 16;
// Hide cursor
CONSOLE_CURSOR_INFO info = {100, FALSE};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
while (true) {
system("cls");
for (float angle = 0; angle < 6.28; angle += 0.1) {
for (int r = 0; r < radius; r += 2) {
// Calculate coordinates with wave effect
float wave = sin(angle * 3 + r * 0.2) * 5;
int x = centerX + cos(angle) * (r + wave);
int y = centerY + sin(angle) * (r + wave) / 2;
// Color cycling
int color = (r + angle * 5) % colorCount + 1;
// Symbol selection
char symbol = symbols[(r / 2 + angle * 2) % (sizeof(symbols)-1)];
SetColor(color);
SetCursorPosition(x, y);
cout << symbol;
}
}
Sleep(100);
}
return 0;
}
To compile and run:
- Save as
cool_graphics.cpp
- Compile with:
g++ cool_graphics.cpp -o cool_graphics.exe
- Run in a dark console for best effect
Features:
- Color cycling through 16 console colors
- Animated wave pattern using ASCII characters
- Rotating radial design
- Hidden cursor for cleaner look
- Smooth animation with 100ms frame rate
Note: Console graphics are limited compared to modern GPU-accelerated graphics, but this creates a hypnotic, colorful display using only text characters. For true graphical applications, you'd need a graphics library like SFML, OpenGL, or Raylib.