Author Topic: Black Hole  (Read 3865 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Black Hole
« on: September 30, 2019, 09:28:03 pm »
Hi all,

I was playing with math and graphics again tonight and just out of random luck it made a wild looking spiral-type image. So I threw some changing variables in it and made this animated black hole. The graphics don't change, just the shades of white and gray. The spiral is different than one I made awhile back on my other one and it's not like you expect to see a wormhole or black hole, but I like it, especially for being such a small program. Watch it for like a minute at least because the shades change in different ways. Thanks. Feel free to do what you wish with it, I'm just having fun. :)

Code: QB64: [Select]
  1. _TITLE "Black Hole - by Ken G."
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. bb = 1.1
  4. c = 100
  5. c2 = 155
  6. one1:
  7. _LIMIT 1000
  8. bb = bb + .1
  9. cc = cc + .1
  10. sz = sz + .1
  11. c = c - 1
  12. IF c < 0 THEN c = 100
  13. one:
  14. a$ = INKEY$
  15. IF a$ = CHR$(27) THEN END
  16. b = b + bb
  17. s = (6 - b) * 6 + 180
  18. x = INT(SIN(s / 180 * 3.141592) * 180 / cc) + 400
  19. y = INT(COS(s / 180 * 3.141592) * 180 / cc) + 300
  20. CIRCLE (x, y), 10 - sz, _RGB32(c + c2, c + c2, c + c2)
  21. IF b > 60 THEN
  22.     b = 0
  23.     IF cc > 20 THEN
  24.         cc = 0
  25.         bb = 1.1
  26.         sz = 0
  27.         c2 = c2 + 5
  28.         IF c2 > 155 THEN c2 = 0
  29.     END IF
  30.     GOTO one1:
  31. GOTO one:
  32.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Black Hole
« Reply #1 on: September 30, 2019, 10:06:04 pm »
Here is a colorized version:
Code: QB64: [Select]
  1. _TITLE "Black Hole - by Ken G."
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. bb = 1.1
  4. c = 100
  5. c2 = 155
  6. one1:
  7. _LIMIT 1000
  8. red = RND: green = RND: blue = RND
  9. bb = bb + .1
  10. cc = cc + .1
  11. sz = sz + .1
  12. c = c - 1
  13. IF c < 0 THEN c = 100
  14. one:
  15. a$ = INKEY$
  16. IF a$ = CHR$(27) THEN END
  17. b = b + bb
  18. s = (6 - b) * 6 + 180
  19. x = INT(SIN(s / 180 * 3.141592) * 180 / cc) + 400
  20. y = INT(COS(s / 180 * 3.141592) * 180 / cc) + 300
  21. CIRCLE (x, y), 10 - sz, _RGB32((c + c2) * red, (c + c2) * green, (c + c2) * blue)
  22. IF b > 60 THEN
  23.     b = 0
  24.     IF cc > 20 THEN
  25.         cc = 0
  26.         bb = 1.1
  27.         sz = 0
  28.         c2 = c2 + 5
  29.         IF c2 > 155 THEN c2 = 0
  30.     END IF
  31.     GOTO one1:
  32. GOTO one:
  33.  
  34.  
  35.  

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Black Hole
« Reply #2 on: September 30, 2019, 10:32:13 pm »
WOW I've never seen that use of RND colors before, thanks!
Your version looks a bit like a 1970's game show. :D.

Marked as best answer by SierraKen on October 01, 2019, 04:14:17 pm

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Black Hole
« Reply #3 on: October 01, 2019, 08:14:11 pm »
Here is my updated version I made tonight. I filled in the circles. Then I made it so if someone presses the Space Bar, it automatically changes it all to wild random colors. :) Then press Space Bar again to go back. You can go back and forth. I also call it a Kaleidoscope. Enjoy. 

Code: QB64: [Select]
  1. _TITLE "Black Hole - by Ken G. - Press Space Bar For Wild Colors And Again To Go Back."
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. bb = 1.1
  4. c = 100
  5. c2 = 155
  6. one1:
  7. _LIMIT 1000
  8. bb = bb + .1
  9. cc = cc + .1
  10. sz = sz + .1
  11. c = c - 1
  12. IF c < 0 THEN c = 100
  13. IF cl = 1 THEN
  14.     cl1 = INT(RND * 155) + 1
  15.     cl2 = INT(RND * 155) + 1
  16.     cl3 = INT(RND * 155) + 1
  17. one:
  18. a$ = INKEY$
  19. IF a$ = CHR$(27) THEN END
  20. IF a$ = " " THEN cl = cl + 1
  21. IF cl > 1 THEN cl = 0
  22. b = b + bb
  23. s = (6 - b) * 6 + 180
  24. x = INT(SIN(s / 180 * 3.141592) * 180 / cc) + 400
  25. y = INT(COS(s / 180 * 3.141592) * 180 / cc) + 300
  26. FOR szz = .25 TO 10 - sz STEP .25
  27.     IF cl = 0 THEN CIRCLE (x, y), szz, _RGB32(c + c2, c + c2, c + c2)
  28.     IF cl = 1 THEN CIRCLE (x, y), szz, _RGB32(cl1, cl2, cl3)
  29. NEXT szz
  30. IF b > 60 THEN
  31.     b = 0
  32.     IF cc > 20 THEN
  33.         cc = 0
  34.         bb = 1.1
  35.         sz = 0
  36.         c2 = c2 + 5
  37.         IF c2 > 155 THEN c2 = 0
  38.     END IF
  39.     GOTO one1:
  40. GOTO one:
  41.  
« Last Edit: October 01, 2019, 08:39:24 pm by SierraKen »