This type of animation requires at least two SVG images,
of identical size and shape. The animation is caused by alternately
displaying one image and then the next. You can apply this animation
to a Picture widget or Label.
A recent HTML5 compliant browser, for example: FireFox, Chrome,
Opera, IE (v.10 or later) and Safari.
The svgBatik module (svgBatik.jar) must be in the Modules folder.
The following example uses the Picture widget and two arrow images, in one the arrow points up, in the
other it points down.
- In the station, create a new EnumWritable point to use
as the data source for the animation.
- Set the range values for the Facets as follows:
- Right-click the component and select to
open a new Px view.
- Select to switch
to Edit mode.
- Open the bajaui palette, expand the Widgets folder and drag the Picture widget to the Px Editor canvas.
- Double-click the widget to open the Edit Properties window and click the Add Binding button (in
the upper right corner), to add a value binding to the widget.
- In the Value Binding section of the Properties window, click on the ord property of the binding and click the selection
icon (
) to access the Component Chooser.
- In the Component Chooser, locate and select the out value of the EnumWritable data
source created in step one, for example: station:|slot:/Drivers/Points/EnumWritable/out/value, and click OK.
- Open the kitPxN4svg palette, expand Piping folder and drag the DirectionArrowDown and DirectionArrowUp
image files to the Px Editor canvas.
Note: The kitPxN4svg and Piping folders are automatically generated under the station’s Files
folder.
- Double click on the Picture widget, Properties window opens.
- In the Properties window, click
the selection icon to access the File Chooser.
- In the File Chooser, locate the added DirectionArrowUp
image file (for example,file:^px/kitPxN4svg/Piping/Direction_Arrows/DirectionArrow_Up.svg)
- In the Picture widget section of the Properties window, right-click the image property and click Animate.
- In the Animate window, select
the first facet of the EnumWritable and click Set and use the File Chooser to locate and select the first image file
(for example, file:^px/kitPxN4svg/Piping/Direction_Arrows/DirectionArrow_Up.svg) to be displayed for facet value 0 and click OK.
- Select the second facet of the EnumWritable and click Set and use the File Chooser to locate and select the
second image file (for example,file:^px/kitPxN4svg/Piping/Direction_Arrows/DirectionArrow_Down.svg) to be displayed for facet value 1 and click OK.
- Click Save to save these changes
to your Px View.
The graphic image changes automatically when you set the
Actions. The image displayed depends on whether the EnumWritable
Action is set to
Up or
Down. For example, in View mode, right-click the displayed arrow image
and select and change to
Down:

Additionally, providing an input to the EnumWritable using a control
component, such as
MultiVibrator in the
kitControl palette, causes the animation to occur automatically.
For example, drag a MultiVibrator component onto the wire sheet view
for the EnumWritable and set the MultiVibrator
Period property to
5 seconds (so that the
out value changes from
true to
false every five seconds). In the wire sheet view, connect the MultiVibrator
out value to the EnumWritable
In :

Switch to the Px Editor View mode to observe the animation.