(09-24-2022, 03:25 AM)mnrvovrfc Wrote:(09-21-2022, 02:39 PM)bplus Wrote: Thanks to James D Jarvis, your poly solids gave me idea for improvement to "Even Better Stars"I can't stand screensavers on Linux, but in case I should need one, this one gets the nod. Only I wish Linux could be like WindowsXP, just rename an EXE file so the OS is convinced it's a screensaver... or a bit more involved. Nice work you two!
Even More Better Stars
Screen savers are Art in Motion (usually animated).
Anyway, I was reloading lost files in JB not backed up when I lost drives again! So I am going through JB forum collecting my little gems and ran across the swizzle series that you folks might like:
Swizzle Series
Code: (Select All)
_Title "Swizzle" ' b+ 2021-05-29
Const Xmax = 600, Ymax = 600, cxy = 300, Pi = _Pi
Screen _NewImage(Xmax, Ymax, 32)
_Delay .25
_ScreenMove _Middle
Dim vScreenR(Xmax, Ymax), vScreenG(Xmax, Ymax), vScreenB(Xmax, Ymax)
restart:
r = Rnd * Rnd: g = Rnd * Rnd: b = Rnd * Rnd
For x = 0 To Xmax
Line (x, 0)-(x, Ymax), _RGB32(128 + 128 * Sin(r * x), 128 + 128 * Sin(g * x), 128 + 128 * Sin(b * x))
For y = 0 To Ymax
vScreenR(x, y) = 128 + 128 * Sin(r * x)
vScreenG(x, y) = 128 + 128 * Sin(g * x)
vScreenB(x, y) = 128 + 128 * Sin(b * x)
Next
Next
swizzle = Rnd * .5 + .8
_Title "Swizzle @" + _Trim$(Str$(swizzle))
For radius = 1 To 200
For a = 0 To 2 * Pi Step 1 / (2 * Pi * radius)
x = Int(cxy + radius * Cos(a))
y = Int(cxy + radius * Sin(a))
r = vScreenR(x, y)
g = vScreenG(x, y)
b = vScreenB(x, y)
PSet (cxy + radius * Cos(a + radius ^ swizzle * Pi / 180), cxy + radius * Sin(a + radius ^ swizzle * Pi / 180)), _RGB32(r, g, b)
Next
Next
_Delay 3
GoTo restart
Code: (Select All)
_Title "Swizzle 2" ' b+ 2021-05-30 Make use of 2D Arrays
Const Xmax = 600, Ymax = 600, cxy = 300, Pi = _Pi
Screen _NewImage(Xmax, Ymax, 32)
_Delay .25
_ScreenMove _Middle
Dim vScreenR(Xmax, Ymax), vScreenG(Xmax, Ymax), vScreenB(Xmax, Ymax)
restart:
r = Rnd * Rnd * .25: g = Rnd * Rnd * .25: b = Rnd * Rnd * .25
For x = 0 To .5 * Xmax
Line (x, x)-(Xmax - x, Ymax - x), _RGB32(128 + 128 * Sin(r * x), 128 + 128 * Sin(g * x), 128 + 128 * Sin(b * x)), B
For y = x To Ymax - x
vScreenR(x, y) = 128 + 128 * Sin(r * x)
vScreenG(x, y) = 128 + 128 * Sin(g * x)
vScreenB(x, y) = 128 + 128 * Sin(b * x)
vScreenR(Xmax - x, y) = 128 + 128 * Sin(r * x)
vScreenG(Xmax - x, y) = 128 + 128 * Sin(g * x)
vScreenB(Xmax - x, y) = 128 + 128 * Sin(b * x)
Next
For y = x To Xmax - x
vScreenR(y, x) = 128 + 128 * Sin(r * x)
vScreenG(y, x) = 128 + 128 * Sin(g * x)
vScreenB(y, x) = 128 + 128 * Sin(b * x)
vScreenR(Xmax - y, Ymax - x) = 128 + 128 * Sin(r * x)
vScreenG(Xmax - y, Ymax - x) = 128 + 128 * Sin(g * x)
vScreenB(Xmax - y, Ymax - x) = 128 + 128 * Sin(b * x)
Next
Next
_Delay 1
swizzle = Rnd * .2 + .9
_Title "Swizzle @" + _Trim$(Str$(swizzle))
For radius = 1 To 300
For a = 0 To 2 * Pi Step 1 / (2 * Pi * radius)
x = Int(cxy + radius * Cos(a))
y = Int(cxy + radius * Sin(a))
r = vScreenR(x, y)
g = vScreenG(x, y)
b = vScreenB(x, y)
PSet (cxy + radius * Cos(a + radius ^ swizzle * Pi / 180), cxy + radius * Sin(a + radius ^ swizzle * Pi / 180)), _RGB32(r, g, b)
Next
Next
_Delay 3
GoTo restart
Code: (Select All)
_Title "Swizzle YY" ' b+ 2021-05-29
Const Xmax = 600, Ymax = 600, cxy = 300, Pi = _Pi
Screen _NewImage(Xmax, Ymax, 32)
_Delay .25
_ScreenMove _Middle
Dim vScreenR(Xmax, Ymax), vScreenG(Xmax, Ymax), vScreenB(Xmax, Ymax)
For x = 0 To Xmax
If x < (.5 * Xmax) Then
r = 0: g = 0: b = 0
Else
r = 255: g = 255: b = 255
End If
Line (x, 0)-(x, Ymax), _RGB32(r, g, b)
For y = 0 To Ymax
vScreenR(x, y) = r
vScreenG(x, y) = g
vScreenB(x, y) = b
Next
Next
swizzle = 1.
_Title "Swizzle @" + _Trim$(Str$(swizzle))
For radius = 1 To 180
For a = 0 To 2 * Pi Step 1 / (2 * Pi * radius)
x = Int(cxy + radius * Cos(a))
y = Int(cxy + radius * Sin(a))
r = vScreenR(x, y)
g = vScreenG(x, y)
b = vScreenB(x, y)
PSet (cxy + radius * Cos(a + radius ^ swizzle * Pi / 180), cxy + radius * Sin(a + radius ^ swizzle * Pi / 180)), _RGB32(r, g, b)
Next
Next
Code: (Select All)
_Title "Swizzle Spin" ' b+ 2021-05-29
Const Xmax = 600, Ymax = 600, cxy = 300, Pi = _Pi
Screen _NewImage(Xmax, Ymax, 32)
_Delay .25
_ScreenMove _Middle
Randomize Timer
Dim vScreenR(Xmax, Ymax), vScreenG(Xmax, Ymax), vScreenB(Xmax, Ymax)
restart:
r = Rnd * Rnd: g = Rnd * Rnd: b = Rnd * Rnd
For x = 0 To Xmax
Line (x, 0)-(x, Ymax), _RGB32(128 + 128 * Sin(r * x), 128 + 128 * Sin(g * x), 128 + 128 * Sin(b * x))
For y = 0 To Ymax
vScreenR(x, y) = 128 + 128 * Sin(r * x)
vScreenG(x, y) = 128 + 128 * Sin(g * x)
vScreenB(x, y) = 128 + 128 * Sin(b * x)
Next
Next
swizzle = Rnd * .5 + .8
For radius = 1 To 200
For a = 0 To 2 * Pi Step 1 / (2 * Pi * radius)
x = Int(cxy + radius * Cos(a))
y = Int(cxy + radius * Sin(a))
r = vScreenR(x, y)
g = vScreenG(x, y)
b = vScreenB(x, y)
PSet (cxy + radius * Cos(a + radius ^ swizzle * Pi / 180), cxy + radius * Sin(a + radius ^ swizzle * Pi / 180)), _RGB32(r, g, b)
Next
Next
s& = _NewImage(Xmax * 2.2, Ymax * 2.2, 32)
_PutImage , 0, s&
Do
RotoZoom cxy, cxy, s&, 1, a
a = a - 3: If a < -360 Then a = 0: _FreeImage s&: GoTo restart
_Display: _Limit 30
Loop Until InKey$ <> ""
Sub RotoZoom (X As Long, Y As Long, Image As Long, Scale As Single, Rotation As Single)
Dim px(3) As Single: Dim py(3) As Single
W& = _Width(Image&): H& = _Height(Image&)
px(0) = -W& / 2: py(0) = -H& / 2: px(1) = -W& / 2: py(1) = H& / 2
px(2) = W& / 2: py(2) = H& / 2: px(3) = W& / 2: py(3) = -H& / 2
sinr! = Sin(-Rotation / 57.2957795131): cosr! = Cos(-Rotation / 57.2957795131)
For i& = 0 To 3
x2& = (px(i&) * cosr! + sinr! * py(i&)) * Scale + X: y2& = (py(i&) * cosr! - px(i&) * sinr!) * Scale + Y
px(i&) = x2&: py(i&) = y2&
Next
_MapTriangle _Seamless(0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
_MapTriangle _Seamless(0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
End Sub
b = b + ...