Displays - Add Animations (Tutorial) teaches you to:
- Draw vector graphics
- Create path animations
- Animate properties
- Build interactive animations
Prerequisites:
In this page:
Table of Contents maxLevel 2 minLevel 2 indent 10px exclude Steps style none
Vector Drawing Basics
- Open Displays → Draw
- Use drawing tools:
Basic Shapes:
- Rectangle: Tank outline
- Ellipse: Pump body
- Line: Piping
- Polygon: Custom shapes
- Path: Complex curves
Combine Shapes:
- Select multiple
- Right-click → Combine
- Union, Subtract, Intersect
Create Animated Bargraph
Build tank with level animation:
- Draw rectangle (tank)
- Add inner rectangle (liquid)
- Liquid properties:
- Fill: Blue gradient
- Height: Bind to expression
csharp
@Tag.Tank_Level * TankHeight / 100
- Clip to tank bounds
Rotation Animation
Create rotating equipment:
Pump Impeller:
- Draw impeller shape
- Add rotation dynamic:
- Center: Object center
- Angle expression:
csharp
@Tag.Pump_Running ? @Tag.AnimationAngle : 0
- In Scripts, increment angle:
csharp
@Tag.AnimationAngle = (@Tag.AnimationAngle + 5) % 360;
Color Animations
Dynamic color changes:
State-based Color:
csharp
// Pipe color by material
Fill = @Tag.Material == "Water" ? "Blue" :
@Tag.Material == "Oil" ? "Brown" :
@Tag.Material == "Gas" ? "LightGray" : "White"
Gradient Animation:
- Create gradient fill
- Animate gradient stops
- Bind to temperature/pressure
Visibility Animations
Show/hide elements:
Blinking Alarm:
csharp
Visibility = @Tag.Alarm && @Tag.BlinkState ?
Visibility.Visible : Visibility.Hidden
Toggle blink state every 500ms
Progressive Disclosure:
- Show details on hover
- Hide when normal
- Smooth fade transition
Transform Animations
Scale Animation:
csharp
// Pulse effect for alarms
ScaleX = @Tag.Alarm ? 1.0 + (Math.Sin(@Tag.PulseAngle) * 0.1) : 1.0
ScaleY = ScaleX
Translation:
- Move objects based on position
- Slider controls
- Drag and drop
Complex Equipment
Build multi-part animation:
Conveyor Belt:
- Belt graphic with pattern
- Product objects
- Animations:
- Belt pattern scrolling
- Products moving
- Speed variable
- Start/stop control
Centrifuge:
- Outer casing (static)
- Inner drum (rotating)
- Material flow (path animation)
- Speed indicator
Interactive Animations
Add user interaction:
Click Actions:
csharp
void OnValveClick()
{
if (@Tag.Mode == "Manual")
{
@Tag.Valve_Position = @Tag.Valve_Position > 50 ? 0 : 100;
}
}
Drag to Adjust:
- Implement slider behavior
- Update tag while dragging
- Show value tooltip
Performance Tips
Optimize Animations:
- Limit simultaneous animations
- Use appropriate frame rates
- Disable when not visible
- Simplify complex paths
- Cache static elements
Best Practices:
- Smooth transitions (ease-in/out)
- Consistent animation speeds
- Meaningful animations only
- Test on target hardware
- Provide animation on/off option
Advanced Techniques
Particle Effects:
csharp
// Bubbles in tank
for(int i = 0; i < 10; i++)
{
CreateBubble(
RandomX(),
TankBottom,
RandomSize(),
RandomSpeed()
);
}
3D-like Effects:
- Perspective transforms
- Shadows and lighting
- Depth ordering
Next Steps
- [Working with Symbols] - Reusable animations
- [Create Dashboards] - Animated KPIs
- [Vector Graphics Drawing] - Advanced drawing
In this section...
Page Tree | ||||
---|---|---|---|---|
|