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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
| program motifppmilli_plus_dessin;
uses
Flash8, Math;
{$FRAME_WIDTH 500}
{$FRAME_HEIGHT 500}
{$BACKGROUND $ffffff}
var
i:integer;
bmp: BitmapData;
m:matrix;
image:movieclip;
x,y: Number;
angle: Number;
const
pi = 3.1415926535897932;
procedure fPoint(xp,yp:Number);
{ faux point }
begin
_root.moveTo(xp,yp);
_root.lineTo(xp+1,yp+1);
end;
begin
image:=movieclip.create(nil,'ppmillimetre',1);
image.linestyle(3,$4091CE);
image.moveto(0,0);
image.lineto(100,0);
image.moveto(0,0);
image.lineto(0,100);
image.linestyle(1,$4091CE);
For i:=1 to 9 do
begin
image.moveto(0,10*i);
image.lineto(100,10*i);
image.moveto(10*i,0);
image.lineto(10*i,100);
end;
//fin motif
bmp:=Bitmapdata.create(100,100);
bmp.draw(image);
image._visible:=false;
m:=matrix.create();
m.CreateBox(0.5,0.5,0,0,0); //scalex 50% et scaley 50% echelle 1/2 du motif
_root.beginBitmapFill(bmp,m);
_root.moveto(0,0);
_root.lineto(500, 0);
_root.lineto(500,500);
_root.lineto(0,500);
_root.lineto(0,0);
_root.EndFill();
// Repère
_root.lineStyle(1,$000000);
_root.moveTo(-200+250, 0+250);
_root.lineTo(+200+250, 0+250);
_root.moveTo(0+250 ,-200+250);
_root.lineTo(0+250 ,+200+250);
// Parabole
_root.lineStyle(1,$F00000);
x:=-200;
while (x<200) do
begin
y:=-x*x/100;
if abs(y)<200 then fPoint(x+250,y+250);
x:=x+1;
end;
// Arc de cercle
_root.lineStyle(1,$0000F0);
angle:=pi/2;
while (angle<3*pi/2) do
begin
x := 200 + 100 * cos(angle);
y := 0 - 100 * sin(angle);
fPoint(x+250,y+250);
angle:=angle+pi/200;
end;
// Droite coupant le cercle
_root.lineStyle(1,$F000F0);
x:=-200;
while (x<200) do
begin
y := -x / 2 + 30;
// La droite change de couleur au moment où elle coupe le cercle
if floor(sqrt((x-200)*(x-200) + y*y)) = 100 then _root.lineStyle(1,$00AA00);
fPoint(x+250,y+250);
x:=x+1;
end;
end. |
Partager