Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pringle-like Shape Animation
#1
I asked ChatGPT to make me a Pringle. So tinkering around with it I made this animation. 

Code: (Select All)

Screen _NewImage(600, 600, 32)
CENTERX = 300
CENTERY = 300
' Pringle parameters
SIZE = 300
STP = 1
Const ZSCALE = 30 ' Controls how much "curve" there is
num = 20
dir = 20
t = 4

Do
    If num > 3000 Then
        dir = -20
    End If
    If num < -3000 Then
        dir = 20
    End If
    num = num + dir * t
    For x! = -SIZE To SIZE Step STP
        For y! = -SIZE To SIZE Step STP
            ' Hyperbolic paraboloid formula: z = (x^2 - y^2) / scale
            z! = ((x! ^ 2) - (y! ^ 2)) / (SIZE * ZSCALE)

            ' Project to screen (top-down view with z as shading)
            screenX = CENTERX + x!
            screenY = CENTERY + y!

            ' Shade based on height (z)
            shade = 128 + z! * num
            If shade < 0 Then shade = 0
            If shade > 255 Then shade = 255

            PSet (screenX, screenY), _RGB(shade, shade, 255 - shade)
        Next
    Next
Loop Until InKey$ = Chr$(27)

Reply




Users browsing this thread: 1 Guest(s)