Posts: 51
Threads: 7
Joined: Feb 2024
Reputation:
0
02-07-2024, 05:50 PM
(This post was last modified: 02-07-2024, 05:51 PM by Tomaaz.)
Here is the Bubble Universe example. It seems that alpha element doesn't affect drawing single pixels:
Code: set window "Bubble Universe", 512, 512
r = 6.283185307179586 / 235
mw = 512
mh = 512
hw = mw / 2
hh = mh / 2
x = 0
v = 0
u = 0
t = 0
k = rnd(190) + 64
set redraw 0
while 1
set color 0, 0, 0, 255
draw rect 0, 0, 512, 512, 1
for i = 0 to 255
for j= 0 to 255
u = sin(i + v) + sin(r * i + x)
v = cos(i + v) + cos(r * i + x)
x = u + t
set color i, j, 255 - i, k
draw pixel int(hw + u * hw * 0.4), int(hh + v * hh * 0.4)
next
next
redraw
t = t + 0.01
k = rnd(190) + 64
wend
Is this a bug? I've tried draw pixel, set pixel and even both.
Posts: 342
Threads: 38
Joined: Nov 2023
Reputation:
3
(02-07-2024, 05:50 PM)Tomaaz Wrote: Here is the Bubble Universe example. It seems that alpha element doesn't affect drawing single pixels:
Code: set window "Bubble Universe", 512, 512
r = 6.283185307179586 / 235
mw = 512
mh = 512
hw = mw / 2
hh = mh / 2
x = 0
v = 0
u = 0
t = 0
k = rnd(190) + 64
set redraw 0
while 1
set color 0, 0, 0, 255
draw rect 0, 0, 512, 512, 1
for i = 0 to 255
for j= 0 to 255
u = sin(i + v) + sin(r * i + x)
v = cos(i + v) + cos(r * i + x)
x = u + t
set color i, j, 255 - i, k
draw pixel int(hw + u * hw * 0.4), int(hh + v * hh * 0.4)
next
next
redraw
t = t + 0.01
k = rnd(190) + 64
wend
Is this a bug? I've tried draw pixel, set pixel and even both.
Well, in my opinion, this is one impressive graphics demo... Very cool...
Here is a screen shot of how it looks on my machine...
Nicely done!
J
Logic is the beginning of wisdom.
Posts: 51
Threads: 7
Joined: Feb 2024
Reputation:
0
02-07-2024, 06:11 PM
(This post was last modified: 02-07-2024, 06:28 PM by Tomaaz.)
I should have mentioned that it is not my original idea. I thing it was ZXDunny who posted it on one of the forums. When alpha component is working correctly the whole thing is a bit darker and slightly changing brightness between cycles what gives it even more dynamic look (that was my idea, but seems not to be working in NaaLaa).
Posts: 342
Threads: 38
Joined: Nov 2023
Reputation:
3
... ah, but it is still a very nice 'conversion'... No change from my previous. 'Nicely done!'...
Logic is the beginning of wisdom.
Posts: 212
Threads: 22
Joined: Nov 2023
Reputation:
0
(02-07-2024, 05:50 PM)Tomaaz Wrote: Here is the Bubble Universe example. It seems that alpha element doesn't affect drawing single pixels:
...
Bubble Universe is a very beautiful art ... I like it
Posts: 349
Threads: 42
Joined: Nov 2023
Reputation:
3
Afaik alpha works I haven't tried the program, but you set k only once. Since you use 'rnd' k will have the exact same value everytime you run the program (if that's what fooling you).
I'll have a look when I get home, could ofcourse be a bug
Posts: 349
Threads: 42
Joined: Nov 2023
Reputation:
3
I can confirm that 'draw pixel' doesn't seem to care about the alpha channel. How weird. I'll fix that
Posts: 51
Threads: 7
Joined: Feb 2024
Reputation:
0
Yep. Something is wrong. Rnd is called multiple times (you missed the one just before wend), but I also tried to run it with different constant values and it didn't change the look of the bubble.
Posts: 39
Threads: 3
Joined: Feb 2024
Reputation:
0
i have this version with little bit different colors
Code: ' Bubble universe
' ---------------
' Paul Dunn posted this code but for SpecBAS in a facebook group. It looked so cool that I had to
' rewrite it in n7.
constant TAU = 6.283185307179586
set window "Bubble universe", 512, 512
set redraw off
n = 200; r = TAU/235
x = 0; y = 0;
v = 0; t = 0;
hw = width(primary)/2; hh = height(primary)/2
while not keydown(KEY_ESCAPE)
set color 0, 0, 0
cls
for i = 0 to n for j = 0 to n
u = sin(i + v) + sin(r*i + x)
v = cos(i + v) + cos(r*i + x)
x = u + t
set color i, j, 99
set pixel hw + u*hw*0.4, hh + v*hh*0.4
next
t = t + 0.025
set caret hw, 4
set color 255, 255, 255
center "Press esc to exit ..."
fwait 60
redraw
wend
Posts: 342
Threads: 38
Joined: Nov 2023
Reputation:
3
Cool... Nice colours!
Logic is the beginning of wisdom.
|