Need to perform animation in Diagram nodes
Perform animation in Diagram nodes:
In Syncfusion Diagram the animation can be achieved by customizing the node.
The below code shows how to create animation in diagram nodes:
[C#]
public float VolumeLevel
{
get { return m_fVolumeLevel; }
set
{
if (m_fVolumeLevel != value && OnPropertyChanging(this.FullContainerName, "VolumeLevel", value))
{
RecordPropertyChanged("VolumeLevel");
if (value > 80)
value = 20;
if (value < 20)
value = 80;
// Set new value
m_fVolumeLevel = value;
// Raise property changed event to render the node
OnPropertyChanged(this.FullContainerName, "VolumeLevel");
}
}
}
[VB]
Public Property VolumeLevel() As Single
Get
Return m_fVolumeLevel
End Get
Set(ByVal value As Single)
If m_fVolumeLevel <> value AndAlso OnPropertyChanging(Me.FullContainerName, "VolumeLevel", value) Then
RecordPropertyChanged("VolumeLevel")
If value > 80 Then
value = 20
End If
If value < 20 Then
value = 80
End If
' Set new value
m_fVolumeLevel = value
' Raise property changed event
OnPropertyChanged(Me.FullContainerName, "VolumeLevel")
End If
End Set
End Property
TimerInterval
This property is used to create alerts. Each time it triggers based on an interval period.
[C#]
// Initializing alert timer
alertTimer = new System.Windows.Forms.Timer();
// Initializing interval period value of alert timer
alertTimer.Interval = 2500;
public int TimerInterval
{
get { return alertTimer.Interval; }
set
{
if (alertTimer.Interval != value)
{
alertTimer.Interval = value;
}
}
}
[VB]
' Initializing alert timer
alertTimer = New System.Windows.Forms.Timer()
' Initializing interval period value of alert timer
alertTimer.Interval = 2500
Public Property TimerInterval() As Integer
Get
Return alertTimer.Interval
End Get
Set(ByVal value As Integer)
If alertTimer.Interval <> value Then
alertTimer.Interval = value
End If
End Set
End Property
EnableTimer
This property can be used to implement a simple interval timer, which sets off an alarm every interval period. If the interval is set after the timer has started, the count will be reset to 0.
[C#]
alertTimer.Enabled = true; public bool EnableTimer { get { return alertTimer.Enabled; } set { if (alertTimer.Enabled != value) alertTimer.Enabled = value; } }
[VB]
alertTimer.Enabled = True Public Property EnableTimer() As Boolean Get Return alertTimer.Enabled End Get Set(ByVal value As Boolean) If alertTimer.Enabled <> value Then alertTimer.Enabled = value End If End Set End Property
alertTimer_Tick() Event :
This event can be used to change the value of "VolumeLevel". The event triggering is based on the value of the interval period provided by the user.
[C# ]
// Registering Event
alertTimer.Tick += new EventHandler(alertTimer_Tick);
void alertTimer_Tick(object sender, EventArgs e)
{
// Change the value of VolumeLevel each time the event is called
this.VolumeLevel = VolumeLevel - 5;
}
[VB]
' Registering Event AddHandler alertTimer.Tick, AddressOf alertTimer_Tick Private Sub alertTimer_Tick(ByVal sender As Object, ByVal e As EventArgs) Me.VolumeLevel = VolumeLevel - 5 End Sub
Conclusion
I hope you enjoyed learning about how to perform animation in Diagram nodes.
You can refer to WinForms Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!