voici mon code, si vous avez une idée pour faire un rendu plus réaliste je suis preneur !

vous pouvez regler la puissance du vent et sa direction avec le curseur en haut !
Edit:une petite amélioration !
Code : Tout sélectionner
InitSprite()
InitKeyboard()
OpenWindow(0,0,0,640,480,"Drapeau",#PB_Window_ScreenCentered|#PB_Window_SystemMenu )
OpenWindowedScreen(WindowID(0),0,80,640,400,0,0,0)
TrackBarGadget(0, 10, 40, 250, 20, 0, 20)
SetGadgetState(0,10)
Procedure DrawFlag(x,y,width, height, wind)
max=height/4
StartDrawing(ScreenOutput())
If Wind>0
For z=0 To width
Ang.f=(ElapsedMilliseconds()+z*wind*2)/500
If z=0:delta=Cos(ang)*max:EndIf
p.f=z-(wind/10)*z
Line(x+z,y+Cos(ang)*max-delta+p,1,height,#Red)
Next
Else
For z=0 To -width Step-1
Ang.f=(ElapsedMilliseconds()+z*wind*2)/500
If z=0:delta=Cos(ang)*max:EndIf
p.f=z+(wind/10)*z
Line(x+z,y+Cos(ang)*max-delta-p,1,height,#Red)
Next
EndIf
LineXY(x,y,x,y+Width*2)
LineXY(x+1,y,x+1,y+Width*2)
LineXY(x-1,y,x-1,y+Width*2)
StopDrawing()
EndProcedure
Repeat
Repeat
Event = WindowEvent()
If Event=#PB_Event_Gadget And EventGadget()=0
wind=GetGadgetState(0)-10
EndIf
If Event = #PB_Event_CloseWindow
End
EndIf
Until Event = 0
ClearScreen(0)
DrawFlag(320,200,100, 60, wind)
Delay(1)
FlipBuffers()
ForEver