Use setValue<rlottie::Property::TrRotation> return float type.
The value is degree. [0 ~ 360]
Example) example/demo
Demo4(app, filePath);
Demo5(app, filePath);
Demo6(app, filePath);
+ Demo7(app, filePath);
}
void Demo1(EvasApp *app, std::string &filePath) {
/* Fill Color */
view6->loop(true);
view6->setRepeatMode(LottieView::RepeatMode::Reverse);
}
+
+ void Demo7(EvasApp *app, std::string &filePath) {
+ /* Transform rotation */
+ view7.reset(new LottieView(app->evas()));
+ view7->setFilePath(filePath.c_str());
+ if (view7->player()) {
+ view7->player()->setValue<rlottie::Property::TrRotation>("Shape Layer 2.Shape 1",
+ [](const rlottie::FrameInfo& info) {
+ return info.curFrame() * 20;
+ });
+ }
+ view7->setPos(1800, 0);
+ view7->setSize(300, 300);
+ view7->show();
+ view7->play();
+ view7->loop(true);
+ view7->setRepeatMode(LottieView::RepeatMode::Reverse);
+ }
private:
std::unique_ptr<LottieView> view1;
std::unique_ptr<LottieView> view2;
std::unique_ptr<LottieView> view4;
std::unique_ptr<LottieView> view5;
std::unique_ptr<LottieView> view6;
+ std::unique_ptr<LottieView> view7;
};
static void
int
main(void)
{
- EvasApp *app = new EvasApp(1800, 300);
+ EvasApp *app = new EvasApp(2100, 300);
app->setup();
std::string filePath = DEMO_DIR;
animation->mAnimation->setValue<rlottie::Property::TrScale>(keypath, rlottie::Size((float)w, (float)h));
break;
}
+ case LOTTIE_ANIMATION_PROPERTY_TR_ROTATION: {
+ double r = va_arg(prop, double);
+ animation->mAnimation->setValue<rlottie::Property::TrRotation>(keypath, (float)r);
+ break;
+ }
case LOTTIE_ANIMATION_PROPERTY_TR_ANCHOR:
- case LOTTIE_ANIMATION_PROPERTY_TR_ROTATION:
case LOTTIE_ANIMATION_PROPERTY_TR_OPACITY:
//@TODO handle propery update.
break;
if (mModel.filter().hasFilter(rlottie::Property::TrScale)){
auto sz = mModel.scale(frameNo);
m.scale(sz.width() / 100.0, sz.height() / 100.0);
+ newFlag |= DirtyFlagBit::Matrix;
+ }
+ if (mModel.filter().hasFilter(rlottie::Property::TrRotation)){
+ float r = mModel.rotate(frameNo);
+ m.rotate(r);
+ newFlag |= DirtyFlagBit::Matrix;
}
if (mModel.filter().hasFilter(rlottie::Property::TrPosition)){
auto ps = mModel.position(frameNo);
m.translate(ps.x(), ps.y());
+ newFlag |= DirtyFlagBit::Matrix;
}
if (!(flag & DirtyFlagBit::Matrix) && !mModel.transform()->isStatic() &&
return VSize(_modelData->mTransform->matrix(frame).m_11() * 100.0,
_modelData->mTransform->matrix(frame).m_22() * 100.0);
}
+ float rotate(int frame) const
+ {
+ if (mFilter.hasFilter(rlottie::Property::TrRotation)) {
+ return mFilter.value(rlottie::Property::TrRotation, frame);
+ }
+ return atan2(_modelData->mTransform->matrix(frame).m_21(), _modelData->mTransform->matrix(frame).m_11());
+ }
private:
LOTGroupData *_modelData;
LOTFilter mFilter;