Main Content

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

example

h = Aero.Animation constructs an animation object. The animation object is returned to h.

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

expand all

Aero.Body objects specified in a cell array.

Attributes:

GetAccess
public
SetAccess
public

Camera contained by animation object, specified as an Aero.Camera handle object.

Attributes:

GetAccess
public
SetAccess
public

Figure object, specified as a MATLAB® array.

Attributes:

GetAccess
public
SetAccess
public

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

Animation rate, specified as a scalar.

Attributes:

GetAccess
public
SetAccess
public

Animation object name, specified as a character vector or string scalar.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

Current time, specified as a scalar.

Attributes:

GetAccess
public
SetAccess
public

Data Types: double

End time, specified as a scalar.

Attributes:

GetAccess
public
SetAccess
public

Data Types: double

Start time, specified as a scalar.

Attributes:

GetAccess
public
SetAccess
public

Data Types: double

Scaling time, specified as a scalar.

Attributes:

GetAccess
public
SetAccess
public

Data Types: double

Video recording compression file type, specified as one of these values. For more information on video compression, see VideoWriter.

ValueDescription

'Archival'

Motion JPEG 2000 file with lossless compression.

'Motion JPEG AVI'

Compressed AVI file using Motion JPEG codec.

'Motion JPEG 2000'

Compressed Motion JPEG 2000 file.

'MPEG-4'

Compressed MPEG-4 file with H.264 encoding (Windows® 7 systems only).

'Uncompressed AVI'

Uncompressed AVI file with RGB24 video.

Attributes:

GetAccess
public
SetAccess
public

Video recording file name, specified as a character vector or a string.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

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

Option to enable video recording, specified as one of these values.

ValueAction

'on'

Enable video recording.

'off'

Disable video recording.

'scheduled'

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

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

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

expand all

Examples

collapse all

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

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);

{"String":"","Tex":[],"LaTex":[]}

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';

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';

Version History

Introduced in R2007a