本文整理汇总了TypeScript中babylonjs/Animations/animation.Animation._interpolate方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Animation._interpolate方法的具体用法?TypeScript Animation._interpolate怎么用?TypeScript Animation._interpolate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类babylonjs/Animations/animation.Animation
的用法示例。
在下文中一共展示了Animation._interpolate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _CreateBakedAnimation
/**
* Create a baked animation
* @param babylonTransformNode BabylonJS mesh
* @param animation BabylonJS animation corresponding to the BabylonJS mesh
* @param animationChannelTargetPath animation target channel
* @param minFrame minimum animation frame
* @param maxFrame maximum animation frame
* @param fps frames per second of the animation
* @param inputs input key frames of the animation
* @param outputs output key frame data of the animation
* @param convertToRightHandedSystem converts the values to right-handed
* @param useQuaternion specifies if quaternions should be used
*/
private static _CreateBakedAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, minFrame: number, maxFrame: number, fps: number, sampleRate: number, inputs: number[], outputs: number[][], minMaxFrames: { min: number, max: number }, convertToRightHandedSystem: boolean, useQuaternion: boolean) {
let value: number | Vector3 | Quaternion;
let quaternionCache: Quaternion = Quaternion.Identity();
let previousTime: Nullable<number> = null;
let time: number;
let maxUsedFrame: Nullable<number> = null;
let currKeyFrame: Nullable<IAnimationKey> = null;
let nextKeyFrame: Nullable<IAnimationKey> = null;
let prevKeyFrame: Nullable<IAnimationKey> = null;
let endFrame: Nullable<number> = null;
minMaxFrames.min = Tools.FloatRound(minFrame / fps);
let keyFrames = animation.getKeys();
for (let i = 0, length = keyFrames.length; i < length; ++i) {
endFrame = null;
currKeyFrame = keyFrames[i];
if (i + 1 < length) {
nextKeyFrame = keyFrames[i + 1];
if (currKeyFrame.value.equals(nextKeyFrame.value)) {
if (i === 0) { // set the first frame to itself
endFrame = currKeyFrame.frame;
}
else {
continue;
}
}
else {
endFrame = nextKeyFrame.frame;
}
}
else {
// at the last key frame
prevKeyFrame = keyFrames[i - 1];
if (currKeyFrame.value.equals(prevKeyFrame.value)) {
continue;
}
else {
endFrame = maxFrame;
}
}
if (endFrame) {
for (let f = currKeyFrame.frame; f <= endFrame; f += sampleRate) {
time = Tools.FloatRound(f / fps);
if (time === previousTime) {
continue;
}
previousTime = time;
maxUsedFrame = time;
value = animation._interpolate(f, 0, undefined, animation.loopMode);
_GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, convertToRightHandedSystem, useQuaternion);
}
}
}
if (maxUsedFrame) {
minMaxFrames.max = maxUsedFrame;
}
}