|
盒子资源分类 |
|
|
|
|
跨平台,物体沿轨迹(SVG)运动实例。 |
|
关键字:跨平台,轨迹,SVG,运动 |
来 自:原创 |
平 台:Win2K/2003/NT/XP,Vista/WIN7 |
下载所需:0 火柴 |
深浅度:中级 |
完成时间:2018/5/3 |
发布者:chn1009 (奖励50火柴) |
发布时间:2018/5/9 |
编辑器:DelphiXE2 |
语 种:简体中文 |
分 类:多媒体 |
下载浏览:152/13282 |
|
|
|
|
跨平台,物体沿轨迹(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. |
|
本站原创作品,未经作者许可,严禁任何方式转载;转载作品,如果侵犯了您的权益,请联系我们! |
相关文章 |
|
|
|
相关评论 |
|
|
|
|