Author Topic: Goofy Hypnotic Eyes  (Read 4877 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Goofy Hypnotic Eyes
« on: October 27, 2019, 12:46:15 am »
A small animated graphics program. Was just random chance that I got it to have a 3D effect playing with math and variables. :)

Code: QB64: [Select]
  1. _TITLE "Goofy Hypnotic Eyes"
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. PAINT (10, 10), _RGB32(255, 177, 127)
  4. FOR t = 1 TO 100 STEP .5
  5.     CIRCLE (400, 550), t, _RGB32(255, t, t), , , 1.5
  6. _LIMIT 1000
  7.     s = 0
  8.     a = a + .5
  9.     IF a > 175 THEN a = 1
  10.     b = INT(RND * 2) + 1
  11.     IF b > 1 THEN c = 255
  12.     IF b = 1 THEN c = 0
  13.     FOR d = a TO 0 STEP -.125
  14.         c = c + 1
  15.         IF c > 255 THEN c = 0
  16.         s = s + 1
  17.         x = COS(s * 3.141592 / 180) * d
  18.         y = SIN(s * 3.151492 / 180) * d
  19.         CIRCLE (x + 200, y + 225), 2, _RGB32(c, 0, 0)
  20.         CIRCLE (x + 600, y + 225), 2, _RGB32(c, 0, 0)
  21.     NEXT d
  22.  

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Goofy Hypnotic Eyes
« Reply #1 on: October 27, 2019, 01:42:16 am »
Cool man! This is the first time I see you using loop instead of goto & gosub.
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Goofy Hypnotic Eyes
« Reply #2 on: October 27, 2019, 05:53:44 am »
Quote
Ashish wrote:
Cool man! This is the first time I see you using loop instead of goto & gosub.

You're absolutely right, Ashish!
Finally, a program in which I can easily and quickly navigate. I hope you stay with this style, SierraKen, because GOTO - GOSUB is a terribly opaque way to work.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Goofy Hypnotic Eyes
« Reply #3 on: October 27, 2019, 08:52:46 am »
Quite a nice animation.

One small note in case you were not aware:
If you use the _LIMIT command it MUST be within the loop.  It doesn't work if you call it outside the loop.

If I am wrong on this, someone can spank me, or slap me.  :P lol

Aye.  Limit works inside the loops.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Goofy Hypnotic Eyes
« Reply #4 on: October 27, 2019, 10:00:27 am »
Goofy? Looks normal to me... lol
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Goofy Hypnotic Eyes
« Reply #5 on: October 27, 2019, 10:29:08 am »
Goofy? Looks normal to me... lol

LOL maybe a little less coffee Johnno

Nice one Ken!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Goofy Hypnotic Eyes
« Reply #6 on: October 27, 2019, 11:32:30 am »
Not spirals but more variation:
Code: QB64: [Select]
  1. _TITLE "Hypnotic Eyes" 'B+   2019-10-27
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3.     cnt = cnt + 1
  4.     IF cnt MOD 20 = 1 THEN cnt = 1: r = RND ^ 2: g = RND ^ 2: b = RND ^ 2
  5.     FOR radius = 0 TO 175 STEP .25
  6.         c = c + .1
  7.         clr~& = _RGB32(127 + 127 * SIN(r * c), 127 + 127 * SIN(g * c), 127 + 127 * SIN(b * c))
  8.         CIRCLE (200, 225), radius, clr~&
  9.         CIRCLE (600, 225), radius, clr~&
  10.     NEXT
  11.     _LIMIT 6
  12.  

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Goofy Hypnotic Eyes
« Reply #7 on: October 27, 2019, 12:23:38 pm »
Wow thanks everyone!!! Yeah I wasn't sure about the _LIMIT, I should have tested that. So I removed it and will put the rest of the code here.
Sometimes I have to use GOSUB's in order for different things to happen when a user does different things. I suppose everything can be in one giant IF / THEN statement of many lines. I'll try to work on that I think. Thanks.

LOL Bplus that's really cool looking! Could be used in a haunted house or carnival. :)

Code: QB64: [Select]
  1. _TITLE "Goofy Hypnotic Eyes"
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. PAINT (10, 10), _RGB32(255, 177, 127)
  4. FOR t = 1 TO 100 STEP .5
  5.     CIRCLE (400, 550), t, _RGB32(255, t, t), , , 1.5
  6.     s = 0
  7.     a = a + .5
  8.     IF a > 175 THEN a = 1
  9.     b = INT(RND * 2) + 1
  10.     IF b > 1 THEN c = 255
  11.     IF b = 1 THEN c = 0
  12.     FOR d = a TO 0 STEP -.125
  13.         c = c + 1
  14.         IF c > 255 THEN c = 0
  15.         s = s + 1
  16.         x = COS(s * 3.141592 / 180) * d
  17.         y = SIN(s * 3.151492 / 180) * d
  18.         CIRCLE (x + 200, y + 225), 2, _RGB32(c, 0, 0)
  19.         CIRCLE (x + 600, y + 225), 2, _RGB32(c, 0, 0)
  20.     NEXT d
  21.