User:Gerbrant/Spiral image: VB source

  1. Create a VB form.
  2. Create on it a PictureBox with a 16 px * 128 px image. To avoid seams you can make the image 17 px wide.
  3. Set the ScaleMode property of both form and Picture1 to vbPixels.
  4. Make sure the form contains the code below.
  5. Experiment - you can change the 1.4 to stretch the image, try other widths and heights, add anti-aliasing, etc.
Option Explicit

Private Const Pi = 3.14159265358979

Private Sub Form_Paint()
Dim A As Long, B As Long
Dim X As Long, Y As Long
Dim T As Single, R As Single
Dim N As Long, Rc As Long

ScaleLeft = -ScaleWidth \ 2
ScaleTop = -ScaleHeight \ 2

For X = ScaleLeft To ScaleLeft + ScaleWidth - 1
For Y = ScaleTop To ScaleTop + ScaleHeight - 1
    If X Then
        T = Atn(Y / X)
        If X < 0 Then T = T + Pi
    ElseIf Y > 0 Then
        T = Pi / 2
    Else
        T = -Pi / 2
    End If
    T = T + 2 * Pi
    
    R = Sqr(X * X + Y * Y)
    R = R + 8 * T / Pi
    N = Int(R / 16)
    T = 2 * Pi * N - T
    PSet (X, Y), Picture1.Point(R - N * 16, (1.4 * T * T) And 127)
    
Next Y, X
End Sub