DayZ 1.24
Loading...
Searching...
No Matches
HoverEffect.c
Go to the documentation of this file.
1// -----------------------------------------------------------
3{
6 protected float m_orginal_width;
7 protected float m_orginal_height;
8 protected Widget m_root;
10
12 {
13 m_anim = new AnimatorTimer();
14 }
15
16 // -----------------------------------------------------------
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();
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};
Icon x
Icon y
override bool OnMouseEnter(Widget w, int x, int y)
Definition HoverEffect.c:34
reference float speed
Definition HoverEffect.c:4
ref AnimatorTimer m_anim
Definition HoverEffect.c:9
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition HoverEffect.c:43
void OnWidgetScriptInit(Widget w)
Definition HoverEffect.c:17
Widget m_root
Definition HoverEffect.c:8
reference float amount
Definition HoverEffect.c:5
float m_orginal_width
Definition HoverEffect.c:6
float m_orginal_height
Definition HoverEffect.c:7
void Update()
Definition HoverEffect.c:24
void HoverEffect()
Definition HoverEffect.c:11
map: item x vector(index, width, height)
Definition EnWidgets.c:651
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Definition proto.c:332