#include "font/ui_font.h"
#include "gfx_utils/graphic_log.h"
#include "themes/theme_manager.h"
+#include "cmath"
namespace OHOS {
class LabelAnimator : public Animator, public AnimatorCallback {
uint32_t time = HALTick::GetInstance().GetElapseTime(startTime_);
float x0 = startPos_;
float x1 = 1.0 * labelWidth_ - textWidth_;
-#if 0
+#if 1
float factor = 1000; // 1000: slow down the speed
float v = speed_ / factor;
v = x1 - x0 > 0 ? v : -v;
float t = time;
float t1 = (x1 - x0) / v;
float period = 2.0 * t1; // 2: double
- t = t - float(t / period) * period;
+ t = t - floorf(t / period) * period;
float x = 0;
if (t < t1) {
x = v * t + x0;