mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
update api document for ILerpable (#4621)
This commit is contained in:
committed by
Weiliang Wang
parent
6ee7107a32
commit
51ce17b987
@@ -307,7 +307,7 @@ export class AnimationClip extends Asset {
|
||||
if (propertyCurveData.keys >= 0) {
|
||||
ratioSampler = this._ratioSamplers[propertyCurveData.keys];
|
||||
}
|
||||
return new AnimCurve(propertyCurveData, propertyName, isNode, ratioSampler);
|
||||
return new AnimCurve(propertyCurveData, propertyName, this._duration, isNode, ratioSampler);
|
||||
}
|
||||
|
||||
private _createRuntimeEvents () {
|
||||
|
||||
@@ -152,7 +152,10 @@ export class AnimCurve {
|
||||
|
||||
private _stepfiedValues?: any[];
|
||||
|
||||
constructor (propertyCurveData: IPropertyCurveData, propertyName: string, isNode: boolean, ratioSampler: RatioSampler | null) {
|
||||
private _duration: number;
|
||||
|
||||
constructor (propertyCurveData: IPropertyCurveData, propertyName: string, duration: number, isNode: boolean, ratioSampler: RatioSampler | null) {
|
||||
this._duration = duration;
|
||||
this._ratioSampler = ratioSampler;
|
||||
|
||||
// Install values.
|
||||
@@ -276,7 +279,7 @@ export class AnimCurve {
|
||||
}
|
||||
// calculate value
|
||||
const toVal = values[index];
|
||||
value = this._lerp(fromVal, toVal, ratioBetweenFrames, dRatio);
|
||||
value = this._lerp(fromVal, toVal, ratioBetweenFrames, dRatio * this._duration);
|
||||
isLerped = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,19 @@ export class WrappedInfo {
|
||||
}
|
||||
|
||||
export interface ILerpable {
|
||||
/**
|
||||
* 在当前曲线值与目标曲线值之间插值。
|
||||
* @param to 目标曲线值。
|
||||
* @param t 插值比率。
|
||||
* @param dt 当前曲线值与目标曲线值的时间间隔,单位为秒。
|
||||
* @returns 插值结果。
|
||||
*/
|
||||
lerp (to: any, t: number, dt: number): any;
|
||||
|
||||
/**
|
||||
* 当直接使用曲线值作为采样结果时的结果值,它应该等同于插值比率为 0 时的插值结果。
|
||||
* @returns 插值比率为 0 时的插值结果。
|
||||
*/
|
||||
getNoLerp? (): any;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user