' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.12.16.16.28]) on 2024.03.03 at 18:55 (Coordinated Universal Time)

' This port and mod by Charlie Veniot
' of a BBC BASIC program by Richard Russell
' (Richard Russell's program based on a Commodore Amiga demonstration program by Laxity)
' as found in this Facebook post: https://www.facebook.com/groups/2057165187928233/permalink/3587227991588604/?mibextid=uJjRxr

    SCREEN _NEWIMAGE(1280,1000,12)
90  DIM x%(697), y%(697)
100 j = 4
110 k = 2
120 z = 0

šŸŸ”DrawingCycleStart:
  160 a = 0
  170 FOR I% = 0 TO 697
  180   i = _PI*(SIN(a+j)+COS(2*a+k))
  190   x%(I%) = INT(&h280 + &h1B8*SIN(a)*SIN(i+z))
  200   y%(I%) = INT(&h200 + &h190*COS(a)*COS(i))
  210   a += 0.009
  220 NEXT

  240 CLS
  250 COLOR 14 ' GCOL 1
  270 FOR I% = 1 TO 697
        FOR inc% = -4 TO +4 STEP 1
  280     LINE (x%(I%-1),y%(I%-1)+inc%) - (x%(I%),y%(I%)+inc%)
        NEXT
  290 NEXT

  320 REM Flip vertically
        FOR flippy% = 0 TO 697
          y%(flippy%) = &h400 - y%(flippy%)
        NEXT flippy%
  330 COLOR 10
  340 PSET (x%(0),y%(0))
  350 FOR I% = 1 TO 697
        FOR inc% = -4 TO +4 STEP 1
  360     LINE (x%(I%-1),y%(I%-1)+inc%) - (x%(I%),y%(I%)+inc%)
        NEXT
  370 NEXT
  390
  400 j += 0.01625
  410 k += 0.025
  420 z += 0.075

      SLEEP 0.025
      GOTO šŸŸ”DrawingCycleStart
470 END