--- /dev/null
+#include "animate.h"
+#include "demo.h"
+
+using namespace std;
+using namespace Msp;
+
+Animate::Animate():
+ target(0),
+ anim(0),
+ player(0)
+{ }
+
+Animate::Animate(GL::Placeable &t, const GL::Animation &a, GL::AnimationPlayer &p):
+ target(&t),
+ anim(&a),
+ player(&p)
+{ }
+
+void Animate::validate() const
+{
+ if(!target)
+ throw logic_error("null target");
+ if(!anim)
+ throw logic_error("null animation");
+ if(!player)
+ throw logic_error("null player");
+}
+
+void Animate::start(float, float d)
+{
+ float speed = (d ? (anim->get_duration()/Time::sec)/d : 1.0f);
+ player->play(*target, *anim, speed);
+}
+
+
+Animate::Loader::Loader(Animate &a, Demo &d):
+ DataFile::DerivedObjectLoader<Animate, Action::Loader>(a, d)
+{
+ a.player = &demo.get_animation_player();
+ add("animation", &Loader::animation);
+ add("target", &Loader::target);
+}
+
+void Animate::Loader::animation(const string &n)
+{
+ obj.anim = &demo.get_resources().get<GL::Animation>(n);
+}
+
+void Animate::Loader::target(const string &n)
+{
+ obj.target = &demo.get_thing<GL::Placeable>(n);
+}