yangyin
2025-01-13 36616eb44dc36a4e6e3e7a7540310cb850218ea9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#region Imports
 
using DPumpHydr.WinFrmUI.RLT.Enum.Poison;
using System.Drawing;
using System.Windows.Forms;
 
#endregion
 
namespace DPumpHydr.WinFrmUI.RLT.Animate.Poison
{
    #region ExpandAnimationAnimate
 
    public sealed class ExpandAnimation : Animate
    {
        public void Start(Control control, Size targetSize, TransitionType transitionType, int duration)
        {
            Start(control, transitionType, duration,
                delegate
                {
                    int width = DoExpandAnimation(control.Width, targetSize.Width);
                    int height = DoExpandAnimation(control.Height, targetSize.Height);
 
                    control.Size = new(width, height);
                },
                delegate
                {
                    return control.Size.Equals(targetSize);
                });
        }
 
        private int DoExpandAnimation(int startSize, int targetSize)
        {
            float t = (float)counter - startTime;
            float b = startSize;
            float c = (float)targetSize - startSize;
            float d = (float)targetTime - startTime;
 
            return MakeTransition(t, b, d, c);
        }
    }
 
    #endregion
}