Author Topic: Dizzy Spinning Circles  (Read 2214 times)

Offline Paul Smith

  • Mr. Polyvector
  • ***
  • Posts: 109
    • View Profile
Dizzy Spinning Circles
« on: 2014-Oct-19 »
Again how  Quick simple Code can produce good results.
My take on the Circle part in Second Reality.
Code probably useless, but fun


Code: GLBasic [Select]
// future Crew Second Reality style Circles
// First Version created 5 circle sprites with a palatte rotation but I didn't like it

SETSCREEN 1024,768,1                            //runs better in fullscreen mode
GLOBAL a, r,i,b
SETFONT 0,4
PRINT " Please wait slow rendering...",30,20
SHOWSCREEN
LIMITFPS 60


GOSUB picbuild                                 //Render Circles

GOSUB spriteline                               //Break sprite into 768 sprites lines

b= 180
WHILE TRUE
i= i+ 4                                       // 1st circle Speed clockwise
b= b +3                                       // 2nd circle Speed clockwise
ALPHAMODE -1
ZOOMSPRITE 7777,100*SIN(i)+0,100*COS(i)+0,1.5,1.5                  // Draw 1st Circle. zoomsprite higher then screen or edges will show
ALPHAMODE 0.9
IF i> 1000 THEN ZOOMSPRITE 1000,100*SIN(b)+0,100*COS(b)+0,1.5,1.5 // Draw 2nd Circle once i>1000

SHOWSCREEN
IF i> 3000 THEN GOSUB flow                    // bend sprite 1000 once i>3000

WEND
KEYWAIT




// wobble the picture
SUB flow:
              FOR y=1 TO 768
              a=a +0.001 * 6                // Wobble speed
              DRAWSPRITE y, COS( a + y ) * y / 4, y
              NEXT
              GRABSPRITE 1000,0,0,1024,768 // Grab whole screen
              RETURN
ENDSUB

// Draw the circles

SUB picbuild:
r = 0
FOR j= 0 TO 650
r=r + 15
IF r > 400 THEN r = 0
FOR i=0 TO 360 STEP 0.1                   // Higher the step the more missed pixels + faster render
SETPIXEL j*SIN(i) + 1024 /2, j*COS(i)+768 /2, RGB(r/3, r/3, r/3)   // PLot a dot
NEXT                                                                                                                            
NEXT


// Grab Whole screen
GRABSPRITE 7777,0,0,1024,768             // Grab the same picture twice
GRABSPRITE 1000,0,0,1024,768

RETURN
ENDSUB

SUB spriteline:
FOR t = 1 TO 768
GRABSPRITE t,1,t,1024,1                 //grab 1 line from top to bottom, 1024 pixels wide * 768
NEXT
RETURN
ENDSUB


 
Amstrad CPC 6128, ATARI STE.
Acer  SW5-173 & AMD FX 8350/1050Ti