Code: Select all

`'Ported https://www.dwitter.net/d/21330 by rodrigo.siqueira to FB by UEZ build 2021-01-21`

#Include "fbgfx.bi"

#Include "crt/math.bi"

Using FB

Dim As Integer w = 1920 Shr 0, h = 1080 Shr 0, w2 = w Shr 1, h2 = h Shr 1

Screenres w, h, 32, 2, GFX_ALWAYS_ON_TOP Or GFX_ALPHA_PRIMITIVES Or GFX_NO_SWITCH Or GFX_NO_FRAME 'Or GFX_FULLSCREEN

Screenset 1, 0

Color &hFF, &hFF000000

Cls

#Define Min(a, b) (Iif(a < b, a, b))

#Define Max(a, b) (Iif(a > b, a, b))

#Define Map(Val, source_start, source_stop, dest_start, dest_stop) ((Val - source_start) * (dest_stop - dest_start) / (source_stop - source_start) + dest_start)

#Define f23 (2 / 3)

#Define f13 (1 / 3)

#Define f16 (1 / 6)

#Define to255(v) (Max(0, Min(255, 256 * v)))

Function HUE2RGB(p As Single, q As Single, t As Single) As Single

If t < 0 Then t += 1

If t > 1 Then t -= 1

If t < f16 Then Return p + (q - p) * 6 * t

If t < 0.5 Then Return q

If t < f23 Then Return p + (q - p) * (f23 - t) * 6

Return p

End Function

Function HSL2RGB(H As Single, S As Single, L As Single, a As Ubyte = &hFF) As Ulong

Dim As Single r, g, b

If S = 0 Then

r = L : g = L : b = L

Else

Dim As Single p, q

q = Iif(L < 0.5, L * (1 + S), L + S - L * S)

p = 2 * L - q

r = HUE2RGB(p, q, H + f13)

g = HUE2RGB(p, q, H)

b = HUE2RGB(p, q, H - f13)

End If

Return a Shl 24 Or to255(r) Shl 16 Or to255(g) Shl 8 Or to255(b) Shl 0

End Function

Randomize

#Define h74 (h * 0.74)

Dim As Double t = 0

Dim As Single k, x, y, z = 1

Dim As Integer i

Do

If z > 0.5 Then

For i = 3e3 To 0 Step -1

x = w2 + i * (Cos(i * i + t) * Cos(i / t) ^ 0.3)

y = h74 - i * (Sin(i * i + t) * Sin(i / t) ^ 0.3)

z = 9 / t

k = Sin(i * i + t / 5) * 340

'Line (x, y) - (x + z, y + z), HSL2RGB(fmod(120 + k, 360) / 360, 0.99, (k / 4) / 100, 15), BF

Circle (x, y), z, HSL2RGB(fmod(120 + k, 360) / 360, 0.99, (k / 4) / 100, 15),,,,F

Next

t += 0.016

Endif

Flip

Sleep(1)

Loop Until Len(Inkey())

Instead of circles I see also horizontal stripes - with x86 no problems.

x86:

x64:

Is this a bug?