10-31-2023, 06:25 PM
(This post was last modified: 10-31-2023, 06:35 PM by James D Jarvis.)
Code: (Select All)
'Dia de los Muertos
'adapted from a conversion by Paul Dunn of an original by Bazzargh
'$dynamic
Dim S(0), C(0)
Dim klr As _Unsigned Long
Screen _NewImage(800, 600, 32)
Window (-852, -600)-(852, 416)
Do
klr = _RGB32(255, 0, 0)
Cls
k = 360
ReDim S(k + 1), C(k + 1)
kv = 220 + r(35)
For i = 0 To k
t = i * 2 * _Pi / k
S(i) = Sin(t)
C(i) = Cos(t)
circleBF 0, -i / 2, k * .8, _RGB32(kv, kv, kv)
Next i
circleBF 0, 0, k, _RGB32(kv, kv, kv)
circleBF 120, -60, 80, _RGB32(1, 1, 1)
circleBF -120, -60, 80, _RGB32(1, 1, 1)
u = 120: v = -60: d = 2: n = 7: a = 70
For j = 1 To r(30) + 10 '40
For t = 0 To k * 2
z = a * C(((t * n) / d) Mod k)
x = u + z * C(t Mod k)
y = v + z * S(t Mod k)
e = x * x
rr = Sqr(e + y * y)
f = y + k
g = Sqr(e + f * f)
l = y + 60
i = x - 120
h = Sqr(e + f * f)
If (g < 220 Or rr < k) And (rr <= 380 Or rr <= k) And (rr <= 360 Or rr > 480 Or Abs(x) >= 160 Or Abs(x Mod 32) <= 4 Or rr Mod 48 <= 4) And (j <= 1 Or h >= 90) And (y < -300 Or y >= -150 Or -x * 2 - y >= 180) Then
circleBF x, y, 2, klr
circleBF -x, y, 2, klr
End If
Next t
d = r(3): n = r(5) + 2: a = r(80) + 50: u = r(k): v = r(940) - 520
kv = r(121)
klr = _RGB32(kv, kv, kv)
Next j
Do
_Limit 60
kk$ = InKey$
Loop Until kk$ <> ""
Loop Until kk$ = Chr$(27)
Function r (i)
r = Int(1 + Rnd * i)
End Function
Sub circleBF (cx As Long, cy As Long, rad As Long, klr As _Unsigned Long)
rsqrd = rad * rad
y = -rad
While y <= rad
x = Sqr(rsqrd - y * y)
Line (cx - x, cy + y)-(cx + x, cy + y), klr, BF
y = y + 1
Wend
End Sub