diff --git a/doomsday/libdeng2/include/de/widgets/animation.h b/doomsday/libdeng2/include/de/widgets/animation.h index b62115226c..d18f76b30a 100644 --- a/doomsday/libdeng2/include/de/widgets/animation.h +++ b/doomsday/libdeng2/include/de/widgets/animation.h @@ -51,7 +51,9 @@ class DENG2_PUBLIC Animation : public ISerializable DENG2_ERROR(ClockMissingError); public: - Animation(float value = 0, Style style = EaseIn); + Animation(float value = 0, Style style = EaseIn); + Animation(Animation const &other); + Animation &operator = (Animation const &other); void setStyle(Style s); @@ -159,6 +161,8 @@ class DENG2_PUBLIC Animation : public ISerializable static Time currentTime(); + static Animation range(Style style, float from, float to, TimeDelta span, TimeDelta delay = 0); + private: DENG2_PRIVATE(d) diff --git a/doomsday/libdeng2/src/widgets/animation.cpp b/doomsday/libdeng2/src/widgets/animation.cpp index b302151f97..274eb06ed4 100644 --- a/doomsday/libdeng2/src/widgets/animation.cpp +++ b/doomsday/libdeng2/src/widgets/animation.cpp @@ -148,6 +148,15 @@ DENG2_PIMPL_NOREF(Animation) Animation::Animation(float val, Style s) : d(new Instance(val, s)) {} +Animation::Animation(Animation const &other) : d(new Instance(*other.d)) +{} + +Animation &Animation::operator = (Animation const &other) +{ + d.reset(new Instance(*other.d)); + return *this; +} + void Animation::setStyle(Animation::Style s) { d->style = s; @@ -310,4 +319,11 @@ Time Animation::currentTime() return _clock->time(); } +Animation Animation::range(Style style, float from, float to, TimeDelta span, TimeDelta delay) +{ + Animation anim(from, style); + anim.setValue(to, span, delay); + return anim; +} + } // namespace de