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, setObjectSetter, void(entity this, entity o, void(entity, float) s))
42 METHOD(Animation, tick, void(entity this, float tickTime))
44 if (this.isStopped(this) || this.isFinished(this) || (tickTime < this.startTime)) return;
46 if (tickTime >= (this.startTime + this.duration)) this.finishAnim(this);
47 else this.value = this.calcValue(this, (tickTime - this.startTime), this.duration, this.startValue, this.delta);
49 this.setter(this.object, this.value);
52 METHOD(Animation, calcValue, float(entity this, float tickTime, float animDuration, float animStartValue, float animDelta))
54 return animStartValue;
57 METHOD(Animation, isStopped, bool(entity this))
62 METHOD(Animation, stopAnim, void(entity this))
67 METHOD(Animation, resumeAnim, void(entity this))
72 METHOD(Animation, isFinished, bool(entity this))
77 METHOD(Animation, finishAnim, void(entity this))
79 this.value = this.delta + this.startValue;
81 this.setter(this.object, this.value);