October 27, 2021, 07:17:33

Author Topic: Swizzle 2  (Read 314 times)

Offline bplus

  • Full Member
  • ***
  • Posts: 229
Swizzle 2
« on: May 30, 2021, 17:27:41 »
A quickie:
Code: [Select]
REM SmallBASIC
REM created: 30/05/2021 B+

Const Xmx = 600
const Ymx = 600
const cxy = 300
Dim vScreenR(Xmx, Ymx), vScreenG(Xmx, Ymx), vScreenB(Xmx, Ymx)
label restart
r = Rnd * Rnd * .25: g = Rnd * Rnd * .25: b = Rnd * Rnd * .25
For x = 0 To .5 * Xmx
    rect x, x,Xmx - x, Ymx - x, RGB(127 + 127 * Sin(r * x), 127 + 127 * Sin(g * x), 127 + 127 * Sin(b * x))
    For y = x To Ymx - x
        vScreenR(x, y) = 127 + 127 * Sin(r * x)
        vScreenG(x, y) = 127 + 127 * Sin(g * x)
        vScreenB(x, y) = 127 + 127 * Sin(b * x)
        vScreenR(Xmx - x, y) = 127 + 127 * Sin(r * x)
        vScreenG(Xmx - x, y) = 127 + 127 * Sin(g * x)
        vScreenB(Xmx - x, y) = 127 + 127 * Sin(b * x)
    Next
    For y = x To Xmx - x
        vScreenR(y, x) = 127 + 127 * Sin(r * x)
        vScreenG(y, x) = 127 + 127 * Sin(g * x)
        vScreenB(y, x) = 127 + 127 * Sin(b * x)
        vScreenR(Xmx - y, Ymx - x) = 127 + 127 * Sin(r * x)
        vScreenG(Xmx - y, Ymx - x) = 127 + 127 * Sin(g * x)
        vScreenB(Xmx - y, Ymx - x) = 127 + 127 * Sin(b * x)
    Next
Next
showpage
delay 500
swizzle = Rnd * .2 + .9
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), RGB(r, g, b)
    Next
Next
showpage
delay 1000
GoTo restart



 

SimplePortal 2.3.6 © 2008-2014, SimplePortal