Author Topic: Lava Lamp  (Read 4895 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Lava Lamp
« on: December 13, 2019, 02:14:33 am »
I've wanted to make one of these since I was a kid, and finally did it. It's not exactly like a lava lamp in that there's no movement inside of it. But the lava forms up and up as it gets hotter and hotter and then it forms down and down when it cools off. Then all of the lava fades out and starts over again. :) Just something I threw together tonight. I also added a fade in and out brightness of the glass border. I know the details could be better, etc. so I might work on that a bit later. But for now, what do you think of it?

Note: There's a much better one after this one with movement.

Code: QB64: [Select]
  1. _TITLE "Lava Lamp - by Ken G."
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. LINE (300, 100)-(500, 500), _RGB32(127, 127, 150), B
  4. b = 50
  5. 'Going Up!
  6. up:
  7. y = 496
  8. t = 1
  9. tt = 0
  10. ttt = 0
  11.     _LIMIT 30
  12.     IF bb = 1 THEN b = b + 1
  13.     IF bb = 2 THEN b = b - 1
  14.     IF b < 51 THEN bb = 1
  15.     IF b > 255 THEN bb = 2
  16.     LINE (300, 100)-(500, 500), _RGB32(b, b, b), B
  17.     xx = (RND * 185) + 306
  18.     t = t * 1.005
  19.     yy = y - t
  20.     IF yy < 108 THEN
  21.         yy = 108
  22.         tt = tt + 1
  23.         IF tt > 15 THEN
  24.             GOTO down:
  25.         END IF
  26.     END IF
  27.     szz = (RND * 10) + .25
  28.     r = RND * 2
  29.     FOR sz = .25 TO szz
  30.         CIRCLE (xx, yy), sz, _RGB32(255, 0, 0), , , r
  31.     NEXT sz
  32.  
  33. 'Going Down!
  34. down:
  35. t = 1
  36. tt = 0
  37. y = 108
  38.     _LIMIT 30
  39.     IF bb = 1 THEN b = b + 1
  40.     IF bb = 2 THEN b = b - 1
  41.     IF b < 51 THEN bb = 1
  42.     IF b > 255 THEN bb = 2
  43.     LINE (300, 100)-(500, 500), _RGB32(b, b, b), B
  44.     xx = (RND * 185) + 306
  45.     t = t * 1.005
  46.     yy = y + t
  47.     IF yy > 500 THEN
  48.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGBA(0, 0, 0, 30), BF
  49.         yy = 500
  50.         tt = tt + 1
  51.         IF tt > 15 THEN
  52.             GOTO up:
  53.         END IF
  54.     END IF
  55.     szz = (RND * 10) + .25
  56.     r = RND * 2
  57.     FOR sz = .25 TO szz
  58.         CIRCLE (xx, yy), sz, _RGB32(255, 0, 0), , , r
  59.     NEXT sz
  60.  
  61.  

« Last Edit: December 13, 2019, 03:28:12 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lava Lamp
« Reply #1 on: December 13, 2019, 03:29:39 pm »
This morning I made a MUCH better one with movement of lava randomly going up and down and changing shape. The speed is also random. It doesn't make any formations like the last one, but I like this one better. I also changed the shape of the window so it's 100% lava lamp. :) Do you like it? I also learned on this one that we can make the graphic "trail" effect with any background color, I thought we were just stuck with black. lol

Note: If you have photosensitivity problems, I deleted this one so go to the next one. The next one is better anyway for everyone.

« Last Edit: December 13, 2019, 03:44:56 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lava Lamp
« Reply #2 on: December 13, 2019, 03:42:43 pm »
Because of photosensitivity to some of the public out there, I decided to change it so it doesn't flash as much and each lava keeps the same shape but does change sizes as it goes up or down. I actually have a better liking to this one anyway. This one has the moving lava.

Note: There is even a better one after this one, with an added bubble and some lava on each end.


Code: QB64: [Select]
  1. _TITLE "Lava"
  2. DIM x(1000), y(1000), d(1000), speed(1000)
  3. SCREEN _NEWIMAGE(200, 600, 32)
  4. LINE (0, 2)-(198, 598), _RGB32(127, 127, 150), B
  5.  
  6.     _LIMIT 50
  7.     t = t + 1
  8.     IF t > 800 THEN t = 0
  9.     d(t) = INT(RND * 2) + 1
  10.     IF d(t) = 1 THEN y(t) = 10
  11.     IF d(t) = 1 THEN y(t) = 590
  12.     speed(t) = (RND * 2) + 1
  13.     x(t) = RND * 190
  14.     s = RND * 2.5
  15.     DO
  16.         LINE (0, 2)-(198, 598), _RGB32(127, 127, 150), B
  17.         IF d(t) = 1 THEN
  18.             y(t) = y(t) - speed(t)
  19.             IF y(t) < 0 THEN y(t) = 0: GOTO more:
  20.             RANDOMIZE TIMER
  21.             si = RND * 30
  22.             FOR sz = .25 TO si
  23.                 CIRCLE (x(t), y(t)), sz, _RGB32(255, 0, 0), , , s
  24.             NEXT sz
  25.         END IF
  26.  
  27.         IF d(t) = 2 THEN
  28.             y(t) = y(t) + speed(t)
  29.             IF y(t) > 590 THEN y(t) = 590: GOTO more:
  30.             RANDOMIZE TIMER
  31.             si = RND * 30
  32.             FOR sz = .25 TO si
  33.                 CIRCLE (x(t), y(t)), sz, _RGB32(255, 0, 0), , , s
  34.             NEXT sz
  35.         END IF
  36.         LINE (0, 0)-(200, 600), _RGBA(75, 40, 40, 30), BF
  37.         _DISPLAY
  38.         _DELAY .005
  39.     LOOP
  40.     more:
  41.     t = t + 1
  42.  
« Last Edit: December 13, 2019, 06:31:44 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Lava Lamp
« Reply #3 on: December 13, 2019, 05:19:29 pm »
I am reminded of my lava experiments in 2015 with SmallBASIC...

lets see how long to get a translation. :)

Ken you might like this.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lava Lamp
« Reply #4 on: December 13, 2019, 05:26:01 pm »
Great! post it here bplus! I might enhance mine a bit more too.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lava Lamp
« Reply #5 on: December 13, 2019, 06:31:04 pm »
I added a smaller lava bubble. So now I got a blob and a bubble. I also added lava stuck on the top and the bottom to show where they come from.

Note: The one after this has randomly stretched lava cords from the blob to where the blob came from.

Code: QB64: [Select]
  1. _TITLE "Lava"
  2. DIM x(1000), y(1000), d(1000), speed(1000), xx(1000), yy(1000), speed2(1000), d2(1000)
  3. DisplayScreen = _NEWIMAGE(200, 600, 32)
  4. BlobScreen = _NEWIMAGE(200, 600, 32)
  5. BubbleScreen = _NEWIMAGE(200, 600, 32)
  6.  
  7. SCREEN DisplayScreen
  8. LINE (0, 2)-(198, 598), _RGB32(127, 127, 150), B
  9.  
  10.     _LIMIT 50
  11.     'Blobs Setup
  12.     t = t + 1
  13.     IF t > 800 THEN t = 0
  14.     d(t) = INT(RND * 2) + 1
  15.     IF d(t) = 2 THEN y(t) = 10
  16.     IF d(t) = 1 THEN y(t) = 590
  17.     speed(t) = (RND * 2) + 1
  18.     x(t) = RND * 190
  19.     s = RND * 2.5
  20.     'Formations Setup
  21.     tt = tt + 1
  22.     d2(tt) = (RND * 2) + 1
  23.     IF d2(tt) = 2 THEN yy(tt) = 10
  24.     IF d2(tt) = 1 THEN yy(tt) = 590
  25.     speed2(tt) = (RND * 5) + 1
  26.     xx(tt) = RND * 190
  27.     yy(tt) = 598
  28.  
  29.     DO
  30.         _SOURCE BlobScreen: _DEST BlobScreen
  31.         'Up
  32.         LINE (0, 2)-(198, 598), _RGB32(127, 127, 150), B
  33.         CIRCLE (100, 0), 100, _RGB32(255, 0, 0), , , .5
  34.         PAINT (100, 0), _RGB32(255, 0, 0)
  35.         CIRCLE (100, 598), 100, _RGB32(255, 0, 0), , , .5
  36.         PAINT (100, 598), _RGB32(255, 0, 0)
  37.         IF d(t) = 1 THEN
  38.             y(t) = y(t) - speed(t)
  39.             IF y(t) < 0 THEN y(t) = 0: GOTO more:
  40.             RANDOMIZE TIMER
  41.             si = RND * 30
  42.             FOR sz = .25 TO si
  43.                 CIRCLE (x(t), y(t)), sz, _RGB32(255, 0, 0), , , s
  44.             NEXT sz
  45.         END IF
  46.  
  47.         'Down
  48.         IF d(t) = 2 THEN
  49.             y(t) = y(t) + speed(t)
  50.             IF y(t) > 590 THEN y(t) = 590: GOTO more:
  51.             RANDOMIZE TIMER
  52.             si = RND * 30
  53.             FOR sz = .25 TO si
  54.                 CIRCLE (x(t), y(t)), sz, _RGB32(255, 0, 0), , , s
  55.             NEXT sz
  56.         END IF
  57.  
  58.         _SOURCE BubbleScreen
  59.         'Bubble
  60.         yy(tt) = yy(tt) - speed2(tt)
  61.         IF yy(tt) < 0 THEN yy(tt) = 0
  62.         CIRCLE (xx(tt), yy(tt)), 2, _RGB32(255, 0, 0)
  63.  
  64.         _PUTIMAGE , BlobScreen, DisplayScreen
  65.         _PUTIMAGE , BubbleScreen, DisplayScreen
  66.  
  67.         _DISPLAY
  68.         _DELAY .005
  69.         LINE (0, 0)-(200, 600), _RGBA(75, 40, 40, 30), BF
  70.     LOOP
  71.     more:
  72.     t = t + 1
  73.  
  74.  
« Last Edit: December 13, 2019, 07:47:02 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lava Lamp
« Reply #6 on: December 13, 2019, 07:46:16 pm »
This time I added randomly sized lava cords that stretch from the blob to where the blob came from.

Note: Skip this one again.

Code: QB64: [Select]
  1. _TITLE "Lava"
  2. DIM x(1000), y(1000), d(1000), speed(1000), xx(1000), yy(1000), speed2(1000), d2(1000), cord(1000)
  3. DisplayScreen = _NEWIMAGE(200, 600, 32)
  4. BlobScreen = _NEWIMAGE(200, 600, 32)
  5. BubbleScreen = _NEWIMAGE(200, 600, 32)
  6.  
  7. SCREEN DisplayScreen
  8. LINE (0, 2)-(198, 598), _RGB32(127, 127, 150), B
  9.  
  10.     _LIMIT 50
  11.     'Blobs Setup
  12.     t = t + 1
  13.     IF t > 800 THEN t = 0
  14.     d(t) = INT(RND * 2) + 1
  15.     IF d(t) = 2 THEN y(t) = 10
  16.     IF d(t) = 1 THEN y(t) = 590
  17.     speed(t) = (RND * 2) + 1
  18.     x(t) = RND * 190
  19.     s = RND * 2.5
  20.     cord(t) = (RND * 480) + 120
  21.  
  22.     'Bubbles Setup
  23.     tt = tt + 1
  24.     d2(tt) = (RND * 2) + 1
  25.     IF d2(tt) = 2 THEN yy(tt) = 10
  26.     IF d2(tt) = 1 THEN yy(tt) = 590
  27.     speed2(tt) = (RND * 5) + 1
  28.     xx(tt) = RND * 190
  29.     yy(tt) = 598
  30.  
  31.  
  32.     DO
  33.         _SOURCE BlobScreen: _DEST BlobScreen
  34.         'Up
  35.         LINE (0, 2)-(198, 598), _RGB32(127, 127, 150), B
  36.         CIRCLE (100, 0), 100, _RGB32(255, 0, 0), , , .5
  37.         PAINT (100, 0), _RGB32(255, 0, 0)
  38.         CIRCLE (100, 598), 100, _RGB32(255, 0, 0), , , .5
  39.         PAINT (100, 598), _RGB32(255, 0, 0)
  40.         IF d(t) = 1 THEN
  41.             y(t) = y(t) - speed(t)
  42.             IF y(t) < 0 THEN y(t) = 0: GOTO more:
  43.             RANDOMIZE TIMER
  44.             si = RND * 30
  45.             FOR sz = .25 TO si
  46.                 CIRCLE (x(t), y(t)), sz, _RGB32(255, 0, 0), , , s
  47.             NEXT sz
  48.             IF y(t) < cord(t) THEN GOTO skipcord:
  49.             LINE (x(t) - 1, 590)-(x(t) + 1, y(t)), _RGB32(255, 0, 0), BF
  50.             skipcord:
  51.         END IF
  52.  
  53.         'Down
  54.         IF d(t) = 2 THEN
  55.             y(t) = y(t) + speed(t)
  56.             IF y(t) > 590 THEN y(t) = 590: GOTO more:
  57.             RANDOMIZE TIMER
  58.             si = RND * 30
  59.             FOR sz = .25 TO si
  60.                 CIRCLE (x(t), y(t)), sz, _RGB32(255, 0, 0), , , s
  61.             NEXT sz
  62.             IF y(t) > cord(t) THEN GOTO skipcord2:
  63.             LINE (x(t) - 1, 10)-(x(t) + 1, y(t)), _RGB32(255, 0, 0), BF
  64.             skipcord2:
  65.  
  66.         END IF
  67.  
  68.         _SOURCE BubbleScreen
  69.         'Bubble
  70.         yy(tt) = yy(tt) - speed2(tt)
  71.         IF yy(tt) < 0 THEN yy(tt) = 0
  72.         CIRCLE (xx(tt), yy(tt)), 2, _RGB32(255, 0, 0)
  73.  
  74.         _PUTIMAGE , BlobScreen, DisplayScreen
  75.         _PUTIMAGE , BubbleScreen, DisplayScreen
  76.  
  77.         _DISPLAY
  78.         _DELAY .005
  79.         LINE (0, 0)-(200, 600), _RGBA(75, 40, 40, 30), BF
  80.     LOOP
  81.     more:
  82.     t = t + 1
  83.  

« Last Edit: December 13, 2019, 09:14:59 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lava Lamp
« Reply #7 on: December 13, 2019, 09:11:53 pm »
Sorry for so many posts, but I keep making this thing better. :)
This time I removed the unnecessary PUT's and SCREEN's, etc. and just kept with the one SCREEN. I was experimenting with it earlier to see if I needed it but I don't.
This time I also made the lava cord thickness depending on the size of the blob and when the blob changes size, the cord does too. So it kinda has a stretching effect to it.

Note: One error in this one, fixed version is after this one.

Code: QB64: [Select]
  1. _TITLE "Lava"
  2. DIM x(1000), y(1000), d(1000), speed(1000), xx(1000), yy(1000), speed2(1000), d2(1000), cord(1000)
  3. SCREEN _NEWIMAGE(200, 600, 32)
  4.  
  5. LINE (0, 2)-(198, 598), _RGB32(127, 127, 150), B
  6.  
  7.     _LIMIT 50
  8.     'Blobs Setup
  9.     t = t + 1
  10.     IF t > 800 THEN t = 0
  11.     d(t) = INT(RND * 2) + 1
  12.     IF d(t) = 2 THEN y(t) = 10
  13.     IF d(t) = 1 THEN y(t) = 590
  14.     speed(t) = (RND * 2) + 1
  15.     x(t) = RND * 190
  16.     s = RND * 2.5
  17.     cord(t) = (RND * 480) + 120
  18.  
  19.     'Bubbles Setup
  20.     tt = tt + 1
  21.     d2(tt) = (RND * 2) + 1
  22.     IF d2(tt) = 2 THEN yy(tt) = 10
  23.     IF d2(tt) = 1 THEN yy(tt) = 590
  24.     speed2(tt) = (RND * 5) + 1
  25.     xx(tt) = RND * 190
  26.     yy(tt) = 598
  27.  
  28.  
  29.     DO
  30.         'Up
  31.         LINE (0, 2)-(198, 598), _RGB32(127, 127, 150), B
  32.         CIRCLE (100, 0), 100, _RGB32(255, 0, 0), , , .5
  33.         PAINT (100, 0), _RGB32(255, 0, 0)
  34.         CIRCLE (100, 598), 100, _RGB32(255, 0, 0), , , .5
  35.         PAINT (100, 598), _RGB32(255, 0, 0)
  36.         IF d(t) = 1 THEN
  37.             y(t) = y(t) - speed(t)
  38.             IF y(t) < 0 THEN y(t) = 0: GOTO more:
  39.             RANDOMIZE TIMER
  40.             si = RND * 30
  41.             FOR sz = .25 TO si
  42.                 CIRCLE (x(t), y(t)), sz, _RGB32(255, 0, 0), , , s
  43.             NEXT sz
  44.             IF y(t) < cord(t) THEN GOTO skipcord:
  45.             LINE (x(t) - sz / 5, 590)-(x(t) + sz / 5, y(t)), _RGB32(255, 0, 0), BF
  46.             skipcord:
  47.         END IF
  48.  
  49.         'Down
  50.         IF d(t) = 2 THEN
  51.             y(t) = y(t) + speed(t)
  52.             IF y(t) > 590 THEN y(t) = 590: GOTO more:
  53.             RANDOMIZE TIMER
  54.             si = RND * 30
  55.             FOR sz = .25 TO si
  56.                 CIRCLE (x(t), y(t)), sz, _RGB32(255, 0, 0), , , s
  57.             NEXT sz
  58.             IF y(t) > cord(t) THEN GOTO skipcord2:
  59.             LINE (x(t) - sz / 5, 10)-(x(t) + sz / 5, y(t)), _RGB32(255, 0, 0), BF
  60.             skipcord2:
  61.  
  62.         END IF
  63.  
  64.         'Bubble
  65.         yy(tt) = yy(tt) - speed2(tt)
  66.         IF yy(tt) < 0 THEN yy(tt) = 0
  67.         CIRCLE (xx(tt), yy(tt)), 2, _RGB32(255, 0, 0)
  68.  
  69.         _DISPLAY
  70.         _DELAY .005
  71.         LINE (0, 0)-(200, 600), _RGBA(75, 40, 40, 30), BF
  72.     LOOP
  73.     more:
  74.     t = t + 1
  75.  
« Last Edit: December 13, 2019, 10:08:35 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lava Lamp
« Reply #8 on: December 13, 2019, 10:07:50 pm »
Dang sorry again, I left out 1 line to make tt = 0. lol

Here's the fix:

Code: QB64: [Select]
  1. _TITLE "Lava"
  2. DIM x(1000), y(1000), d(1000), speed(1000), xx(1000), yy(1000), speed2(1000), d2(1000), cord(1000)
  3. SCREEN _NEWIMAGE(200, 600, 32)
  4.  
  5. LINE (0, 2)-(198, 598), _RGB32(127, 127, 150), B
  6.  
  7.     _LIMIT 50
  8.     'Blobs Setup
  9.     t = t + 1
  10.     IF t > 800 THEN t = 0
  11.     d(t) = INT(RND * 2) + 1
  12.     IF d(t) = 2 THEN y(t) = 10
  13.     IF d(t) = 1 THEN y(t) = 590
  14.     speed(t) = (RND * 2) + 1
  15.     x(t) = RND * 190
  16.     s = RND * 2.5
  17.     cord(t) = (RND * 480) + 120
  18.  
  19.     'Bubbles Setup
  20.     tt = tt + 1
  21.     IF tt > 800 THEN tt = 0
  22.     d2(tt) = (RND * 2) + 1
  23.     IF d2(tt) = 2 THEN yy(tt) = 10
  24.     IF d2(tt) = 1 THEN yy(tt) = 590
  25.     speed2(tt) = (RND * 5) + 1
  26.     xx(tt) = RND * 190
  27.     yy(tt) = 598
  28.  
  29.  
  30.     DO
  31.         'Up
  32.         LINE (0, 2)-(198, 598), _RGB32(127, 127, 150), B
  33.         CIRCLE (100, 0), 100, _RGB32(255, 0, 0), , , .5
  34.         PAINT (100, 0), _RGB32(255, 0, 0)
  35.         CIRCLE (100, 598), 100, _RGB32(255, 0, 0), , , .5
  36.         PAINT (100, 598), _RGB32(255, 0, 0)
  37.         IF d(t) = 1 THEN
  38.             y(t) = y(t) - speed(t)
  39.             IF y(t) < 0 THEN y(t) = 0: GOTO more:
  40.             RANDOMIZE TIMER
  41.             si = RND * 30
  42.             FOR sz = .25 TO si
  43.                 CIRCLE (x(t), y(t)), sz, _RGB32(255, 0, 0), , , s
  44.             NEXT sz
  45.             IF y(t) < cord(t) THEN GOTO skipcord:
  46.             LINE (x(t) - sz / 5, 590)-(x(t) + sz / 5, y(t)), _RGB32(255, 0, 0), BF
  47.             skipcord:
  48.         END IF
  49.  
  50.         'Down
  51.         IF d(t) = 2 THEN
  52.             y(t) = y(t) + speed(t)
  53.             IF y(t) > 590 THEN y(t) = 590: GOTO more:
  54.             RANDOMIZE TIMER
  55.             si = RND * 30
  56.             FOR sz = .25 TO si
  57.                 CIRCLE (x(t), y(t)), sz, _RGB32(255, 0, 0), , , s
  58.             NEXT sz
  59.             IF y(t) > cord(t) THEN GOTO skipcord2:
  60.             LINE (x(t) - sz / 5, 10)-(x(t) + sz / 5, y(t)), _RGB32(255, 0, 0), BF
  61.             skipcord2:
  62.  
  63.         END IF
  64.  
  65.         'Bubble
  66.         yy(tt) = yy(tt) - speed2(tt)
  67.         IF yy(tt) < 0 THEN yy(tt) = 0
  68.         CIRCLE (xx(tt), yy(tt)), 2, _RGB32(255, 0, 0)
  69.  
  70.         _DISPLAY
  71.         _DELAY .005
  72.         LINE (0, 0)-(200, 600), _RGBA(75, 40, 40, 30), BF
  73.     LOOP
  74.     more:
  75.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Lava Lamp
« Reply #9 on: December 14, 2019, 11:24:01 am »
More literal meaning to Lava Light:

Code: QB64: [Select]
  1. _TITLE "Lava Flow" 'bplus 2019-12-12 based on Lava 3.bas SmallBASIC 2015-04-25
  2.  
  3. '================================================================================
  4. '                  Press Spacebar for slightly different lava effect
  5. '================================================================================
  6.  
  7. CONST xmax = 1200, ymax = 720, n = 800, bg = &HFF000000 '<< try different colors
  8. DIM SHARED x(1 TO n), y(1 TO n), xr(1 TO n), yr(1 TO n), c(1 TO n) AS _UNSIGNED LONG
  9. SCREEN _NEWIMAGE(xmax, ymax, 32)
  10. FOR i = 1 TO n: new i, -1: NEXT 'init lava
  11. LINE (0, 0)-(xmax, ymax), bg, BF 'black'n screen
  12.     IF INKEY$ = " " THEN toggle = 1 - toggle
  13.     FOR i = 1 TO n
  14.         IF toggle THEN COLOR c(i) ELSE COLOR lavaColor~&
  15.         fEllipse x(i), y(i), xr(i), yr(i)
  16.         x(i) = x(i) + xr(i)
  17.         y(i) = y(i) + (INT(RND * 3) - 1) * yr(i) + .1
  18.         IF x(i) > xmax THEN new i, 0
  19.         IF y(i) < -5 OR y(i) > ymax + 5 THEN new i, 0
  20.     NEXT
  21.     xp = INT(RND * (xmax - 5)) + 1
  22.     yp = INT(RND * (ymax - 5)) + 1
  23.     PAINT (xp, yp), fire~&, bg
  24.     IF xp MOD 100 = 50 OR xp MOD 100 = 55 THEN PAINT (xp, yp), bg, bg
  25.     _LIMIT 30
  26.  
  27. SUB fEllipse (CX AS LONG, CY AS LONG, xRadius AS LONG, yRadius AS LONG)
  28.     DIM scale AS SINGLE, x AS LONG, y AS LONG
  29.     scale = yRadius / xRadius
  30.     LINE (CX, CY - yRadius)-(CX, CY + yRadius), , BF
  31.     FOR x = 1 TO xRadius
  32.         y = scale * SQR(xRadius * xRadius - x * x)
  33.         LINE (CX + x, CY - y)-(CX + x, CY + y), , BF
  34.         LINE (CX - x, CY - y)-(CX - x, CY + y), , BF
  35.     NEXT
  36.  
  37. SUB new (i, rndxTF)
  38.     IF rndxTF THEN x(i) = INT(RND * (xmax - 10)) + 5 ELSE x(i) = RND * 10
  39.     y(i) = INT(RND * (ymax - 10)) + 5
  40.     xr(i) = INT(RND * 4) + 3
  41.     yr(i) = RND * xr(i) * .5
  42.     c(i) = lavaColor~&
  43.  
  44. FUNCTION fire~&
  45.     IF RND < .25 THEN fire~& = &HFF000000 ELSE fire~& = _RGB32(255, RND * 128 + 127, 0)
  46.  
  47. FUNCTION lavaColor~&
  48.     r = INT(RND * 31)
  49.     IF r MOD 4 = 0 THEN lavaColor = bg ELSE lavaColor~& = _RGB32(r / 30 * 128 + 127, RND * r / 45 * 255, 0)
  50.  
  51.  

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lava Lamp
« Reply #10 on: December 14, 2019, 12:59:11 pm »
Pretty neat bplus, I thought about using PAINT to fill things sorta like that, but I never got around to it. Yours turns your entire monitor into one. :)