1 #include "animation.qh"
5 METHOD(Animation, configureAnimation, void(entity this, entity obj, void(entity, float) objSetter, float animStartTime, float animDuration, float animStartValue, float animEndValue))
7 this.setObjectSetter(this, obj, objSetter);
8 this.setTimeStartDuration(this, animStartTime, animDuration);
9 this.setValueStartEnd(this, animStartValue, animEndValue);
12 METHOD(Animation, update, void(entity this, float animDuration, float animStartValue, float animEndValue))
14 this.setTimeStartDuration(this, time, animDuration);
15 this.setValueStartEnd(this, animStartValue, animEndValue);
18 METHOD(Animation, setTimeStartEnd, void(entity this, float s, float e))
21 this.duration = e - s;
24 METHOD(Animation, setTimeStartDuration, void(entity this, float s, float d))
30 METHOD(Animation, setValueStartEnd, void(entity this, float s, float e))
36 METHOD(Animation, setValueStartDelta, void(entity this, float s, float d))
42 METHOD(Animation, setObjectSetter, void(entity this, entity o, void(entity, float) s))
48 METHOD(Animation, tick, void(entity this, float tickTime))
50 if (this.isStopped(this) || this.isFinished(this) || (tickTime < this.startTime)) { return; }
52 if (tickTime >= (this.startTime + this.duration)) { this.finishAnim(this); } else { this.value = this.calcValue(this, (tickTime - this.startTime), this.duration, this.startValue, this.delta); }
54 this.setter(this.object, this.value);
57 METHOD(Animation, calcValue, float(entity this, float tickTime, float animDuration, float animStartValue, float animDelta))
59 return animStartValue;
62 METHOD(Animation, isStopped, bool(entity this))
67 METHOD(Animation, stopAnim, void(entity this))
72 METHOD(Animation, resumeAnim, void(entity this))
77 METHOD(Animation, isFinished, bool(entity this))
82 METHOD(Animation, finishAnim, void(entity this))
84 this.value = this.delta + this.startValue;
86 this.setter(this.object, this.value);