ui/base/math_helper.h¶
Mathematical utility functions for UI animations and transitions. More...
Namespaces¶
| Name |
|---|
| cf |
| cf::ui |
| cf::ui::math Mathematical utilities for UI animations and transitions. |
Detailed Description¶
Mathematical utility functions for UI animations and transitions.
Author: Charliechen114514 (chengh1922@mails.jlu.edu.cn)
Version: 0.1
Since: 0.1
Date: 2026-02-23
Provides interpolation, clamping, remapping, cubic Bezier curves, spring physics simulation, and angle interpolation functions for UI components.
Source code¶
#pragma once
#include <utility>
namespace cf::ui {
namespace math {
float lerp(float a, float b, float t);
float clamp(float value, float min, float max);
float remap(float value, float inMin, float inMax, float outMin, float outMax);
float cubicBezier(float x1, float y1, float x2, float y2, float t);
std::pair<float, float> springStep(float position, float velocity, float target, float stiffness,
float damping, float dt);
float lerpAngle(float a, float b, float t);
} // namespace math
} // namespace cf::ui
Updated on 2026-03-09 at 10:14:01 +0000