DayZ 1.24
Loading...
Searching...
No Matches
AnimatorTimer Class Reference
Collaboration diagram for AnimatorTimer:
[legend]

Private Member Functions

void Animate (float val, float speed=1.0)
 Starts animate value until value reaches target value.
 
void AnimateLoop (float speed=1.0)
 Starts infinite animation loop <-1,1>. Based on sinus transition.
 
float GetValue ()
 Returns actual animated value.
 
float GetTargetValue ()
 Returns target value. While AnimateLoop returns angle of cycle in radians.
 
void SetValue (float val)
 Sets both value and target value.
 
bool IsRunning ()
 
void Tick (float timeslice)
 Ticks the timer, is called by timer subsystem.
 

Private Attributes

bool m_active = false
 
bool m_loop = false
 
float m_target_value = 0
 
float m_value = 0
 
float m_time = 0
 

Detailed Description

Definition at line 704 of file tools.c.

Member Function Documentation

◆ Animate()

void AnimatorTimer::Animate ( float val,
float speed = 1.0 )
inlineprivate

Starts animate value until value reaches target value.

Parameters
valfloat target value
speedfloat speed of animating, units per second

Definition at line 717 of file tools.c.

718 {
720 m_loop = false;
721 m_time = speed;
722 m_active = true;
723 }
bool m_loop
Definition tools.c:707
bool m_active
Definition tools.c:706
float m_time
Definition tools.c:710
float m_target_value
Definition tools.c:708

References m_active, m_loop, m_target_value, and m_time.

◆ AnimateLoop()

void AnimatorTimer::AnimateLoop ( float speed = 1.0)
inlineprivate

Starts infinite animation loop <-1,1>. Based on sinus transition.

Parameters
speedfloat speed of animating , cycles per second (1.0 means one 360 degree sinus cycle per second: 0..1..0..-1..0)

Definition at line 729 of file tools.c.

730 {
731 m_value = 0;
732 m_target_value = 0;
733 m_loop = true;
734 m_time = speed;
735 m_active = true;
736 }
float m_value
Definition tools.c:709

References m_active, m_loop, m_target_value, m_time, and m_value.

◆ GetTargetValue()

float AnimatorTimer::GetTargetValue ( )
inlineprivate

Returns target value. While AnimateLoop returns angle of cycle in radians.

Definition at line 749 of file tools.c.

750 {
751 return m_target_value;
752 }

References m_target_value.

◆ GetValue()

float AnimatorTimer::GetValue ( )
inlineprivate

Returns actual animated value.

Definition at line 741 of file tools.c.

742 {
743 return m_value;
744 }

References m_value.

◆ IsRunning()

bool AnimatorTimer::IsRunning ( )
inlineprivate

Definition at line 763 of file tools.c.

764 {
765 return m_active;
766 }

References m_active.

◆ SetValue()

void AnimatorTimer::SetValue ( float val)
inlineprivate

Sets both value and target value.

Definition at line 757 of file tools.c.

758 {
759 m_value = val;
761 }

References m_target_value, and m_value.

◆ Tick()

void AnimatorTimer::Tick ( float timeslice)
inlineprivate

Ticks the timer, is called by timer subsystem.

Definition at line 770 of file tools.c.

771 {
772 if (!m_active) return;
773
774 if (m_loop)
775 {
778
780 }
781 else
782 {
784 float step = m_time * timeslice;
785
786 if (diff < step)
787 {
789 m_active = false;
790 }
791 else
792 {
794 m_value += step;
795 else
796 m_value -= step;
797 }
798 }
799 }
Definition EnMath.c:7
static const float PI2
Definition EnMath.c:13
static proto float Sin(float angle)
Returns sinus of angle in radians.
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat(), m_active, m_loop, m_target_value, m_time, m_value, Math::PI2, and Math::Sin().

Member Data Documentation

◆ m_active

bool AnimatorTimer::m_active = false
private

Definition at line 706 of file tools.c.

Referenced by Animate(), AnimateLoop(), IsRunning(), and Tick().

◆ m_loop

bool AnimatorTimer::m_loop = false
private

Definition at line 707 of file tools.c.

Referenced by Animate(), AnimateLoop(), and Tick().

◆ m_target_value

float AnimatorTimer::m_target_value = 0
private

Definition at line 708 of file tools.c.

Referenced by Animate(), AnimateLoop(), GetTargetValue(), SetValue(), and Tick().

◆ m_time

float AnimatorTimer::m_time = 0
private

Definition at line 710 of file tools.c.

Referenced by Animate(), AnimateLoop(), and Tick().

◆ m_value

float AnimatorTimer::m_value = 0
private

Definition at line 709 of file tools.c.

Referenced by AnimateLoop(), GetValue(), SetValue(), and Tick().


The documentation for this class was generated from the following file: