Ci-joint une unité qui permet de se faire vite fait une petite animation à partir d'une décomposition d'images :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 unit Umovie; {$FRAME_RATE 10} interface uses flash8; type TMovie=class(movieclip) private indice:integer; bmp: BitmapData; Arrayimages:array of string; mc:array of movieclip; procedure setcharge(value:array of string); public procedure onEnterFrame;override; constructor create(parent:movieclip); property chargeimages:array of string read Arrayimages write setcharge; end; implementation constructor TMovie.Create(parent:movieclip); begin inherited Create(parent,'movie', movieclip(parent).getNextHighestDepth()); indice:=0; end; Procedure TMovie.setcharge(value:array of string); var i:integer; begin Arrayimages:=value; for i:=0 to value.length-1 do begin bmp := loadBitmap(Arrayimages[i]); mc[i]:=movieclip.Create(self,'',i); mc[i].attachBitmap(bmp,0); mc[i]._visible:=false; end; end; procedure Tmovie.onEnterFrame; var i:integer; begin if indice>mc.length-1 then begin indice:=0; for i:=0 to mc.length-1 do mc[i]._visible:=false; end; mc[indice]._visible:=true; inc(indice); end; end.
un programme tout petit :
les images sont en pièces jointes.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 program Pglobe; {$FRAME_WIDTH 104} {$FRAME_HEIGHT 104} {$JPEG nom1 'g1.jpg'} //images 52x52 px {$JPEG nom2 'g2.jpg'} {$JPEG nom3 'g3.jpg'} {$JPEG nom4 'g4.jpg'} {$JPEG nom5 'g5.jpg'} {$JPEG nom6 'g6.jpg'} {$JPEG nom7 'g7.jpg'} {$JPEG nom8 'g8.jpg'} {$JPEG nom9 'g9.jpg'} {$JPEG nom10 'g10.jpg'} {$JPEG nom11 'g11.jpg'} {$JPEG nom12 'g12.jpg'} {$JPEG nom13 'g13.jpg'} {$JPEG nom14 'g14.jpg'} {$JPEG nom15 'g15.jpg'} {$JPEG nom16 'g16.jpg'} {$JPEG nom17 'g17.jpg'} {$JPEG nom18 'g18.jpg'} {$JPEG nom19 'g19.jpg'} {$JPEG nom20 'g20.jpg'} {$JPEG nom21 'g21.jpg'} uses Flash8,Umovie; const globe:array[0..20] of string=('nom1','nom2','nom3','nom4','nom5','nom6','nom7','nom8','nom9','nom10','nom11','nom12','nom13','nom14','nom15','nom16','nom17','nom18','nom19','nom20','nom21'); var movie:Tmovie; begin movie:=TMovie.create(_root); movie.chargeimages:=globe; movie._xscale:=200; //ici parce ce que les images sont petites movie._yscale:=200; stage.scaleMode :='noScale'; //pour éviter la pixelisation end.
Si vous connaissez une adresse où trouver des images libres de décomposition de mouvement, je suis preneur. C'est utile pour agrémenter un site web...
je ne me souviens plus d'ailleurs où j'avais trouvé ces images...
bonne soirée
Partager