From aa22216dc81e28e011dda905a676f4539ffbf8c8 Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Sat, 2 May 2026 23:20:28 +0200 Subject: [PATCH] BezierInterpolant: Refactor `inTangents`/`outTangents`. (#33515) --- src/animation/AnimationAction.js | 9 --------- src/animation/KeyframeTrack.js | 4 ++-- src/math/interpolants/BezierInterpolant.js | 10 ++++------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/animation/AnimationAction.js b/src/animation/AnimationAction.js index 5630db5f5d9a67..c1a26f17dcb628 100644 --- a/src/animation/AnimationAction.js +++ b/src/animation/AnimationAction.js @@ -41,15 +41,6 @@ class AnimationAction { const interpolant = tracks[ i ].createInterpolant( null ); interpolants[ i ] = interpolant; - - // preserve interpolant settings (like tangent data from BezierInterpolant) - - if ( interpolant.settings ) { - - Object.assign( interpolantSettings, interpolant.settings ); - - } - interpolant.settings = interpolantSettings; } diff --git a/src/animation/KeyframeTrack.js b/src/animation/KeyframeTrack.js index c089adf82ccd78..1fe249ae847ca4 100644 --- a/src/animation/KeyframeTrack.js +++ b/src/animation/KeyframeTrack.js @@ -158,10 +158,10 @@ class KeyframeTrack { const interpolant = new BezierInterpolant( this.times, this.values, this.getValueSize(), result ); - // Pass tangent data from track settings to interpolant if ( this.settings ) { - interpolant.settings = this.settings; + interpolant.inTangents = this.settings.inTangents; + interpolant.outTangents = this.settings.outTangents; } diff --git a/src/math/interpolants/BezierInterpolant.js b/src/math/interpolants/BezierInterpolant.js index 5f433e7af90c2f..f22117af9ce0c5 100644 --- a/src/math/interpolants/BezierInterpolant.js +++ b/src/math/interpolants/BezierInterpolant.js @@ -7,9 +7,8 @@ import { Interpolant } from '../Interpolant.js'; * each keyframe has explicit in/out tangent control points specified as * 2D coordinates (time, value). * - * The tangent data must be provided via the `settings` object: - * - `settings.inTangents`: Float32Array with [time, value] pairs per keyframe per component - * - `settings.outTangents`: Float32Array with [time, value] pairs per keyframe per component + * Tangent data is read from `inTangents` and `outTangents` on the interpolant + * (populated by `KeyframeTrack.InterpolantFactoryMethodBezier`). * * For a track with N keyframes and stride S: * - Each tangent array has N * S * 2 values @@ -29,9 +28,8 @@ class BezierInterpolant extends Interpolant { const offset1 = i1 * stride; const offset0 = offset1 - stride; - const settings = this.settings || this.DefaultSettings_; - const inTangents = settings.inTangents; - const outTangents = settings.outTangents; + const inTangents = this.inTangents; + const outTangents = this.outTangents; // If no tangent data, fall back to linear interpolation if ( ! inTangents || ! outTangents ) {