程
程云
Unregistered / Unconfirmed
GUEST, unregistred user!
实现图片显示动画效果;
大家好又要麻烦一下各位了,公司要作点多媒体光盘,需要一些图片显示的动画效果。
我这有三百分,其中有五十分是给老猫的,已欠了他好几回了,这次一定给他。
另外每一个动画效果10分。
下面我已列出的几个简单的效果就不用再帖进来了(不过你如果有更好的算法我也很欢迎)。
但不可拿一些假货充数,如:
procedure TForm1.timer1Timer(Sender: TObject);
begin
if dbimage1.left >0then
begin
dbimage1.left:=dbimage1.left-3;
dbimage1.width:=dbimage1.width+3;
end
else
begin
dbimage1.left:=form1.width;
dbimage1.width:=0;
end;
end;
以下是已有的动画效果:
procedure Twelcome.showpic(PlayMode:integer;RCode:Integer);
var
newbmp:TBitmap;
x,y,i,j,k,x1,x2,y1,y2,ynum,xnum,ScrH,ScrW:integer;
begin
newbmp:=TBitmap.Create;
newbmp.Width := Image.Width;
newbmp.Height := Image.Height;
ScrH:=Image.Height;
ScrW:=Image.Width;
newbmp.Canvas.StretchDraw(Rect(0,0,ScrW,ScrH),Image.Picture.Graphic);
case PlayMode of
0:begin //从左向右移动(设x初值为Screen.Width)
x:=ScrW;
while x>0 do
begin
x:=x-10;
welcome.Canvas.CopyRect(Rect(x,FormH+0,x+10,FormH+ScrH),newbmp.Canvas,Rect(x,0,x+10,ScrH));
Sleep(RCode);
end;
end;
1:begin //从右向左拉(设x初值为0)
x:=0;
while x<ScrW do
begin
x:=x+10;
welcome.Canvas.CopyRect(Rect(x,FormH+0,x-10,FormH+ScrH),newbmp.Canvas,Rect(x,0,x-10,ScrH));
Sleep(RCode);
end;
end;
2:begin //从下向上拉(设y初值为ScrH)
y:=ScrH;
while y>0 do
begin
y:=y-10;
welcome.Canvas.CopyRect(Rect(0,FormH+y,ScrW,FormH+y+10),newbmp.Canvas,Rect(0,y,ScrW,y+10));
Sleep(RCode);
end;
end;
3:begin //从上向下拉(设y初值为0)
y:=0;
while y<ScrH do
begin
y:=y+10;
welcome.Canvas.CopyRect(Rect(0,FormH+y,ScrW,FormH+y-10),newbmp.Canvas,Rect(0,y,ScrW,y-10));
Sleep(RCode);
end;
end;
4:begin //从中间往两边拉
x:=ScrW div 2;
x1:=x;
x2:=x;
while x1>0 do
begin
x1:=x1-10;
x2:=x2+10;
welcome.Canvas.CopyRect(Rect(x1,FormH+0,x1+10,FormH+ScrH),newbmp.Canvas,Rect(x1,0,x1+10,ScrH));
welcome.Canvas.CopyRect(Rect(x2,FormH+0,x2-10,FormH+ScrH),newbmp.Canvas,Rect(x2,0,x2-10,ScrH));
Sleep(RCode);
end;
end;
5:begin //两边从往中间拉
x:=ScrW;
x1:=0;
while x>(x div 2)do
begin
x:=x-10;
x1:=x1+10;
welcome.Canvas.CopyRect(Rect(x,FormH+0,x+10,FormH+ScrH),newbmp.Canvas,Rect(x,0,x+10,ScrH));
welcome.Canvas.CopyRect(Rect(x1,FormH+0,x1-10,FormH+ScrH),newbmp.Canvas,Rect(x1,0,x1-10,ScrH));
Sleep(RCode);
end;
end;
6:begin //从两边间隔拉
x:=ScrW;
x1:=0;
while x>0do
begin
x:=x-10;
x1:=x1+10;
ynum:=ScrH div 20;
for j:=0 to ynum do
begin
welcome.Canvas.CopyRect(Rect(x,FormH+j*20,x+10,FormH+j*20+10),newbmp.Canvas,Rect(x,j*20,x+10,j*20+10));
welcome.Canvas.CopyRect(Rect(x1,FormH+j*20+10,x1-10,FormH+j*20+20),newbmp.Canvas,Rect(x1,j*20+10,x1-10,j*20+20));
end;
Sleep(RCode);
end;
end;
7:begin //从上下间隔拉
y:=ScrH;
y1:=0;
while y>0do
begin
y:=y-10;
y1:=y1+10;
xnum:=ScrW div 20;
for j:=0 to xnum do
begin
welcome.Canvas.CopyRect(Rect(j*20,FormH+y,j*20+10,FormH+y+10),newbmp.Canvas,Rect(j*20,y,j*20+10,y+10));
welcome.Canvas.CopyRect(Rect(j*20+10,FormH+y1,j*20+20,FormH+y1-10),newbmp.Canvas,Rect(j*20+10,y1,j*20+20,y1-10));
end;
Sleep(RCode);
end;
end;
8:begin //从中间往四边拉
x:=ScrW div 2;
y:=ScrH div 2;
y1:=y; y2:=y-2; x1:=x; x2:=x;
while (x1>0) or (y1>0) do
begin
x1:=x1-2; x2:=x2+2;
y1:=y1-2; y2:=y2+2;
welcome.Canvas.CopyRect(Rect(x1,FormH+0,x1+2,FormH+ScrH),newbmp.Canvas,Rect(x1,0,x1+2,ScrH));
welcome.Canvas.CopyRect(Rect(0,FormH+y1,ScrW,FormH+y1+2),newbmp.Canvas,Rect(0,y1,ScrW,y1+2));
welcome.Canvas.CopyRect(Rect(x2,FormH+0,x2-2,FormH+ScrH),newbmp.Canvas,Rect(x2,0,x2-2,ScrH));
welcome.Canvas.CopyRect(Rect(0,FormH+y2,ScrW,FormH+y2+2),newbmp.Canvas,Rect(0,y2,ScrW,y2+2));
Sleep(RCode);
end;
end;
9:begin //从四边往中间拉
x:=ScrW;
y:=ScrH;
x1:=0;y1:=0;
while (x>(x div 2)) or (y>(y div 2))do
begin
x:=x-2; x1:=x1+2;
y:=y-2; y1:=y1+2;
welcome.Canvas.CopyRect(Rect(x,FormH+0,x+2,FormH+ScrH),newbmp.Canvas,Rect(x,0,x+2,ScrH));
welcome.Canvas.CopyRect(Rect(0,FormH+y,ScrW,FormH+y+2),newbmp.Canvas,Rect(0,y,ScrW,y+2));
welcome.Canvas.CopyRect(Rect(x1,FormH+0,x1-2,FormH+ScrH),newbmp.Canvas,Rect(x1,0,x1-2,ScrH));
welcome.Canvas.CopyRect(Rect(0,FormH+y1,ScrW,FormH+y1-2),newbmp.Canvas,Rect(0,y1,ScrW,y1-2));
Sleep(RCode);
end;
end;
10:begin //马赛克
for i:=0 to ScrW*ScrH div 10 do
begin
j := Random(ScrW div 4)*4;
k := Random(ScrH div 4)*4;
welcome.Canvas.CopyRect(Rect(j,FormH+k,j+4,FormH+k+4),newbmp.Canvas,Rect(j,k,j+4,k+4));
end;
welcome.Canvas.CopyRect(Rect(0,FormH+0,ScrW,FormH+ScrH),newbmp.Canvas,Rect(0,0,ScrW,ScrH));
end;
11:begin //左右两次刷新
x:=0;
while x<(ScrW+6) do
begin
x:=x+6;
welcome.Canvas.CopyRect(Rect(x-3,FormH+0,x-6,FormH+ScrH),newbmp.Canvas,Rect(x-3,0,x-6,ScrH));
Sleep(10);
end;
while (x+6)>0 do
begin
x:=x-6;
welcome.Canvas.CopyRect(Rect(x+3,FormH+0,x+6,FormH+ScrH),newbmp.Canvas,Rect(x+3,0,x+6,ScrH));
Sleep(10);
end;
end;
12:begin //左右两次刷新
x:=ScrW;
while (x+6)>0 do
begin
x:=x-6;
welcome.Canvas.CopyRect(Rect(x+3,FormH+0,x+6,FormH+ScrH),newbmp.Canvas,Rect(x+3,0,x+6,ScrH));
Sleep(10);
end;
while x<(ScrW+6) do
begin
x:=x+6;
welcome.Canvas.CopyRect(Rect(x-3,FormH+0,x-6,FormH+ScrH),newbmp.Canvas,Rect(x-3,0,x-6,ScrH));
Sleep(10);
end;
end;
end;
newbmp.Free;
end;
大家好又要麻烦一下各位了,公司要作点多媒体光盘,需要一些图片显示的动画效果。
我这有三百分,其中有五十分是给老猫的,已欠了他好几回了,这次一定给他。
另外每一个动画效果10分。
下面我已列出的几个简单的效果就不用再帖进来了(不过你如果有更好的算法我也很欢迎)。
但不可拿一些假货充数,如:
procedure TForm1.timer1Timer(Sender: TObject);
begin
if dbimage1.left >0then
begin
dbimage1.left:=dbimage1.left-3;
dbimage1.width:=dbimage1.width+3;
end
else
begin
dbimage1.left:=form1.width;
dbimage1.width:=0;
end;
end;
以下是已有的动画效果:
procedure Twelcome.showpic(PlayMode:integer;RCode:Integer);
var
newbmp:TBitmap;
x,y,i,j,k,x1,x2,y1,y2,ynum,xnum,ScrH,ScrW:integer;
begin
newbmp:=TBitmap.Create;
newbmp.Width := Image.Width;
newbmp.Height := Image.Height;
ScrH:=Image.Height;
ScrW:=Image.Width;
newbmp.Canvas.StretchDraw(Rect(0,0,ScrW,ScrH),Image.Picture.Graphic);
case PlayMode of
0:begin //从左向右移动(设x初值为Screen.Width)
x:=ScrW;
while x>0 do
begin
x:=x-10;
welcome.Canvas.CopyRect(Rect(x,FormH+0,x+10,FormH+ScrH),newbmp.Canvas,Rect(x,0,x+10,ScrH));
Sleep(RCode);
end;
end;
1:begin //从右向左拉(设x初值为0)
x:=0;
while x<ScrW do
begin
x:=x+10;
welcome.Canvas.CopyRect(Rect(x,FormH+0,x-10,FormH+ScrH),newbmp.Canvas,Rect(x,0,x-10,ScrH));
Sleep(RCode);
end;
end;
2:begin //从下向上拉(设y初值为ScrH)
y:=ScrH;
while y>0 do
begin
y:=y-10;
welcome.Canvas.CopyRect(Rect(0,FormH+y,ScrW,FormH+y+10),newbmp.Canvas,Rect(0,y,ScrW,y+10));
Sleep(RCode);
end;
end;
3:begin //从上向下拉(设y初值为0)
y:=0;
while y<ScrH do
begin
y:=y+10;
welcome.Canvas.CopyRect(Rect(0,FormH+y,ScrW,FormH+y-10),newbmp.Canvas,Rect(0,y,ScrW,y-10));
Sleep(RCode);
end;
end;
4:begin //从中间往两边拉
x:=ScrW div 2;
x1:=x;
x2:=x;
while x1>0 do
begin
x1:=x1-10;
x2:=x2+10;
welcome.Canvas.CopyRect(Rect(x1,FormH+0,x1+10,FormH+ScrH),newbmp.Canvas,Rect(x1,0,x1+10,ScrH));
welcome.Canvas.CopyRect(Rect(x2,FormH+0,x2-10,FormH+ScrH),newbmp.Canvas,Rect(x2,0,x2-10,ScrH));
Sleep(RCode);
end;
end;
5:begin //两边从往中间拉
x:=ScrW;
x1:=0;
while x>(x div 2)do
begin
x:=x-10;
x1:=x1+10;
welcome.Canvas.CopyRect(Rect(x,FormH+0,x+10,FormH+ScrH),newbmp.Canvas,Rect(x,0,x+10,ScrH));
welcome.Canvas.CopyRect(Rect(x1,FormH+0,x1-10,FormH+ScrH),newbmp.Canvas,Rect(x1,0,x1-10,ScrH));
Sleep(RCode);
end;
end;
6:begin //从两边间隔拉
x:=ScrW;
x1:=0;
while x>0do
begin
x:=x-10;
x1:=x1+10;
ynum:=ScrH div 20;
for j:=0 to ynum do
begin
welcome.Canvas.CopyRect(Rect(x,FormH+j*20,x+10,FormH+j*20+10),newbmp.Canvas,Rect(x,j*20,x+10,j*20+10));
welcome.Canvas.CopyRect(Rect(x1,FormH+j*20+10,x1-10,FormH+j*20+20),newbmp.Canvas,Rect(x1,j*20+10,x1-10,j*20+20));
end;
Sleep(RCode);
end;
end;
7:begin //从上下间隔拉
y:=ScrH;
y1:=0;
while y>0do
begin
y:=y-10;
y1:=y1+10;
xnum:=ScrW div 20;
for j:=0 to xnum do
begin
welcome.Canvas.CopyRect(Rect(j*20,FormH+y,j*20+10,FormH+y+10),newbmp.Canvas,Rect(j*20,y,j*20+10,y+10));
welcome.Canvas.CopyRect(Rect(j*20+10,FormH+y1,j*20+20,FormH+y1-10),newbmp.Canvas,Rect(j*20+10,y1,j*20+20,y1-10));
end;
Sleep(RCode);
end;
end;
8:begin //从中间往四边拉
x:=ScrW div 2;
y:=ScrH div 2;
y1:=y; y2:=y-2; x1:=x; x2:=x;
while (x1>0) or (y1>0) do
begin
x1:=x1-2; x2:=x2+2;
y1:=y1-2; y2:=y2+2;
welcome.Canvas.CopyRect(Rect(x1,FormH+0,x1+2,FormH+ScrH),newbmp.Canvas,Rect(x1,0,x1+2,ScrH));
welcome.Canvas.CopyRect(Rect(0,FormH+y1,ScrW,FormH+y1+2),newbmp.Canvas,Rect(0,y1,ScrW,y1+2));
welcome.Canvas.CopyRect(Rect(x2,FormH+0,x2-2,FormH+ScrH),newbmp.Canvas,Rect(x2,0,x2-2,ScrH));
welcome.Canvas.CopyRect(Rect(0,FormH+y2,ScrW,FormH+y2+2),newbmp.Canvas,Rect(0,y2,ScrW,y2+2));
Sleep(RCode);
end;
end;
9:begin //从四边往中间拉
x:=ScrW;
y:=ScrH;
x1:=0;y1:=0;
while (x>(x div 2)) or (y>(y div 2))do
begin
x:=x-2; x1:=x1+2;
y:=y-2; y1:=y1+2;
welcome.Canvas.CopyRect(Rect(x,FormH+0,x+2,FormH+ScrH),newbmp.Canvas,Rect(x,0,x+2,ScrH));
welcome.Canvas.CopyRect(Rect(0,FormH+y,ScrW,FormH+y+2),newbmp.Canvas,Rect(0,y,ScrW,y+2));
welcome.Canvas.CopyRect(Rect(x1,FormH+0,x1-2,FormH+ScrH),newbmp.Canvas,Rect(x1,0,x1-2,ScrH));
welcome.Canvas.CopyRect(Rect(0,FormH+y1,ScrW,FormH+y1-2),newbmp.Canvas,Rect(0,y1,ScrW,y1-2));
Sleep(RCode);
end;
end;
10:begin //马赛克
for i:=0 to ScrW*ScrH div 10 do
begin
j := Random(ScrW div 4)*4;
k := Random(ScrH div 4)*4;
welcome.Canvas.CopyRect(Rect(j,FormH+k,j+4,FormH+k+4),newbmp.Canvas,Rect(j,k,j+4,k+4));
end;
welcome.Canvas.CopyRect(Rect(0,FormH+0,ScrW,FormH+ScrH),newbmp.Canvas,Rect(0,0,ScrW,ScrH));
end;
11:begin //左右两次刷新
x:=0;
while x<(ScrW+6) do
begin
x:=x+6;
welcome.Canvas.CopyRect(Rect(x-3,FormH+0,x-6,FormH+ScrH),newbmp.Canvas,Rect(x-3,0,x-6,ScrH));
Sleep(10);
end;
while (x+6)>0 do
begin
x:=x-6;
welcome.Canvas.CopyRect(Rect(x+3,FormH+0,x+6,FormH+ScrH),newbmp.Canvas,Rect(x+3,0,x+6,ScrH));
Sleep(10);
end;
end;
12:begin //左右两次刷新
x:=ScrW;
while (x+6)>0 do
begin
x:=x-6;
welcome.Canvas.CopyRect(Rect(x+3,FormH+0,x+6,FormH+ScrH),newbmp.Canvas,Rect(x+3,0,x+6,ScrH));
Sleep(10);
end;
while x<(ScrW+6) do
begin
x:=x+6;
welcome.Canvas.CopyRect(Rect(x-3,FormH+0,x-6,FormH+ScrH),newbmp.Canvas,Rect(x-3,0,x-6,ScrH));
Sleep(10);
end;
end;
end;
newbmp.Free;
end;