Delphi XE6 在两个图片切换的时候实现翻书效果


本文整理自网络,侵删。

 介绍

本文章实现了Delphi XE6 在两个图片切换的时候实现翻书效果,实现这个效果需要使用到TSwipeTransitionEffect 、TPathAnimation。

首先我们创建一个HD的FireMonkey工程,然后添加如下的控件:TImage、TSwipeTransitionEffect 、TSelectionPoint、TPathAnimation ,然后为Image控件加载一个图片,然后选择为TSwipeTransitionEffect选择返回的图片。

这样在Image控件的OnClick事件下添加如下代码
procedure TForm1.Image1Click(Sender: TObject);
begin
  PathAnimation1.Enabled := False;
  SelectionPoint1.Position.Point := PointF(0,0);
  SelectionPoint1.Opacity := 0;
  PathAnimation1.Parent := SelectionPoint1;
  PathAnimation1.Path.Clear;
// begin Path for mouse pointer
  PathAnimation1.Path.MoveTo(PointF(0,0));
  PathAnimation1.Path.LineTo(PointF(Form1.Width/2,Form1.Height/2));
  PathAnimation1.Path.LineTo(PointF(Form1.Width*2,0));
// end
  PathAnimation1.Duration := 2;
  PathAnimation1.Start;
end;


然后为TPathAnimation控件添加OnFinish、OnProcess事件代码
procedure TForm1.PathAnimation1Finish(Sender: TObject);
var
  BitMap : TBitmap;
begin
  BitMap := TBitmap.Create(0,0);
  BitMap.Assign(SwipeTransitionEffect1.Target);
  SwipeTransitionEffect1.Target := Image1.Bitmap;
  Image1.Bitmap.Assign(BitMap);
  SwipeTransitionEffect1.MousePoint := PointF(0,0);
end;

procedure TForm1.PathAnimation1Process(Sender: TObject);
begin
SwipeTransitionEffect1.MousePoint:=SelectionPoint1.Position.Point;
end;

相关阅读 >>

Delphi 映像劫持编辑器

Delphi 操作前,删除前,覆盖前,询问对话框

Delphi实现win10下Delphi 10.3.1 inline hook 调试器法获取寄存器并修改

Delphi 下载整个网站图片例子

Delphi seek函数中参数说明

Delphi 得到不同平台的录音文件保存路径

Delphi makeuniquefilename 创建文件名如果已经存在自动更改文件名

Delphi idhttp实现get方法下载文件,断点续传

Delphi 根据进程名称获取进程号

Delphi startcount() 时间计数器

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...