Skip to content

SVG Animations

SVG Animation is inSCADA’s core visualization component. Each animation consists of an SVG file and creates real-time SCADA screens by binding to variable values.

Energy Monitoring Dashboard

Menu: Development → Animations → Animation Dev

FieldRequiredDescription
NameYesScreen name (unique within the project)
SVG ContentYesSVG source code
DurationYesAnimation update period (ms, min: 100)
Play OrderYesSort order (when there are multiple screens)
MainYesIs this the main screen
ColorNoBackground color
DescriptionNoDescription

Each animation consists of three components:

Animation
├── SVG Content (visual structure of the screen)
├── Animation Elements (variable bindings)
│ ├── Element 1: "temp_text" → Temperature_C (text binding)
│ ├── Element 2: "motor_rect" → MotorStatus (color binding)
│ └── Element 3: "valve_group" → ValvePosition (rotation binding)
└── Animation Scripts (screen open/close scripts)
├── Pre-Animation Code (when screen opens)
└── Post-Animation Code (when screen closes)

An Animation Element binds a DOM element within the SVG to a variable. Depending on the binding type, the element’s text, color, position, visibility, and other properties are updated according to the variable’s value.

FieldDescription
SVG Element IDThe id attribute of the target element in the SVG
VariableVariable to bind to
TypeBinding type (see table below)
ExpressionCustom transformation formula (optional)
TypeDescriptionExample
TextUpdates the element’s text contentTemperature: 25.4°C
ColorChanges the element’s fill/colorAlarm: red/green
VisibilityShow/hide the elementShow arrow icon if motor is running
RotationRotate the elementValve position: 0°-90°
TranslationMove the element (X/Y)Level indicator: 0-100%
ScaleScale the elementBar chart height
OpacitySet transparencyShow faded when communication is lost
ClassAdd/remove CSS classStatus-based style change

A custom JavaScript expression can be assigned to an element:

// Color binding: select color based on value
if (value > 80) return '#ff0000'; // red
else if (value > 60) return '#ff8800'; // orange
else return '#00cc00'; // green
// Text binding: add unit and format
return value.toFixed(1) + ' °C';
// Visibility: multiple conditions
var power = ins.getVariableValue("ActivePower_kW").value;
var status = ins.getVariableValue("GridStatus").value;
return power > 100 && status;

Pre/post scripts can be assigned to each animation:

ScriptExecution TimeUsage
Pre-Animation CodeWhen screen opens (initial load)Initial values, data fetching
Post-Animation CodeWhen screen closesCleanup, resource release
// Pre-Animation: Fetch last 1 hour of power data and feed to chart
var endMs = ins.now().getTime();
var startMs = endMs - (60 * 60 * 1000);
var logs = ins.getLoggedVariableValuesByPage(
['ActivePower_kW'],
ins.getDate(startMs), ins.getDate(endMs), 0, 30
);
// Update chart in SVG...

Assign meaningful id values to SVG elements — Animation Elements reference these:

<text id="temp_display">--</text>
<rect id="motor_indicator" fill="#cccccc"/>
<g id="valve_group" transform="rotate(0)">
<path d="..."/>
</g>

The animation’s alignment property determines how the screen behaves at different resolutions.

When an animation is opened, a WebSocket connection is established. The platform pushes variable values to the client at the interval specified in the duration parameter, and bindings are automatically updated. No page refresh is required.

Placeholders can be defined for animations. The same SVG design can be reused with different parameters (different device, different variable set).

Example: Design a “Motor Detail” screen, define {motor_name} as a placeholder. Open the same screen with different parameters for different motors.