{"record":{"id":"f25640729212f821","repo":"BabylonJS/Babylon.js","slug":"you-must-implement-this-method","errorCode":null,"errorMessage":"You must implement this method","messagePattern":"You must implement this method","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Animations/easing.ts","lineNumber":63,"sourceCode":"     */\r\n    public setEasingMode(easingMode: number) {\r\n        const n = Math.min(Math.max(easingMode, 0), 2);\r\n        this._easingMode = n;\r\n    }\r\n    /**\r\n     * Gets the current easing mode.\r\n     * @returns the easing mode\r\n     */\r\n    public getEasingMode(): number {\r\n        return this._easingMode;\r\n    }\r\n\r\n    /**\r\n     * @internal\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    public easeInCore(gradient: number): number {\r\n        throw new Error(\"You must implement this method\");\r\n    }\r\n\r\n    /**\r\n     * Given an input gradient between 0 and 1, this returns the corresponding value\r\n     * of the easing function.\r\n     * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n     * @returns the corresponding value on the curve defined by the easing function\r\n     */\r\n    public ease(gradient: number): number {\r\n        switch (this._easingMode) {\r\n            case EasingFunction.EASINGMODE_EASEIN:\r\n                return this.easeInCore(gradient);\r\n            case EasingFunction.EASINGMODE_EASEOUT:\r\n                return 1 - this.easeInCore(1 - gradient);\r\n        }\r\n\r\n        if (gradient >= 0.5) {\r\n            return (1 - this.easeInCore((1 - gradient) * 2)) * 0.5 + 0.5;\r","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Animations/easing.ts#L45-L81","documentation":"EasingFunction.easeInCore is the abstract core of Babylon's easing system; the base class provides ease() which delegates to easeInCore. The base implementation throws 'You must implement this method' to signal that a concrete easing function subclass did not override it.","triggerScenarios":"Instantiating EasingFunction (or a custom subclass) directly and using it in an Animation, or writing a custom easing subclass that forgets to override easeInCore, then playing an animation that calls ease().","commonSituations":"Custom easing implementations missing the override; passing new EasingFunction() instead of a concrete one like CubicEase or QuadraticEase; TypeScript not catching it because the base method is public and concrete.","solutions":["Use a built-in easing class (CubicEase, QuadraticEase, BackEase, etc.) instead of the base EasingFunction","In a custom subclass, override easeInCore(gradient: number): number and return the eased value","Add @Override-style linting/tests so missing overrides are caught early"],"exampleFix":"// before\nclass MyEase extends EasingFunction { }\n// after\nclass MyEase extends EasingFunction {\n    public easeInCore(gradient: number): number {\n        return gradient * gradient;\n    }\n}","handlingStrategy":"type-guard","validationCode":"function isUsableEasing(e: EasingFunction): boolean {\n    return e.constructor !== EasingFunction || e.easeInCore(0.5) !== undefined;\n}","typeGuard":"function hasEaseInCore(e: unknown): e is Required<Pick<EasingFunction, 'easeInCore'>> {\n    return e instanceof EasingFunction &&\n        e.constructor !== EasingFunction &&\n        typeof (e as any).easeInCore === 'function';\n}","tryCatchPattern":"try {\n    anim.setEasingFunction(myEase);\n    scene.beginAnimation(target, 0, 100);\n} catch (e) {\n    if (e.message.includes(\"You must implement this method\")) {\n        anim.setEasingFunction(new CubicEase()); // fallback to built-in\n    }\n}","preventionTips":["Never instantiate EasingFunction directly; always use a concrete subclass","In custom easing classes, implement easeInCore in the same file/skeleton as the class","Add a unit test that calls ease(0.5) for every easing class used in the app"],"tags":["animation","easing","abstract-method","inheritance"],"backgroundTag":"abstract-method-not-implemented","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}