svg缩放移动、移动轨迹追溯_盒子 - 跨平台,物体沿轨迹(SVG)运动实例。

跨平台,物体沿轨迹(SVG)运动实例。

设计人:付贵军  QQ和微信名称:雨夜  QQ1034724439

delphiXE 网上动画方面的文章很少,下面例子,起到举一反三,触类旁通的作用。delphiXE2以上版本用去SVG图像格式。SVG可以算是目前最最火热的图像文件格式了,它的英文全称为Scalable Vector Graphics,意思为可缩放的矢量图形。它是基于XML(Extensible Markup Language),由World Wide Web Consortium(W3C)联盟进行开发的。严格来说应该是一种开放标准的矢量图形语言,可让你设计激动人心的、高分辨率的Web图形页面。用户可以直接用代码来描绘图像,可以用任何文字处理工具打开SVG图像,通过改变部分代码来使图像具有交互功能,并可以随时插入到HTML中通过浏览器来观看比较常用在线图像编辑网站

https://c.runoob.com/more/svgeditor/

http://www.zhangxinxu.com/sp/svg/#paste

这样网站很多

PathAnimation 中 path输入  m53.5,136.66c108,68 106,68 105.5,67.34c0.5,0.66 -22.5,2.66 -24.5,25.66c-2,23 -11,59 18,63c29,4 86,1 103,-3c17,-4 38,-17 42,-25c4,-8 12,-37 15,-49c3,-12 -11,-50 -13,-52c-2,-2 -59,-34 -63,-37c-4,-3 -61,-16 -63,-17c-2,-1 -54,-11 -55,-11c-1,0 -173,-30 -65,38z

代表是一个封闭曲线。

在窗体上放一个园Layer3D1在其上放入circle1,圆下放一下pathAnimation1

PathAnimation1 属性中 path输入  m53.5,136.66c108,68 106,68 105.5,67.34c0.5,0.66 -22.5,2.66 -24.5,25.66c-2,23 -11,59 18,63c29,4 86,1 103,-3c17,-4 38,-17 42,-25c4,-8 12,-37 15,-49c3,-12 -11,-50 -13,-52c-2,-2 -59,-34 -63,-37c-4,-3 -61,-16 -63,-17c-2,-1 -54,-11 -55,-11c-1,0 -173,-30 -65,38z

当然我又放入一圆,沿椭圆运动,写一参数方程,代码不多,达到了快速编辑三维动画的效果。

下面是具体代码:

unit Unit12;

interface

uses

System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,

FMX.Types, FMX.Controls, FMX.Forms3D, FMX.Types3D, FMX.Forms, FMX.Graphics,

FMX.Dialogs, System.Math.Vectors, FMX.Objects3D, FMX.Objects, FMX.Controls3D,

FMX.Layers3D, FMX.Ani, FMX.MaterialSources, FMX.Controls.Presentation,

FMX.StdCtrls;

type

TForm12 = class(TForm3D)

Layer3D1: TLayer3D;

Circle1: TCircle;

Brush1: TBrushObject;

PathAnimation1: TPathAnimation;

Path1: TPath;

Cylinder1: TCylinder;

TextureMaterialSource1: TTextureMaterialSource;

TextureMaterialSource2: TTextureMaterialSource;

Light1: TLight;

Light2: TLight;

Cube2: TCube;

Camera1: TCamera;

Timer1: TTimer;

Button1: TButton;

Sphere1: TSphere;

TextureMaterialSource3: TTextureMaterialSource;

Button2: TButton;

Label1: TLabel;

Circle2: TCircle;

Cone1: TCone;

TextureMaterialSource4: TTextureMaterialSource;

PathAnimation2: TPathAnimation;

procedure Timer1Timer(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

private

var x1:integer;

{ Private declarations }

public

{ Public declarations }

end;

var

Form12: TForm12;

implementation

{$R *.fmx}

procedure TForm12.Button1Click(Sender: TObject);

begin

Timer1.Interval:=0;

end;

procedure TForm12.Button2Click(Sender: TObject);

begin

Timer1.Interval:=500;

end;

procedure TForm12.Timer1Timer(Sender: TObject);

begin

x1:=x1+1;

Cylinder1.RotationAngle.Y :=x1*50;

Cube2.RotationAngle.Y :=x1*50;

//Cube2.RotationAngle.Z :=x1*30;

//Cube2.RotationAngle.X :=x1*10;

//Sphere1.RotationAngle.X :=x1*15;

Sphere1.RotationAngle.Y :=x1*5;

//Sphere1.RotationAngle.Z :=x1*2;

Circle2.Position.X :=Circle2.Position.X+187*cos(x1);

Circle2.Position.Y :=Circle2.Position.Y+182*sin(x1);

Cone1.RotationAngle.Y :=-x1*10;

Layer3D1.RotationAngle.x :=Random(10);

//Layer3D1.RotationAngle.X :=-x1*10;

//Layer3D1.RotationAngle.x :=15*cos(x1*10);

//Layer3D1.RotationAngle.Y :=sin(x1*10);

//Layer3D1.RotationAngle.Z :=25*tan(x1);

end;

end.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值