Table of Contents

Class EdgeFlowAnimationManager

Namespace
FlowGraph.Avalonia.Animation
Assembly
FlowGraph.Avalonia.dll

Manages automatic edge flow animations based on EdgeStyle settings.

public class EdgeFlowAnimationManager : IDisposable
Inheritance
EdgeFlowAnimationManager
Implements
Inherited Members

Examples

// Edges with AnimatedFlow style are automatically animated:
edge.Definition = edge.Definition with {
    Style = EdgeStyle.ActiveFlow  // Has AnimatedFlow = true
};

// Or create a custom animated style:
edge.Definition = edge.Definition with {
    Style = new EdgeStyle {
        AnimatedFlow = true,
        FlowSpeed = 2.0,
        FlowDirection = EdgeFlowDirection.Reverse,
        StrokeColor = "#00FF00"
    }
};

Remarks

This manager monitors edges in the graph and automatically starts/stops flow animations based on the AnimatedFlow property.

Animation parameters are taken from the EdgeStyle: - FlowSpeed: Controls animation speed (1.0 = normal, 2.0 = double) - FlowDirection: Forward, Reverse, or Bidirectional - DashPattern: Used if set, otherwise defaults to marching ants

Constructors

EdgeFlowAnimationManager(AnimationManager, Action<Edge, double>)

Creates a new EdgeFlowAnimationManager.

public EdgeFlowAnimationManager(AnimationManager animationManager, Action<Edge, double> updateDashOffset)

Parameters

animationManager AnimationManager

The animation manager to use for running animations.

updateDashOffset Action<Edge, double>

Callback to update edge dash offset during animation.

Properties

ActiveAnimationCount

Gets the number of currently active flow animations.

public int ActiveAnimationCount { get; }

Property Value

int

BaseFlowSpeed

Base speed multiplier for flow animations (pixels per second at FlowSpeed = 1.0).

public double BaseFlowSpeed { get; set; }

Property Value

double

Methods

Dispose()

Releases all resources.

public void Dispose()

IsAnimating(string)

Checks if a specific edge has an active flow animation.

public bool IsAnimating(string edgeId)

Parameters

edgeId string

The ID of the edge to check.

Returns

bool

True if the edge has an active flow animation.

StartAnimation(Edge)

Starts a flow animation for a specific edge.

public void StartAnimation(Edge edge)

Parameters

edge Edge

The edge to animate.

StopAllAnimations()

Stops all flow animations.

public void StopAllAnimations()

StopAnimation(string)

Stops a flow animation for a specific edge.

public void StopAnimation(string edgeId)

Parameters

edgeId string

The ID of the edge to stop animating.

SyncAnimations(IEnumerable<Edge>)

Synchronizes flow animations with the current graph state. Starts animations for edges with AnimatedFlow=true, stops others.

public void SyncAnimations(IEnumerable<Edge> edges)

Parameters

edges IEnumerable<Edge>

All edges in the graph.