BBC BASIC for Windows
« Pixel Vortex »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:57pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Pixel Vortex  (Read 410 times)
rtr2
Guest
xx Pixel Vortex
« Thread started on: Jan 24th, 2015, 10:06pm »

Here's something which started off as a QBasic program, was then translated into Just BASIC, and which I have now translated into BBC BASIC (with a degree of licence). Nothing particularly special but an interesting effect, and purely BASIC code:

Code:
      REM Original QBasic program ANTONI18.BAS by Antoni Gual
      REM Translated to Just BASIC by Andy Amaya
      REM Translated to BBC BASIC by Richard Russell

      MODE 20
      GCOL 1
      OFF

      amp=24 : yi=-27
      r1=255 : g1=240 : b1=32
      r2=96  : g2=32  : b2=0
      dr = (r1-r2)/(amp*2)
      dg = (g1-g2)/(amp*2)
      db = (b1-b2)/(amp*2)
      FOR y = yi TO yi+2*amp+1
        oy = y : ox = 0
        COLOUR 1,r1,g1,b1
        FOR x = 0 TO 7 STEP PI/amp
          nx = x*24 : ny = SIN(x)*amp+y
          LINE ox*2,oy*2,nx*2,ny*2
          LINE ox*2,oy*2+98,nx*2,ny*2+98
          LINE ox*2,oy*2+196,nx*2,ny*2+196
          ox = nx : oy = ny
        NEXT
        r1-=dr : g1-=dg : b1-=db
      NEXT
      FOR x = 0 TO 1600 STEP 300
        FOR y = 0 TO 1200 STEP 194
          RECTANGLE 0, 0, 300, 194 TO x, y
        NEXT
      NEXT
      PROCvortex
      VDU 20
      FOR x = 0 TO 1600 STEP 40
        FOR y = 0 TO 1200 STEP 40
          GCOL RND(15)
          RECTANGLE FILL x, y, 40, 40
        NEXT
      NEXT
      PROCvortex
      GCOL 1 : CLS
      COLOUR 1,0,0,255     : RECTANGLE FILL 0, 100, 100, -100
      COLOUR 1,64,160,255  : PLOT 85,100,100
      COLOUR 1,192,192,255 : RECTANGLE FILL 14, 14, 76, 76
      COLOUR 1,0,128,255   : RECTANGLE FILL 12, 12, 76, 76
      COLOUR 1,192,192,255 : RECTANGLE FILL 24, 24, 52, 52
      COLOUR 1,0,0,255     : RECTANGLE FILL 26, 78, 52, -52
      COLOUR 1,64,160,255  : PLOT 85,24,24
      COLOUR 1,0,0,192     : RECTANGLE FILL 36,36,28,28
      FOR x = 0 TO 1600 STEP 100
        FOR y = 0 TO 1200 STEP 100
          RECTANGLE 0, 0, 100, 100 TO x, y
        NEXT
      NEXT
      PROCvortex
      COLOUR 0,0,0,255   : COLOUR 1,64,0,255  : COLOUR 2,128,0,255 : COLOUR 3,192,0,255
      COLOUR 4,255,0,255 : COLOUR 5,255,0,192 : COLOUR 6,255,0,128 : COLOUR 7,255,0,64
      COLOUR 8,255,0,0   : COLOUR 9,255,64,0  : COLOUR 10,255,128,0: COLOUR 11,255,192,0
      COLOUR 12,255,255,0: COLOUR 13,192,255,0: COLOUR 14,128,255,0: COLOUR 15,64,255,0
      c = 1
      FOR r = 1000 TO 20 STEP -20
        GCOL c MOD 16
        CIRCLE FILL 800, 600, r
        c += 1
      NEXT
      PROCvortex
      RUN
      END

      DEF PROCvortex
      LOCAL j, w, xmid, ymid
      WAIT 100
      w = 3000*RND(1)
      FOR j = 1 TO 10000
        w += .3
        xmid = 360 + SIN(w * .007) * 333
        ymid = 280 + SIN(w * .011) * 261
        RECTANGLE (xmid-SIN(w)*28)*2, (ymid+COS(w)*20)*2, 160, 160 TO \
        \         (xmid-SIN(w-.05)*27.16)*2, (ymid+COS(w-.04)*19.4)*2
        WAIT 0
      NEXT
      ENDPROC 
« Last Edit: Jan 24th, 2015, 10:10pm by rtr2 » User IP Logged

lancegary
New Member
Image


member is offline

Avatar




PM


Posts: 4
xx Re: Pixel Vortex
« Reply #1 on: Jan 24th, 2015, 11:02pm »

It is interesting.

The thought that went through my mind is how science is often the process of undoing the vortex. For example taking the pattern after the vortex has distorted it and trying to recover the original pattern. And that would be guessing the nature of the vortex transformation and then retracing it's path and undoing the transformation. I suppose even cryptography is like deciphering the transformation and undoing it. Or William Davis's peneplane hypothesis in geomorphology where landscape is understood as the transformation wrought upon a hypothetical land plane by water and wind...

Thanks,

Lance
User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: Pixel Vortex
« Reply #2 on: Jan 26th, 2015, 07:38am »

Nice effect smiley


David.
--
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls