Skip to content

KBE3D / KBCore / Cesium / MorphWeightSpline

类: MorphWeightSpline

A spline that linearly interpolates over an array of weight values used by morph targets.

示例

ts
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]);

参数

Object with the following properties:

参数

An array of strictly increasing, unit-less, floating-point times at each point. The values are in no way connected to the clock time. They are the parameterization for the curve.

参数

The array of floating-point control weights given. The weights are ordered such that all weights for the targets are given in chronological order and order in which they appear in the glTF from which the morph targets come. This means for 2 targets, weights = [w(0,0), w(0,1), w(1,0), w(1,1) ...] where i and j in w(i,j) are the time indices and target indices, respectively.

方法

findTimeInterval()

findTimeInterval(time: number): number

Finds an index <code>i</code> in <code>times</code> such that the parameter <code>time</code> is in the interval <code>[times[i], times[i + 1]]</code>.

参数

time

number

The time.

返回

number

The index for the element at the start of the interval.


wrapTime()

wrapTime(time: number): number

Wraps the given time to the period covered by the spline.

参数

time

number

The time.

返回

number

The time, wrapped around to the updated animation.


clampTime()

clampTime(time: number): number

Clamps the given time to the period covered by the spline.

参数

time

number

The time.

返回

number

The time, clamped to the animation period.


evaluate()

evaluate(time: number, result?: number[]): number[]

Evaluates the curve at a given time.

参数

time

number

The time at which to evaluate the curve.

result?

number[]

The object onto which to store the result.

返回

number[]

The modified result parameter or a new instance of the point on the curve at the given time.

构造函数

构造函数

new MorphWeightSpline(options: { times: number[]; weights: number[]; }): MorphWeightSpline

参数

options
times

number[]

weights

number[]

返回

MorphWeightSpline

KBE3D @3.0.0 Copyright © 2024-present KBE3D