DemoCoding - OldSkool Interference Circles

Share your advanced PureBasic knowledge/code with the community.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

DemoCoding - OldSkool Interference Circles

Post by va!n »

Here is one more OldSkool DemoFx and a modern version i did in the past and i want to share with you... have phun..

Example 1:

Code: Select all

; ---- code by va!n aka 'thorsten will' in 2007 ----

InitSprite()
InitKeyboard()

OpenScreen(640,480,32,"Exampe by va!n aka 'Thorsten Will' in 2007")
CreateSprite(0,800,600)
CreateSprite(1,800,600)

StartDrawing(SpriteOutput(lSprite))
  For i = 0 To 25
    lColor = -lColor +1
    Circle(400,300, 500-(i*20), RGB(lColor*255, lColor*255, lColor*255))
  Next
StopDrawing()

Repeat
  ClearScreen(0)
  ExamineKeyboard()
 
  DisplayTransparentSprite(0, -50+Cos(vain2.d)*50, -50+Sin(vain.d)*50)
  DisplayTransparentSprite(0, -50+Sin(vain.d)*50, -50+Cos(vain.d)*50)
  vain.d = vain.d + 0.05
  vain2.d = vain2.d + 0.025
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) 
Example 2:

Code: Select all

; ---- code by va!n aka 'thorsten will' in 2007 ----

InitSprite()
InitKeyboard()

OpenScreen(640,480,32,"Exampe by va!n aka 'Thorsten Will' in 2007")
CreateSprite(0,800,600)
CreateSprite(1,800,600)

For lSprite = 0 To 1
  StartDrawing(SpriteOutput(lSprite))
    For i = 0 To 49
      lColor = -lColor +1
      If lSprite
         Circle(400,300, 500-(i*10), RGB(lColor*255, 0, 0))
      Else
         Circle(400,300, 500-(i*10), RGB(0, 0, lColor*255))
      EndIf
    Next
  StopDrawing()
Next

Repeat
  ClearScreen(0)
  ExamineKeyboard()
 
  DisplayTransparentSprite(0, -50+Cos(vain2.d)*50, -50+Sin(vain.d)*50)
  DisplayTransparentSprite(1, -50+Sin(vain.d)*50, -50+Cos(vain.d)*50)
  vain.d = vain.d + 0.05
  vain2.d = vain2.d + 0.025
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) 
Example 3:

Code: Select all

; ---- code by va!n aka 'thorsten will' in 2007 ----

InitSprite()
InitSprite3D()
InitKeyboard()

OpenScreen(640,480,32,"Exampe by va!n aka 'Thorsten Will' in 2007")
CreateSprite(0,800,600,#PB_Sprite_Texture)
CreateSprite(1,800,600,#PB_Sprite_Texture)

For lSprite = 0 To 1
  StartDrawing(SpriteOutput(lSprite))
    For i = 0 To 49
      lColor = -lColor +1
      If lSprite
         Circle(400,300, 500-(i*10), RGB(lColor*255, 0, 0))
      Else
         Circle(400,300, 500-(i*10), RGB(0, 0, lColor*255))
      EndIf
    Next
  StopDrawing()
Next

CreateSprite3D(0,0)
CreateSprite3D(1,1)

Repeat
  ClearScreen(0)
  ExamineKeyboard()
 
  Start3D()
    Sprite3DBlendingMode(10,7)
    DisplaySprite3D(0, -50+Cos(vain2.d)*50, -50+Sin(vain.d)*50)
    DisplaySprite3D(1, -50+Sin(vain.d)*50, -50+Cos(vain.d)*50)
  Stop3D()
 
  vain.d  = vain.d  + 0.05
  vain2.d = vain2.d + 0.025
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) 
Example 4:

Code: Select all

; ---- code by va!n aka 'thorsten will' in 2007 ----

InitSprite()
InitSprite3D()
InitKeyboard()

OpenScreen(640,480,32,"Exampe by va!n aka 'Thorsten Will' in 2007")
CreateSprite(0,800,600,#PB_Sprite_Texture)
CreateSprite(1,800,600,#PB_Sprite_Texture)
CreateSprite(2,800,600,#PB_Sprite_Texture)

For lSprite = 0 To 2
  StartDrawing(SpriteOutput(lSprite))
    For i = 0 To 49
      lColor = -lColor +1
      If lSprite = 0 : Circle(400,300, 500-(i*10), RGB(lColor*255, 0, 0)) : EndIf
      If lSprite = 1 : Circle(400,300, 500-(i*10), RGB(0, 0, lColor*255)) : EndIf
      If lSprite = 2 : Circle(400,300, 500-(i*10), RGB(0, lColor*255,0)) : EndIf
    Next
  StopDrawing()
Next

CreateSprite3D(0,0)
CreateSprite3D(1,1)
CreateSprite3D(2,2)

Repeat
  ClearScreen(0)
  ExamineKeyboard()
 
  Start3D()
    Sprite3DBlendingMode(10,7)
    DisplaySprite3D(0, -50+Cos(vain2.d)*50, -50+Sin(vain.d)*50)
    DisplaySprite3D(1, -50+Sin(vain.d)*50, -50+Cos(vain.d)*50)
    DisplaySprite3D(2, -50+Sin(vain.d/2)*50, -50+Cos(vain2.d)*50)
  Stop3D()
 
  vain.d  = vain.d  + 0.05
  vain2.d = vain2.d + 0.025
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) 
Example 5:

Code: Select all

; ---- code by va!n aka 'thorsten will' in 2007 ----

InitSprite()
InitSprite3D()
InitKeyboard()

OpenScreen(640,480,32,"Exampe by va!n aka 'Thorsten Will' in 2007")
CreateSprite(0,1024,768,#PB_Sprite_Texture)
CreateSprite(1,1024,768,#PB_Sprite_Texture)


For lSprite = 0 To 1
  StartDrawing(SpriteOutput(lSprite))
    For i = 0 To 49
      lColor = -lColor +1
      If lSprite = 0 : Circle(512,384, 500-(i*10), RGB(lColor*(i*5), 0, 0)) : EndIf
      If lSprite = 1 : Circle(512,384, 500-(i*10), RGB(0, 0, lColor*(i*5))) : EndIf
    Next
  StopDrawing()
Next

CreateSprite3D(0,0)
CreateSprite3D(1,1)

Repeat
  ClearScreen(0)
  ExamineKeyboard()
 
  Start3D()
    Sprite3DBlendingMode(4,7)
    DisplaySprite3D(0, -100+Cos(vain2.d)*50, -100+Sin(vain.d)*50)
    DisplaySprite3D(1, -150+Sin(vain.d)*50, -150+Cos(vain.d)*50)
    DisplaySprite3D(1, -200+Sin(vain.d/2)*200, -100+Cos(vain2.d)*100)
    DisplaySprite3D(0, -150+Cos(vain2.d)*150, -150+Sin(vain.d/2)*150)
  Stop3D()
 
  vain.d  = vain.d  + 0.05
  vain2.d = vain2.d + 0.025
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) 
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Very nice :)

I remember an effect like that in the "State of the Art".

Keep 'em coming.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Post Reply