This sample illustrates how to create 3D animations using FireMonkey.
You can find the AnimationDemo3D sample project at:
- Start | Programs | Embarcadero RAD Studio 10.2 Tokyo | Samples and then navigate to:
CPP\Multi-Device Samples\User Interface\AnimationDemo3D
- Subversion Repository:
How to Use the Sample
- Navigate to the location given above, and open AnimationDemo3D.cbproj.
- Select the target platform.
- Press F9 or choose Run > Run.
- See the different animations.
|File in C++||Contains|
The project itself.
The main form where the components are located.
Used to define and implement the sample.
TfrmAniDemo is the main form that represents the main window of the sample. It is a 3D form that contains the following components:
- A TLightMaterialSource object labeled as ColorLighting.
- A TLight object.
- A TLayer3D object that contains the following components:
- A TPlane object that contains:
- A TTextLayer3D object labeled as Text4.
- A TRoundCube object labeled as RoundCube1 that contains:
- A TFloatAnimation object labeled as FloatAnimation3.
- A TSphere object labeled as Sphere1 that contains:
- A TSphere object labeled as Sphere2 that contains:
- A TStrokeCube object labeled as StrokeCube1 that contains:
- A TTextLayer3D object labeled as Text3.
- A TText3D object labeled Text3D1 that contains:
- A TFloatAnimation object labeled as FloatAnimation4.
- A TLightMaterialSource object labeled as TextureLighting.
- The sample uses:
- TLayer3D to hold any 2D object in a FireMonkey 3D form.
- TLayout to organize multiple graphical controls under the same parent.
- TSphere to implement a 3D sphere shape that can be placed on a 3D FireMonkey form.
- TRoundRect to define 2D rectangles with rounded corners.
- TRoundCube to implement a 3D cube shape with rounded corners that can be placed on a 3D FireMonkey form
- TCube to implement a 3D cube shape that can be placed on a 3D FireMonkey form.
- TStrokeCube to implement a stroked 3D cube shape that can be placed on a 3D FireMonkey form.
- TPlane to implement a 2D plane that can be placed on a 3D FireMonkey form
- TText to define 2D text object.
- TText3D to represent a 3D rendered text.
- TTextLayer3D to implements a 3D layer that can be used to display 3D text on a 3D FireMonkey form.
- TPath to define 2D path-type shapes representing groups of connected curves and lines.
- TPathAnimation to move a visual object on a specified path.
- TFloatAnimation attached to a 3D object in order to animate it.
- TLightMaterialSource to link a TLightMaterial to a 3D object. The link is made through the MaterialSource property of the 3D object.
- TLight to imitate the rays of light and their propagation on other 3D objects.
When you run the application, you see several animated 3D objects. The animations do the following:
- FloatAnimation1 is attached to Sphere2. It has the PropertyName set to
Opacity, which means that the animation customizes the transparency of the sphere. Moreover, the Loop property of the animation is set to
True, which means that the animation is repeatedly executed.
- FloatAnimation2 is attached to StrokeCube1. It has the folloing properties: AutoReverse, Interpolation and PropertyName set to
RotationAngle.Y, respectively. This configuration of the animation makes the cube rotate around the Y axis from the StopValue to the StartValue and then, from the StartValue to the StopValue.
- FloatAnimation3 is attached to RoundCube1. It has the PropertyName property set to
Position.Z, which means that the animation moves the cube through the Z axis. Moreover, the Interpolation property determines the path and the rate at which the StartValue of the animation is changed to the StopValue over time. As it is set to
Elasticthe animation follows a progressive sinusoidal geometric interpolation.
- FloatAnimation4 is attached to Text3D1. As in FloatAnimation2, this animation has the AutoReverse and Interpolation properties set to
Backrespectively. Moreover the PropertyName property is set to
RotationAngle.X. Therefore, this configuration of the animation makes the cube rotate around the X axis from the StopValue to the StartValue and then, from the StartValue to the StopValue.
- FloatAnimation5 is attached to Sphere1. It has the PropertyName property set to
Scale.Xand the Trigger and TriggerInverse properties set to
IsMouseOver=false, respectively. This means that the sphere scales throught the X axis when the mouse is on the sphere. The inverse of the animation starts when the mouse leaves the sphere.
- PathAni is attached to RoundCube1. It makes the round cube follow the path determined by the Path1 object.
- FireMonkey 3D
- Tutorial: Creating a FireMonkey 3D Application
- Using FireMonkey Animation Effects