spinblur clock animation

Just starting out? Need help? Post your questions and find answers here.
firace
Posts: 28
Joined: Tue Jan 02, 2018 6:59 pm

spinblur clock animation

Post by firace »

Trying to adapt my spin-blur clock effect from PB to SB but I could use some help to make it work! All frames stay visible, creating a mess. Not sure if I should use a timer like in the PB version, multiple FlipBuffers() calls, or something else.
Any suggestions? See my current code below.

It's supposed to look like this:

Image

Code: Select all

Procedure RenderFrame()
  
  debug ElapsedMilliseconds()
  
  ClearScreen(0) 
  CreateSprite(33, W+200,W+200, #PB_Sprite_AlphaBlending) 
  StartDrawing(SpriteOutput(33)) 
  
  : DrawingFont(FontID(99))
  DrawingMode(#PB_2DDrawing_Transparent)
  
  a = 350  
  b = 350   
  
  sec$ = FormatDate("%hh:%ii:%ss", Date())
  DrawText(3, 3,Sec$, $E2E2E2) 
  
  StopDrawing()  
  
  x = 0 
  Repeat : x+1
    
    RotateSprite(33,  18,#PB_Relative) : DisplayTransparentSprite(33, 70, 70, 42) 
    
    ClearScreen(0)  
  Until x = 20
  
  DisplayTransparentSprite(33, 70, 70, 242)
  ;        delay(1000)
  FlipBuffers()
  
EndProcedure



InitSprite() :  W=550 : H=420  : LoadFont(99, "Consolas", 36)

OpenWindow(0, 35, 35, W+1, H, "firace's spinblur clock", #PB_Window_SizeGadget|#PB_Window_SystemMenu)

OpenWindowedScreen(WindowID(0),0,0,W+1,H,1,0,0)  

; AddWindowTimer(0, 1, 1000)

BindEvent(#PB_Event_RenderFrame, @RenderFrame())


FlipBuffers() ; start the rendering