imit_model / AnyLogic / UsersManual(AnyLogic)
.pdf
AnyLogic V User’s Manual
12.1.2.2 Animating structures not matching the model hierarchy
Although in the majority of cases the animation structure naturally reproduces the model structure, sometimes they do not match. This means that sometimes you compose an animation of shapes corresponding to active objects lying in different levels of model hierarchy. There are two ways to do so:
•If those active objects have their own animations defined, and you wish to display them at some animation several objects up the model hierarchy, then you define animations for all intermediate active objects, which just contain necessary encapsulated animations and no other shapes.
•In case you just wish to define animation for one (e.g. root) active object, you can draw all shapes on its animation diagram, and then associate them with the data of encapsulated active objects. Obviously, you should make sure those data are accessible.
12.1.3Interactive control of animation
In AnyLogic 2D animation can be made interactive by adding various types of controls to the animation diagram: buttons, edit boxes, check boxes, radio buttons, sliders, etc.
12.2 Animation diagram
Each active object class may have an animation diagram associated with it. An animation diagram is a collection of shapes. An animation diagram links shape properties to active object data and encapsulated objects, and also defines where the animation of this active object appears in the animation of a container, if the latter exists.
12.2.1Animation editor
An animation diagram is edited in the animation editor using the animation toolbar, see Figure 145.
© 1992-2004 XJ Technologies http://www.xjtek.com |
287 |
AnyLogic V User’s Manual
►To open the existing animation diagram of an active object class
1.Double-click the animation in the Project window, or
Right-click the animation in the Project window and choose Open Animation from the popup menu.
Animation editor shares a set of generic editing operations described in section 1.5.2, “Diagram editors. Generic operations”.
An animation diagram is always associated with an active object class and has the following properties:
Properties
Name – animation name.
X – [optional] dynamic expression of the x-coordinate of the animation on the container animation (pixels).
Y – [optional] dynamic expression of the y-coordinate of the animation on the container animation (pixels).
Rotation – [optional] dynamic expression of the rotation of the animation on the container animation (radians).
Scale – [optional] if defined, the positions and sizes of all shapes on this diagram are multiplied by this factor.
X Offset – [optional] if defined, the x-coordinates of all shapes on this diagram are increased by this value.
Y Offset – [optional] if defined, the y-coordinates of all shapes on this diagram are increased by this value.
Exclude from build – if set, the animation is excluded from the model.
Prevent frame selection – if set, the animation frame becomes non-selectable. This may be useful if your animation contains, e.g., a rectangle covering the entire animation and you want to select such a rectangle. The point is that in this case, the rectangle and the animation frame coincide. So, if this property is not set, you cannot know for sure what you select: the rectangle or the animation frame.
Flip Y-axis – changes the Y-axis direction.
© 1992-2004 XJ Technologies http://www.xjtek.com |
289 |
AnyLogic V User’s Manual
3.Click the Browse button.
The Open dialog box is displayed.
4.Browse for the image file you want to use.
Double-click the file or click the Open button to select the file.
5.Select Stretch|Tile|Center option to choose the manner the background image is displayed.
12.2.1.2 Generic properties of animation shapes
All shapes of an animation diagram have the following common properties that are displayed on the General page of the Properties window:
Properties
Name – name of the shape, which may be used to access it from code.
X – static value|[optional] dynamic expression of the x-coordinate (pixels).
Y – static value|[optional] dynamic expression of the y-coordinate (pixels).
Rotation – static value (degrees)|[optional] dynamic expression of the rotation angle (radians).
Width – static value|[optional] dynamic expression of the width (pixels).
Height – static value|[optional] dynamic expression of the height (pixels).
Fill color – static value|[optional] dynamic expression of the fill color (java.awt.Color). If the checkbox is not checked, the static color is transparent. If the expression evaluates to null, the dynamic color is transparent.
Line color – static value|[optional] dynamic expression of the line color (java.awt.Color). If the checkbox is not checked, the static color is transparent. If the expression evaluates to null, the dynamic color is transparent.
Line width – static value|[optional] dynamic expression of the line width (pixels).
Visible – [optional] dynamic boolean expression determining if the shape is visible.
Replication – replication factor of the shape.
© 1992-2004 XJ Technologies http://www.xjtek.com |
291 |
AnyLogic V User’s Manual
Properties
Radius – static value|[optional] dynamic expression of the corner radius of the rectangle (pixels).
12.2.2.3Line
►To draw a line
1.Click the Line
toolbar button, or
Choose Draw|Animation|Line from the main menu.
2.Drag the line on the diagram.
Properties
The following properties are set individually for line’s Begin point and End point.
X – static value|[optional] dynamic expression of the x-coordinate of the point (pixels).
Y – static value|[optional] dynamic expression of the y-coordinate of the point (pixels).
Style – point style. If Arrow is set, the arrow is drawn.
Size – the arrow size.
12.2.2.4Polyline
►To draw a polyline
1.Click the Polyline
toolbar button, or
Choose Draw|Animation|Polyline from the main menu.
2.Click at each polyline point on the diagram.
3.Double-click to finish.
© 1992-2004 XJ Technologies http://www.xjtek.com |
293 |
AnyLogic V User’s Manual
2.Click the Edit Points
toolbar button, or Choose Draw|Edit Points from the main menu, or
Right-click the polyline and choose Edit Points from the popup menu.
3.Right-click the point and choose Delete Point from the popup menu, or Drag the point to an adjacent point of the polyline.
The dragged point disappears.
12.2.2.5Oval
►To draw an oval
1.Click the Oval
toolbar button, or
Choose Draw|Animation|Oval from the main menu.
2.Click or drag the oval on the diagram.
Properties
Radius 1 – static value|[optional] dynamic expression of the first (horizontal) oval radius (pixels).
Radius 2 – static value|[optional] dynamic expression of the second (vertical) oval radius (pixels).
12.2.2.6Image
►To draw an image
1.Click the Image
toolbar button, or
Choose Draw|Animation|Image from the main menu.
2.Click or drag a rectangle area on the diagram.
Properties
Image index expression – [optional] dynamic expression defining the index of the image in the list to be displayed (integer, zero-based). If left blank, 0 is assumed.
© 1992-2004 XJ Technologies http://www.xjtek.com |
295 |

toolbar button, or Choose
toolbar button, or
toolbar button, or
toolbar button, or Choose
toolbar button, or Choose