mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-03 01:12:42 +08:00
5410a48a58
Co-authored-by: bofeng.song <bofeng.song@chukong-inc.com> Co-authored-by: dumganhar <dumganhar@gmail.com> Co-authored-by: mmyduckx <308303735@qq.com> Co-authored-by: Patrice Jiang <397136899@qq.com> Co-authored-by: 江战 <40414978+PatriceJiang@users.noreply.github.com>
15 lines
382 B
C++
15 lines
382 B
C++
#include "cocos/core/geometry/Curve.h"
|
|
#include <vector>
|
|
namespace cc {
|
|
namespace geometry {
|
|
|
|
float OptimizedKey::evaluate(float tt) {
|
|
const t = tt - time;
|
|
return evalOptCurve(t, coefficient);
|
|
}
|
|
|
|
float evalOptCurve(float t, const std::vector<float> &coefs) {
|
|
return (t * (t * (t * coefs[0] + coefs[1]) + coefs[2])) + coefs[3];
|
|
}
|
|
} // namespace geometry
|
|
} // namespace cc
|