This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
gwen-dotnet/Gwen/Anim/Size/Width.cs

39 lines
974 B
C#
Raw Permalink Normal View History

using System;
namespace Gwen.Anim.Size
{
class Width : TimedAnimation
{
private int m_StartSize;
private int m_Delta;
private bool m_Hide;
public Width(int startSize, int endSize, float length, bool hide = false, float delay = 0.0f, float ease = 1.0f)
: base(length, delay, ease)
{
m_StartSize = startSize;
m_Delta = endSize - m_StartSize;
m_Hide = hide;
}
protected override void OnStart()
{
base.OnStart();
m_Control.Width = m_StartSize;
}
protected override void Run(float delta)
{
base.Run(delta);
m_Control.Width = (int)Math.Round(m_StartSize + (m_Delta * delta));
}
protected override void OnFinish()
{
base.OnFinish();
m_Control.Width = m_StartSize + m_Delta;
m_Control.IsHidden = m_Hide;
}
}
}