MorphWeightSpline

new Cesium.MorphWeightSpline(options)

一种在 morph target 所使用的权重值数组上进行线性插值的样条曲线。
Name Type Description
options object Object with the following properties:
Name Type Description
times Array.<number> 在每个点处的一组严格递增、无单位、浮点型的时间值。 这些值与时钟时间没有任何关联。它们是曲线的参数化。
weights Array.<number> 给定的浮点型控制权重数组。这些权重的排列方式是: 所有目标对应的权重按时间顺序以及它们在 morph target 来源 glTF 中出现的顺序排列。例如对于 2 个目标,weights = [w(0,0), w(0,1), w(1,0), w(1,1) ...] 其中 w(i,j) 中的 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 : time 必须位于范围 [t0, tn] 内,其中 t0 是数组 times 的第一个元素,tn 是数组 times 的最后一个元素。

findTimeInterval(time)number

times 中查找一个索引 i,使得参数 time 落在区间 [times[i], times[i + 1]] 内。
Name Type Description
time number 时间。
Returns:
区间起始处元素的索引。
Throws:
  • DeveloperError : time 必须位于范围 [t0, tn] 内,其中 t0 是数组 times 的第一个元素,tn 是数组 times 的最后一个元素。
将给定时间环绕到样条曲线所覆盖的时间段内。
Name Type Description
time number 时间。
Returns:
已环绕到更新后动画的时间。
需要帮助?获取答案的最快方式是在 Cesium 论坛 上向社区和团队提问。