我有以下一段代码
int steps = 10;
for (int i = 0; i <= steps; i++) {
float t = i / float(steps);
console.log( "t " + t );
}
这将数字置于这样的线性方式 { 0, 0.1, 0.2, ..., 0.9, 1.0 } 我想应用三次(输入或输出)缓动方程,以便输出数字逐渐增加或减少
更新
不确定我的实现是否正确,但我得到了预期的曲线
float b = 0;
float c = 1;
float d = 1;
for (int i = 0; i <= steps; i++) {
float t = i / float(steps);
t /= d;
float e = c * t * t * t + b;
console.log( "e " + e );
//console.log( "t " + t );
}