UnderwareDESIGN

PlayBASIC => Resources => Source Codes => Topic started by: kevin on February 22, 2010, 09:30:29 AM

Title: Spiral / Swirl Effect
Post by: kevin on February 22, 2010, 09:30:29 AM
  Spiral / Swirl Effect

  This example draws a sort of spiral / swirling effect.

  This short demo shows off some simple visual effects using Alpha blending.   The effect works by drawing a blended shape (in this case a circle) over the backdrop from the previous update.  

  When we display the backdrop; we apply some alpha blending onto it to reduce the colour levels.   This Make it appear as if the moving object is leaving a trail..



 Requires PB V1.64K2

 [pbcode]

   #include "blitimage"


   Screen=NewFxIMage(GetScreenWidth(),GetSCreenHeight())

   Colour=RndRGB()


   Do
      RendertoImage Screen

      Baseangle#=wrapangle(Baseangle#,1)
      
      
      scx=GetScreenWidth()/2
      scy=GetScreenHeight()/2
      inkmode 1+32
      Offset=0
      for lp=0 to 360 step 5
         a#=Baseangle#+lp   
         x#=scx+cosradius(a#,100+lp)
         y#=scy+sinradius(a#,100-lp)
         circlec x#,y#,32+Offset,true,Colour
         Offset++
      next
      inkmode 1      
      

      rendertoscreen
      BlitImageAlphaPostMultColour(Screen,0,0,$ffffff)

      if spacekey()
         ink $ffffff
         setcursor 0,0
         print Fps()
      endif

      Sync
   loop

 [/pbcode]


 
Video: