MorphWeightSpline

new Cesium.MorphWeightSpline(options)

一个样条曲线,在线性插值的基础上处理用于形态目标的权重值数组。
Name Type Description
options object 具有以下属性的对象:
Name Type Description
times Array.<number> 一个严格递增的、无单位的浮点数数组,表示每个点的时间。 这些值与时钟时间没有任何关联。它们是曲线的参数化。
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 : 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 Forum.