menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class AnimationHelper - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class AnimationHelper

    Utility class comes handy when you need to perform simple animations in your control.

    Inheritance
    System.Object
    AnimationHelper
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Drawing
    Assembly: Syncfusion.Shared.Base.dll
    Syntax
    public class AnimationHelper
    Remarks

    The StartAnimation(Int32, Boolean, Int32) method in this class allows you to specify the number of animation positions (0 to N), the direction of animation (whether animation is from 0 towards N or from N towards 0), and the speed (X) at which animation is performed.

    When the StartAnimation(Int32, Boolean, Int32) method is called, the current animation position is set (AnimationPosition property) which gets reduced (or incremented based on the direction of animation) every X time interval specified in the StartAnimation(Int32, Boolean, Int32) method call, until it reaches the other extreme of the Animation position range. Every time the AnimationPosition value changes, an AnimationPositionChanged event is thrown. Upon reaching the last animation position, an AnimationDone event is thrown.

    Constructors

    AnimationHelper()

    Creates an instance of the AnimationHelper class.

    Declaration
    public AnimationHelper()

    Properties

    AnimationDirectionExpand

    Indicates in which direction animation is performed.

    Declaration
    public bool AnimationDirectionExpand { get; }
    Property Value
    Type Description
    System.Boolean

    True indicates animation is towards MaxAnimationPosition; False indicates animation is towards zero.

    AnimationOn

    Indicates whether Animation is on.

    Declaration
    public bool AnimationOn { get; }
    Property Value
    Type Description
    System.Boolean

    True indicates Animation is on; False otherwise.

    AnimationPosition

    Returns the current animation position once animation is started.

    Declaration
    public int AnimationPosition { get; }
    Property Value
    Type Description
    System.Int32

    An integer value some where in between (including) 0 and MaxAnimationPosition.

    MaxAnimationPosition

    Returns the maximum animation position specified in the StartAnimation(Int32, Boolean, Int32) method.

    Declaration
    public int MaxAnimationPosition { get; }
    Property Value
    Type Description
    System.Int32

    An integer value indicating the maximum animation position.

    Methods

    AnimateNext()

    Triggers AnimationPositionChanged to force drawing next animation position.

    Declaration
    public virtual void AnimateNext()
    Remarks

    You can optionally use this method to force animation not waiting for the timer to break.

    NeedAnimation()

    Indicates whether more animation positions are to be drawn to complete this animation.

    Declaration
    protected bool NeedAnimation()
    Returns
    Type Description
    System.Boolean

    True indicates there is more to come; False otherwise.

    StartAnimation(Int32, Boolean, Int32)

    Defines the animation range: 0 to maxPosition; specifies the direction of animation: 0 to maxPositon or maxPosition to 0; specifies the interval at which animation should be performed: interval, and starts animation.

    Declaration
    public void StartAnimation(int maxPosition, bool directionExpand, int interval)
    Parameters
    Type Name Description
    System.Int32 maxPosition

    The integer value indicating the max position of animation.

    System.Boolean directionExpand

    The direction of animation.

    System.Int32 interval

    The frequency at which animation is performed.

    Remarks

    This class uses a System.Windows.Forms.Timer to trigger the AnimationPositionChanged event, which means events will be thrown within the same thread as this method call.

    StopAnimation()

    Allows you to stop animation abruptly (if it is currently on). This will then throw the AnimationDone event.

    Declaration
    public void StopAnimation()

    Events

    AnimationDone

    This will be called when animation is complete or when StopAnimation() is called.

    Declaration
    public event EventHandler AnimationDone
    Event Type
    Type
    System.EventHandler

    AnimationPositionChanged

    Will be thrown as the AnimationPosition property changes during animation.

    Declaration
    public event EventHandler AnimationPositionChanged
    Event Type
    Type
    System.EventHandler
    Remarks

    After calling StartAnimation(Int32, Boolean, Int32), you should listen to this event to repaint your control for each new animation position.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved