Guest User

Untitled

a guest
May 16th, 2021
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.83 KB | None | 0 0
  1. typedef float f;
  2. f iterations, channel_offset, real, imaginary, temp, size = 60;
  3.  
  4. v()
  5. {
  6.     return (iterations > 999) ? 0 : 255u * (sin(0.1f * iterations + channel_offset++) / 2.000 + 0.500f);
  7. }
  8.  
  9. main()
  10. {
  11.     for (f y = 0; y++ < size;)
  12.     {
  13.         for (f x = 0; x++ < size * 2;)
  14.         {
  15.             channel_offset = 4;
  16.             real = imaginary = iterations = 0;
  17.             for (; real * real + imaginary * imaginary < 4 && iterations++ < 1000;)
  18.             {
  19.                 temp      = real * real - imaginary * imaginary + x / .7  / size - 2.1;
  20.                 imaginary = real * imaginary * 2                + y / .35 / size - 1.4;
  21.                 real      = temp;
  22.             }
  23.             printf("%c[48;2;%d;%d;%dm ", 27, v(), v(), v());
  24.         }
  25.        
  26.         puts("");
  27.         usleep(60000);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment