MorphWeightSpline

new Cesium.MorphWeightSpline(options)

在变形目标使用的权重值数组上线性插值的样条曲线。
Name Type Description
options object 对象,具有以下属性:
Name Type Description
times Array.<number> 每个点的严格递增、无单位的浮点时间数组。 这些值与 clock time 没有任何关系。它们是曲线的参数化。
weights Array.<number> 给定的浮点控制权重数组。权重的排序方式是这样的 目标的所有权重都按时间顺序和它们出现的顺序给出 变形目标来自的 glTF。这意味着对于 2 个目标, weights = [w(0,0), w(0,1), w(1,0), w(1,1) ...] 其中 i 和 j 在 w(i,j) 分别是时间索引和目标索引。
Throws:
Example:
const times = [ 0.0, 1.5, 3.0, 4.5, 6.0 ];
const weights = [0.0, 1.0, 0.25, 0.75, 0.5, 0.5, 0.75, 0.25, 1.0, 0.0]; //Two targets
const spline = new Cesium.WeightSpline({
    times : times,
    weights : weights
});

const p0 = spline.evaluate(times[0]);
See:

Methods

clampTime(time)number

将给定时间限制为样条所覆盖的时间段。
Name Type Description
time number 时间。
Returns:
时间,固定到动画周期。

evaluate(time, result)Array.<number>

在给定时间计算曲线。
Name Type Description
time number 评估曲线的时间。
result Array.<number> optional 要在其上存储结果的对象。
Returns:
修改后的结果参数 或给定时间曲线上点的新实例。
Throws:
  • DeveloperError : 时间必须在 [t0, tn] 范围内,其中 t0 是数组中的第一个元素 timestn 是最后一个元素 在数组times

findTimeInterval(time)number

times中查找索引 i,使得参数 times在区间 [times[i], times[i + 1]] 中。
Name Type Description
time number 时间。
Returns:
区间开始时元素的索引。
Throws:
  • DeveloperError : 时间必须在 [t0, tn] 范围内,其中 t0 是数组中的第一个元素 timestn 是最后一个元素 在数组times
将给定时间环绕到样条所覆盖的时间段。
Name Type Description
time number 时间。
Returns:
时间,环绕到更新的动画。
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.