8 [
Attribute(
"1", UIWidgets.Auto,
"Speed, revolutions per second. Positive values mean clockwise rotation.")]
11 protected Widget m_wRoot;
17 override void HandlerAttached(Widget w)
24 if (TextWidget.Cast(w))
25 m_Anim =
new SCR_SpinningWidgetAnimation<TextWidget>(w);
26 else if (ImageWidget.Cast(w))
27 m_Anim =
new SCR_SpinningWidgetAnimation<ImageWidget>(w);
32 ScriptCallQueue queue =
GetGame().GetCallqueue();
33 queue.CallLater(OnEachFrame, 0,
true);
37 override void HandlerDeattached(Widget w)
42 ScriptCallQueue queue =
GetGame().GetCallqueue();
43 queue.Remove(OnEachFrame);
47 protected void OnEachFrame()
52 float tDelta = ftime / 1000.0;
53 m_Anim.Animate(tDelta, m_fSpeedRps);
61 void Animate(
float tDelta,
float speedRps);
72 void SCR_SpinningWidgetAnimation(Widget w)
74 m_wTarget = TWidget.Cast(w);
78 override void Animate(
float tDelta,
float speedRps)
80 float angle = m_wTarget.GetRotation();
81 angle += tDelta*speedRps*360.0;
86 m_wTarget.SetRotation(angle);