Aero.Animation Class
Namespace: Aero
Visualize aerospace animation
Description
Aero.Animation
objects visualize flight data without any other tool or
toolbox. You only need an Aerospace Toolbox license.
The Aero.Animation
class is a handle
class.
Creation
Description
constructs an animation
object. The animation object is returned to h
= Aero.Animationh
.
Note
The Aero.Animation
constructor does not retain the properties
of previously created animation objects, even those that you have saved to a MAT-file.
This means that subsequent calls to the animation object constructor always create
animation objects with default properties."
Properties
Bodies
— Aero.Body
objects
0 x 0 cell array (default) | cell array
Camera
— Camera contained by animation object
[ ]
(default) | scalar Aero.Camera
Camera contained by animation object, specified as an Aero.Camera
handle object.
Attributes:
GetAccess | public |
SetAccess | public |
Figure
— Figure object
[ ]
(default) | scalar Figure
object
Figure
object, specified as a MATLAB® array.
Attributes:
GetAccess | public |
SetAccess | public |
FigureCustomizationFcn
— Figure customization function
[ ]
(default) | Function handle
Figure customization function, specified as a function handle. The function handle
operates on the Figure
handle stored by the Figure
property.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: double
FramesPerSecond
— Animation rate
12
(default) | scalar
Animation rate, specified as a scalar.
Attributes:
GetAccess | public |
SetAccess | public |
Name
— Animation object name
''
(default) | character vector | string scalar
Animation object name, specified as a character vector or string scalar.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: char
| string
TCurrent
— Current time
0
(default) | scalar
Current time, specified as a scalar.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: double
TFinal
— End time
NaN (default) | scalar
End time, specified as a scalar.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: double
TStart
— Start time
NaN (default) | scalar
Start time, specified as a scalar.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: double
TimeScaling
— Scaling time
1
(default) | scalar
Scaling time, specified as a scalar.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: double
VideoCompression
— Video recording compression file type
'Archival'
(default) | 'Motion JPEG AVI'
| 'Motion JPEG 2000'
| 'MPEG-4'
| 'Uncompressed AVI'
Video recording compression file type, specified as one of these values. For more
information on video compression, see VideoWriter
.
Value | Description |
---|---|
| Motion JPEG 2000 file with lossless compression. |
| Compressed AVI file using Motion JPEG codec. |
| Compressed Motion JPEG 2000 file. |
| Compressed MPEG-4 file with H.264 encoding (Windows® 7 systems only). |
| Uncompressed AVI file with RGB24 video. |
Attributes:
GetAccess | public |
SetAccess | public |
VideoFileName
— Video recording file name
'temp'
(default) | character vector | string scalar
Video recording file name, specified as a character vector or a string.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: char
| string
VideoQuality
— Video recording quality
75
(default) | scalar value between 0
and 100
Video recording quality, specified as a scalar value between 0
and 100
. For more information on video quality, see the
Quality
property in VideoWriter
.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: double
VideoRecord
— Option to enable video recording
'off'
(default) | 'on'
| 'scheduled'
Option to enable video recording, specified as one of these values.
Value | Action |
---|---|
| Enable video recording. |
| Disable video recording. |
| Schedule video recording. Use this setting with the VideoTStart and VideoTFinal properties. |
If you are capturing frames of a plot that take a long time to generate or are repeatedly capturing frames in a loop, check your settings to make sure that your computer screen saver does not activate and that your monitor does not turn off for the duration of the capture. If either of these actions occurs, one or more of the captured frames might contain graphics from your screen saver or be blank.
Note
In situations where MATLAB software is running on a virtual desktop that is not currently visible on your monitor, it might capture a region on your monitor that corresponds to the position occupied by the figure or axes on the hidden desktop. Check that the window to be captured is on the currently active desktop.
Attributes:
GetAccess | public |
SetAccess | public |
VideoTFinal
— Video recording stop time for scheduled recording
NaN, which uses the value of TFinal
(default) | scalar value between TStart
and
TFinal
Video recording stop time for scheduled recording, specified as a scalar value
between TStart
and TFinal
.
Attributes:
GetAccess | public |
SetAccess | public |
Dependencies
Use when VideoRecord
is set to 'scheduled'
.
Use VideoTStart
to set the start time of the recording.
Data Types: double
VideoTStart
— Video recording start time for scheduled recording
NaN, which uses the value of TStart
(default) | scalar value between TStart
and
TFinal
Video recording start time for scheduled recording, specified as a scalar value
between TStart
and TFinal
.
Attributes:
GetAccess | public |
SetAccess | public |
Dependencies
Use this property when VideoRecord
is set to
'scheduled'
. Use VideoTFinal
to set the stop
time of the recording.
Data Types: double
Methods
Public Methods
addBody | Add body to animation object |
createBody | Create body and its associated patches in animation |
delete | Destroy animation object |
hide | Hide animation figure |
initIfNeeded | Initialize animation graphics if needed |
initialize | Create animation object figure and axes and build patches for bodies |
moveBody | Move body in animation object |
play | Animate Aero.Animation object given position/angle time
series |
removeBody | Remove one body from animation |
show | Show animation object figure |
updateBodies | Update bodies of animation object |
updateCamera | Update camera in animation object |
wait | Wait until animation stops playing |
Examples
Create Aero.Animation
Object
h=Aero.Animation
h = Animation with properties: Name: '' Figure: [] FigureCustomizationFcn: [] Bodies: {} Camera: [] TCurrent: 0 VideoRecord: 'off' VideoFileName: 'temp' VideoCompression: 'Motion JPEG AVI' VideoQuality: 75 VideoTStart: NaN VideoTFinal: NaN TimeScaling: 1 FramesPerSecond: 12 TStart: NaN TFinal: NaN
Record Animation Object Simulation
Simulate and record flight data. Use the data to create an animation object.
h = Aero.Animation;
Control the frame display rate.
h.FramesPerSecond = 10;
Set the time-scaling property TimeScaling
on the animation object to specify the data per second.
h.TimeScaling = 5;
The combination of the FramesPerSecond
and TimeScaling
properties determines the time step of the simulation. These settings result in a time step of approximately 0.5 s.
Create and load a body for the animation object.
idx1 = createBody(h,'pa24-250_orange.ac','Ac3d');
Load simulated flight trajectory data, simdata
.
load simdata;
Set the time series data for the body.
h.Bodies{1}.TimeSeriesSource = simdata;
Create a figure object for the animation object.
show(h);
Set up recording properties.
h.VideoRecord = 'on'; h.VideoQuality = 50; h.VideoCompression = 'Motion JPEG AVI'
h = Animation with properties: Name: '' Figure: [1×1 Figure] FigureCustomizationFcn: [] Bodies: {[1×1 Aero.Body]} Camera: [1×1 Aero.Camera] TCurrent: 0 VideoRecord: 'on' VideoFileName: 'temp' VideoCompression: 'Motion JPEG AVI' VideoQuality: 50 VideoTStart: NaN VideoTFinal: NaN TimeScaling: 5 FramesPerSecond: 10 TStart: NaN TFinal: NaN
h.VideoFilename = 'astMotion_JPEG';
Play the animation.
play(h);
Verify that a file named astMotion_JPEG.avi
was created in the current folder.
Wait
Wait for the animation to stop playing before the modifying the object.
wait(h);
Disable recording to preserve the file.
h.VideoRecord = 'off';
Record Animation for Four Seconds
Simulate flight data for four seconds.
Use the data to create an animation object.
h = Aero.Animation;
Control the frame display rate.
h.FramesPerSecond = 10;
Configure the animation object to set the seconds of animation data per second time-scaling (TimeScaling
) property.
h.TimeScaling = 5;
The combination of the FramesPerSecond
and TimeScaling
properties determines the time step of the simulation (TimeScaling
/|FramesPerSecond|). These settings result in a time step of approximately 0.5 s.
Create and load a body for the animation object.
idx1 = createBody(h,'pa24-250_orange.ac','Ac3d');
Load simulated flight trajectory data (simdata
).
load simdata;
Set the time series data for the body.
h.Bodies{1}.TimeSeriesSource = simdata;
Create a figure object for the animation object.
show(h);
Set up recording properties.
h.VideoRecord='on'; h.VideoQuality = 50; h.VideoCompression = 'Motion JPEG AVI'; h.VideoFilename = 'astMotion_JPEG';
Play the animation from TStart
to TFinal
.
h.TSTart = 1; h.TFinal = 5; play(h);
Verify that a file named astMotion_JPEG.avi
was created in the current folder. When you rerun the recording, notice that the play time is shorter than that in the previous example when you record for the length of the simulation time.
Wait
Wait for the animation to stop playing before the modifying the object.
wait(h);
Disable recording to preserve the file.
h.VideoRecord = 'off';
Play Aero.Animation Object
Animate the body, idx1
, for the duration of the time series data.
Set Up
h = Aero.Animation; h.FramesPerSecond = 10; h.TimeScaling = 5; idx1 = h.createBody('pa24-250_orange.ac','Ac3d'); load simdata; h.Bodies{1}.TimeSeriesSource = simdata;
Show and Play the Animation
h.show(); h.play();
Version History
Introduced in R2007a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)