xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
animation.cc
浏览该文件的文档.
1#include <gtest/gtest.h>
2
3#include <memory>
8
9TEST(TestAnimation, Test1) {
10 using namespace xcal::animation;
11 using namespace xcal::property;
12
13 auto timeline = std::make_unique<Timeline>();
14 auto property = std::make_unique<Scalar>(0);
15 auto animation =
16 std::make_unique<ScalerInterpolation>(property.get(), 0.0f, 100.0f);
17 timeline->add(animation.get(), 0, 1);
18 auto driver = std::make_unique<TimelineDriver>(timeline.get());
19 driver->set_frame_rate(60)->ready_to_play();
20 while (!driver->finished()) {
21 std::cout << "------------- start new frame -----------------"
22 << std::endl;
23 driver->next();
24 if (property->is_changed()) {
25 std::cout << "property value: " << property->value() << std::endl;
26 property->reset_changed();
27 }
28 std::cout << "------------- end new frame -----------------"
29 << std::endl;
30 }
31}
TEST(TestAnimation, Test1)
Definition animation.cc:9