draw lines slow
Posted: Mon Oct 09, 2023 2:50 pm
				
				How can I draw lines slow in a for next loop ,I try delay but this will not work
			http://www.purebasic.com
https://www.purebasic.fr/english/
Maybe you put the delay inside StartDrawing-StopDrawing
Code: Select all
StartDrawing(CanvasOutput(#canvas1))      
            For n=7 To aantal_lijnen
               lijn$=GetGadgetItemText (#list1,n)  ;Gcode line ,coordinates lines ect..
               ;Debug lijn$
               ontrafel() ;find the start and end off the lines
             y2=180+(x_new *xpix_mm):x2=680+(zpix_mm * z_new );new endposition 
             LineXY(x1,y1,x2,y2,kleur) ;draw line            
             X1=X2:Y1=Y2     
             Delay(200);wait 200ms for drawing the next line ,this do not work
           Next  
           StopDrawing()
           Code: Select all
If OpenWindow(0, 0, 0, 600, 400, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 10, 10, 580, 350)
  ButtonGadget(1,10,360,60,20,"RUN")
  
  Repeat
    Select WaitWindowEvent(1)
      Case #PB_Event_CloseWindow
        Quit = 1
        
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 1
            For y = 10 To 200 Step 10
              StartDrawing(CanvasOutput(0))                
              LineXY(10,y,570,y,$0000FF)
              StopDrawing()
              Delay(500)
            Next
        EndSelect          
    EndSelect    
    
  Until Quit = 1
EndIf
Code: Select all
For n=7 To aantal_lijnen
  lijn$=GetGadgetItemText (#list1,n)  ;Gcode line ,coordinates lines ect..
                                      ;Debug lijn$
  ontrafel()                          ;find the start and end off the lines
  y2=180+(x_new *xpix_mm):x2=680+(zpix_mm * z_new );new endposition
  StartDrawing(CanvasOutput(#canvas1)) 
    LineXY(x1,y1,x2,y2,kleur) ;draw line            
    X1=X2:Y1=Y2
  StopDrawing()     
  Delay(200);wait 200ms for drawing the next line ,this do not work
Next