PS: les explications dans les posts suivants
Code : Tout sélectionner
; manif - pf shadoko - 2017
EnableExplicit
Procedure ColorBlend(color1.l, color2.l, blend.f=0.5)
Protected r.w,g.w,b.w,a.w
r= Red(color1) + (Red(color2) - Red(color1)) * blend
g=Green(color1) + (Green(color2) - Green(color1)) * blend
b= Blue(color1) + (Blue(color2) - Blue(color1)) * blend
a=Alpha(color1) + (Alpha(color2) - Alpha(color1)) * blend
ProcedureReturn RGBA(r,g,b,a)
EndProcedure
;=======================================================================================
Structure spancarte
ok.b
bcolor.l
fcolor.l
slogan.s
EndStructure
Structure smanif
x.f
y.f
z.f
v.f
pf.f
pancarte.spancarte
EndStructure
Global nm=255,ns=6
Global Dim manif.smanif(nm)
Global Dim slogan.s(ns)
slogan(0)=~"Conversion automatique\ndes anciens codes"
slogan(1)=~"LES 'DECLARE'\nY'EN A MARRE !!!"
slogan(2)=~"InitMouse\nInitKeyboard\nInitSprite\nInit...\non en veut plus !"
slogan(3)=~"BYVAL / BYREF"
slogan(4)=~"Les énumérations\ncomme type\nde variable"
slogan(5)=~"Les procedures aussi\nont besoin des types:\nTableau\nListe\nMap\n et Structure !"
slogan(6)=~"DES VARIABLES\n POUR LES 'STEP'"
Procedure initmanif(i,z=100)
With manif(i)
\x=Random(400)-200
\y=Random(20)
\z=z
\v=(Random(10)+50)/400
\pf=Random(200,100)/1000
EndWith
With manif(i)\pancarte
\ok=Bool(Random(32)=0)
\bcolor=$ff<<24|Random($ffffff)
\fcolor=$ff<<24|Random($ffffff)
\slogan=slogan(Random(ns))
EndWith
EndProcedure
Procedure affiche()
Static c=1111:c+1
Protected i,g.f,x.f,y.f,dx,dy
StartVectorDrawing(CanvasVectorOutput(0))
VectorFont(FontID(0),10)
VectorSourceLinearGradient(0,0,0,600)
VectorSourceGradientColor($ffffaaaa, 0.0)
VectorSourceGradientColor($ffffaaaa, 0.5)
VectorSourceGradientColor($ff888888, 1.0)
FillVectorOutput()
SortStructuredArray(manif(),#PB_Sort_Descending,OffsetOf(smanif\z), TypeOf(smanif\z))
For i=0 To nm
With manif(i)
g=80/\z
ResetCoordinates()
TranslateCoordinates(400,300)
ScaleCoordinates(g,g)
x=\x
y=-(\y-50+4*Abs(Sin(c*\pf)))
If \pancarte\ok
RotateCoordinates(x,y,5*Sin(c*\pf))
dx= VectorTextWidth(\pancarte\slogan)+10
dy= VectorTextHeight(\pancarte\slogan)+10
AddPathBox(x-3,y-dy-70, 6,dy+100)
VectorSourceColor(ColorBlend($ff88aaaa,$ffffaaaa,\z/100))
FillPath()
AddPathBox(x-dx/2,y-dy-60, dx,dy)
VectorSourceColor(ColorBlend(\pancarte\bcolor,$ffffaaaa,\z/100))
FillPath()
MovePathCursor(x-dx/2,y-dy-60+5)
VectorSourceColor(ColorBlend(\pancarte\fcolor,$ffffaaaa,\z/100))
DrawVectorParagraph(\pancarte\slogan,dx,dy,#PB_VectorParagraph_Center)
EndIf
x-20
AddPathCircle(x,y, 20)
VectorSourceColor(ColorBlend($ff888888,$ffffaaaa,\z/100))
FillPath()
\z-\v:If \z<1:initmanif(i):EndIf
EndWith
Next
StopVectorDrawing()
EndProcedure
Define i
OpenWindow(0, 0, 0, 800,600, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0,0,0,800,600)
LoadFont(0, "Comic Sans MS", 10)
For i=0 To nm
initmanif(i,Random(100,10))
Next
AddWindowTimer(0, 0, 20):BindEvent(#PB_Event_Timer, @ affiche())
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow