Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
hovereffect.c
Go to the documentation of this file.
1 // -----------------------------------------------------------
3 {
4  reference float speed;
5  reference float amount;
6  protected float m_orginal_width;
7  protected float m_orginal_height;
8  protected Widget m_root;
9  protected ref AnimatorTimer m_anim;
10 
11  void HoverEffect()
12  {
13  m_anim = new AnimatorTimer();
14  }
15 
16  // -----------------------------------------------------------
17  void OnWidgetScriptInit(Widget w)
18  {
19  m_root = w;
20  m_root.SetHandler(this);
21  }
22 
23  // -----------------------------------------------------------
24  protected void Update()
25  {
26  float p = amount * m_anim.GetValue();
27  m_root.SetSize(m_orginal_width + (m_orginal_width * p), m_orginal_height + (m_orginal_height * p));
28 
29  float c = 1.0 - (0.5 * m_anim.GetValue());
30  m_root.SetColor(ARGBF(1, 1, c, c));
31  }
32 
33  // -----------------------------------------------------------
34  override bool OnMouseEnter(Widget w, int x, int y)
35  {
36  if ( !m_anim.IsRunning() ) m_root.GetSize(m_orginal_width, m_orginal_height);
37  m_anim.Animate(1.0, speed);
38 
39  return false;
40  }
41 
42  // -----------------------------------------------------------
43  override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
44  {
45  m_anim.Animate(0.0, speed);
46  return false;
47  }
48 
49 };
y
Icon y
HoverEffect
Definition: hovereffect.c:2
ARGBF
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Definition: proto.c:332
x
Icon x
Widget
Definition: enwidgets.c:189
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition: enwidgets.c:650
AnimatorTimer
Definition: tools.c:748