WIP, can animate any property on any object Can run back and forth in [0..1] interval and interpolate any property between StartValue and EndValue.
More...
|
Action< object > | Convert< T > (Action< T > myActionT) |
|
void | Start () |
| Resumes animation in the same direction.
|
|
void | Stop () |
|
void | Forward () |
| Set Direction to Straight and Start.
|
|
void | Back () |
| Set Direction to Reverse and Start.
|
|
void | SetToStart () |
| Set Lambda to 0.
|
|
void | SetToEnd () |
| Set Lambda to 1.
|
|
void | ApplyValue () |
|
void | Step (double time) |
|
void | LogStatus () |
|
|
bool | Debug [get, set] |
|
object | Target [get, set] |
| Object containing animated property.
|
|
bool | Active [get, set] |
|
double | Duration [get, set] |
| In seconds.
|
|
double | ReverseDuration [get, set] |
|
bool | Blocked [get, set] |
| Will prevent it from starting.
|
|
double | Lambda [get, set] |
| Progress of animation [0..1].
|
|
double | Speed = 0.01 [get, set] |
| Lambda increase per update step, calculated when you set Duration.
|
|
double? | BackSpeed [get, set] |
|
bool | Bounce [get, set] |
| If true animation won't stop when reaching end, it will change direction.
|
|
bool | Repeat [get, set] |
|
CUIDirection | Direction [get, set] |
| Straight, Reverse.
|
|
object | StartValue [get, set] |
| Value will be interpolated between these values.
|
|
object | EndValue [get, set] |
|
string | Property [get, set] |
| Property name that is animated.
|
|
Func< float, object > | Interpolate [get, set] |
| You can set custon Interpolate function.
|
|
WIP, can animate any property on any object Can run back and forth in [0..1] interval and interpolate any property between StartValue and EndValue.
Definition at line 18 of file CUIAnimation.cs.
◆ ApplyValue()
void CrabUI.CUIAnimation.ApplyValue |
( |
| ) |
|
Definition at line 245 of file CUIAnimation.cs.
246 {
247 if (interpolate == null) return;
248 object value = interpolate.Invoke((
float)
Lambda);
249 setter?.Invoke(value);
250 }
double Lambda
Progress of animation [0..1].
◆ Back()
void CrabUI.CUIAnimation.Back |
( |
| ) |
|
Set Direction to Reverse and Start.
Definition at line 210 of file CUIAnimation.cs.
211 {
213 Active = true;
214 }
CUIDirection Direction
Straight, Reverse.
◆ Convert< T >()
Action< object > CrabUI.CUIAnimation.Convert< T > |
( |
Action< T > | myActionT | ) |
|
Definition at line 153 of file CUIAnimation.cs.
154 {
155 if (myActionT == null) return null;
156 else return new Action<object>(o => myActionT((T)o));
157 }
◆ Forward()
void CrabUI.CUIAnimation.Forward |
( |
| ) |
|
Set Direction to Straight and Start.
Definition at line 202 of file CUIAnimation.cs.
203 {
205 Active = true;
206 }
◆ Step()
void CrabUI.CUIAnimation.Step |
( |
double | time | ) |
|
Definition at line 252 of file CUIAnimation.cs.
253 {
254 UpdateState();
255 ApplyValue();
257 if (Debug) LogStatus();
258 }
double Speed
Lambda increase per update step, calculated when you set Duration.
◆ Stop()
void CrabUI.CUIAnimation.Stop |
( |
| ) |
|
◆ ActiveAnimations
HashSet<CUIAnimation> CrabUI.CUIAnimation.ActiveAnimations = new() |
|
static |
◆ EndLambda
float CrabUI.CUIAnimation.EndLambda = 1.0f |
|
static |
◆ StartLambda
float CrabUI.CUIAnimation.StartLambda = 0.0f |
|
static |
◆ Active
bool CrabUI.CUIAnimation.Active |
|
getset |
Definition at line 56 of file CUIAnimation.cs.
57 {
58 get => active;
59 set
60 {
61 if (
Blocked || active == value)
return;
62 active = value;
63
64 if (active) ActiveAnimations.Add(this);
65 else ActiveAnimations.Remove(this);
66 ApplyValue();
67 }
68 }
bool Blocked
Will prevent it from starting.
◆ BackSpeed
double? CrabUI.CUIAnimation.BackSpeed |
|
getset |
◆ Blocked
bool CrabUI.CUIAnimation.Blocked |
|
getset |
◆ Bounce
bool CrabUI.CUIAnimation.Bounce |
|
getset |
If true animation won't stop when reaching end, it will change direction.
Definition at line 109 of file CUIAnimation.cs.
◆ Debug
bool CrabUI.CUIAnimation.Debug |
|
getset |
◆ Direction
CUIDirection CrabUI.CUIAnimation.Direction |
|
getset |
◆ Duration
double CrabUI.CUIAnimation.Duration |
|
getset |
In seconds.
Definition at line 73 of file CUIAnimation.cs.
74 {
75 get => 1.0 /
Speed * Timing.Step;
76 set
77 {
78 double steps = value / Timing.Step;
80 }
81 }
◆ EndValue
object CrabUI.CUIAnimation.EndValue |
|
getset |
◆ Interpolate
Func<float, object> CrabUI.CUIAnimation.Interpolate |
|
getset |
You can set custon Interpolate function.
Definition at line 141 of file CUIAnimation.cs.
142 {
143 get => interpolate;
144 set
145 {
146 customInterpolate = value;
147 UpdateSetter();
148 }
149 }
◆ Lambda
double CrabUI.CUIAnimation.Lambda |
|
getset |
◆ Property
string CrabUI.CUIAnimation.Property |
|
getset |
Property name that is animated.
Definition at line 127 of file CUIAnimation.cs.
128 {
129 get => property;
130 set
131 {
132 property = value;
133 UpdateSetter();
134 }
135 }
◆ Repeat
bool CrabUI.CUIAnimation.Repeat |
|
getset |
◆ ReverseDuration
double CrabUI.CUIAnimation.ReverseDuration |
|
getset |
Definition at line 83 of file CUIAnimation.cs.
84 {
85 get => 1.0 / (BackSpeed ?? 0) * Timing.Step;
86 set
87 {
88 double steps = value / Timing.Step;
89 BackSpeed = 1.0 / steps;
90 }
91 }
◆ Speed
double CrabUI.CUIAnimation.Speed = 0.01 |
|
getset |
Lambda increase per update step, calculated when you set Duration.
Definition at line 104 of file CUIAnimation.cs.
◆ StartValue
object CrabUI.CUIAnimation.StartValue |
|
getset |
Value will be interpolated between these values.
Definition at line 118 of file CUIAnimation.cs.
◆ Target
object CrabUI.CUIAnimation.Target |
|
getset |
Object containing animated property.
Definition at line 46 of file CUIAnimation.cs.
47 {
48 get => target;
49 set
50 {
51 target = value;
52 UpdateSetter();
53 }
54 }
◆ OnStop
Action<CUIDirection> CrabUI.CUIAnimation.OnStop |
The documentation for this class was generated from the following file: