mrdoob/three.js · error

THREE.Interpolant: Call to abstract method.

Error message

THREE.Interpolant: Call to abstract method.

What it means

The base Interpolant class declares interpolate_() as abstract - it throws if called. Concrete subclasses (LinearInterpolant, DiscreteInterpolant, CubicInterpolant, etc.) override interpolate_() with the actual sampling math. The base class cannot interpolate because the algorithm depends on the subclass-specific value structure.

Source

Thrown at src/math/Interpolant.js:300

		}

		return result;

	}

	/**
	 * Copies a sample value to the result buffer.
	 *
	 * @abstract
	 * @param {number} i1 - An index into the sample value buffer.
	 * @param {number} t0 - The previous interpolation factor.
	 * @param {number} t - The current interpolation factor.
	 * @param {number} t1 - The next interpolation factor.
	 * @return {TypedArray} The result buffer.
	 */
	interpolate_( /* i1, t0, t, t1 */ ) {

		throw new Error( 'THREE.Interpolant: Call to abstract method.' );
		// implementations shall return this.resultBuffer

	}

	/**
	 * Optional method that is executed when the interval has changed.
	 *
	 * @param {number} i1 - An index into the sample value buffer.
	 * @param {number} t0 - The previous interpolation factor.
	 * @param {number} t - The current interpolation factor.
	 */
	intervalChanged_( /* i1, t0, t1 */ ) {

		// empty

	}

}

View on GitHub (pinned to da05705fa3)

Solutions

  1. Use a concrete subclass: THREE.LinearInterpolant, THREE.DiscreteInterpolant, THREE.CubicInterpolant, or THREE.QuaternionLinearInterpolant.
  2. If subclassing Interpolant, implement interpolate_(i1, t0, t, t1) returning this.resultBuffer.
  3. For animation tracks, use the standard KeyframeTrack subclasses which select the correct interpolant automatically.
  4. If the error surfaces from internal animation, check that your KeyframeTrack has a valid interpolation name (InterpolateLinear, InterpolateDiscrete, InterpolateSmooth).

Example fix

// before: instantiating the abstract base
const interp = new THREE.Interpolant(times, values, 3);
interp.evaluate(1.5); // throws 'Call to abstract method'

// after: use a concrete interpolant
const interp = new THREE.LinearInterpolant(times, values, 3);
interp.evaluate(1.5);
Defensive patterns

Strategy: type-guard

Validate before calling

function makeInterpolant(times, values, stride, interpolation = 'linear') {
  switch (interpolation) {
    case 'linear':    return new THREE.LinearInterpolant(times, values, stride);
    case 'discrete':  return new THREE.DiscreteInterpolant(times, values, stride);
    case 'cubic':     return new THREE.CubicInterpolant(times, values, stride);
    default: throw new Error(`Unknown interpolation: ${interpolation}`);
  }
}

Type guard

import { Interpolant } from 'three';

function isConcreteInterpolant(obj) {
  return obj instanceof Interpolant && obj.constructor !== Interpolant;
}

Prevention

When it happens

Trigger: Instantiating new THREE.Interpolant(...) directly and calling .evaluate(). Also subclassing Interpolant but forgetting to override interpolate_(). Or an animation/morph/property binding resolving to the base Interpolant type because no concrete interpolant was registered for the keyframe track type.

Common situations: Writing a custom KeyframeTrack subclass without supplying a matching interpolant. Library/extension code that accidentally references the abstract base. Mistakenly using Interpolant as a generic interpolator instead of LinearInterpolant.

Related errors


AI-assisted analysis of mrdoob/three.js@da05705fa3 (2026-08-12). Data as JSON: /api/errors/76226b1e8749795d. Report an issue: GitHub.