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=39
Global Dim manif.smanif(nm)
Global Dim slogan.s(ns)
slogan(0)=~"Vive PureBasic"
slogan(1)=~"Bonne Année";"Fils de personne"
slogan(2)=~"2022";"Te voir grandir"
slogan(3)=~"Heureuse année";"Rester vivant!"
slogan(4)=~"Bonheur";"La musique que j'aime"
slogan(5)=~"Merci pf shadoko";"Je te promets"
slogan(6)=~"Longue";"La rue"
slogan(7)=~"Vigoureuse!";"Merci Johnny !!"
slogan(8)=~"Vive PureBasic"
slogan(9)=~"Rentrée d'argent";"Vous n'aurez pas ma peau"
slogan(10)=~"mais moins de factures";"Je tiendrai bon"
slogan(11)=~"I am the blues!"
slogan(12)=~"Sérénité";"Allumer le feu"
slogan(13)=~"Amour";"Quelque chose de Tennessee"
slogan(14)=~"Be-Bop-A-Lula"
slogan(15)=~"Merci Johnny !!"
slogan(16)=~"Vive PureBasic"
slogan(17)=~"Tendresse!";"Mon plus beau Noël"
slogan(18)=~"Le temps passe vite"
slogan(19)=~"Gabrielle"
slogan(20)=~"Je te promets"
slogan(21)=~"Bonheur";"J'oublierai ton nom"
slogan(22)=~"Je me souviens"
slogan(23)=~"Merci Johnny !!"
slogan(24)=~"Merci à ChrisR"
slogan(25)=~"Marie"
slogan(26)=~"Mieux qu'hier";"Entre chiens et loups"
slogan(27)=~"Ma gueule!"
slogan(28)=~"Vivre pour le meilleur"
slogan(29)=~"Pardon"
slogan(30)=~"Bonne Année 2022";"Le pénitencier"
slogan(31)=~"et Heureuse";"Aussi dur que du bois"
slogan(32)=~"Année 2022";"Excuse-moi partenaire"
slogan(33)=~"2022";"Love Me Tender"
slogan(34)=~"Bonne Année à toutes";"Hey Joe"
slogan(35)=~"Je ne suis pas un héros"
slogan(36)=~"Bonne Année à tous";"La Chanson des Restos"
slogan(37)=~"J'oublierai ton nom"
slogan(38)=~"Merci Pr Shadoko - 2017 "
slogan(39)=~"Merci Fred / PureBasic"
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, 900,700, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0,0,0,900,700)
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