{"record":{"id":"477afc47ab2b77c9","repo":"remotion-dev/remotion","slug":"spring-damping-must-be-greater-than-0-otherwise-t","errorCode":null,"errorMessage":"Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.","messagePattern":"Spring damping must be greater than 0, otherwise the spring\\(\\) animation will never end, causing an infinite loop\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/spring/spring-utils.ts","lineNumber":39,"sourceCode":"};\n\nconst advanceCache: {[key: string]: AnimationNode} = {};\n\nfunction advance({\n\tanimation,\n\tnow,\n\tconfig,\n}: {\n\tanimation: AnimationNode;\n\tnow: number;\n\tconfig: SpringConfig;\n}): AnimationNode {\n\tconst {toValue, lastTimestamp, current, velocity} = animation;\n\n\tconst deltaTime = Math.min(now - lastTimestamp, 64);\n\n\tif (config.damping <= 0) {\n\t\tthrow new Error(\n\t\t\t'Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.',\n\t\t);\n\t}\n\n\tconst c = config.damping;\n\tconst m = config.mass;\n\tconst k = config.stiffness;\n\n\tconst cacheKey = [\n\t\ttoValue,\n\t\tlastTimestamp,\n\t\tcurrent,\n\t\tvelocity,\n\t\tc,\n\t\tm,\n\t\tk,\n\t\tnow,\n\t].join('-');","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/spring/spring-utils.ts#L21-L57","documentation":"spring() and measureSpring() accept a `config` object with `damping`, `mass`, and `stiffness`. Damping represents the friction that lets the spring settle; with damping <= 0 the spring oscillates forever and the animation never ends. The library refuses to compute such a config to prevent infinite loops in both rendering and the measureSpring settling loop.","triggerScenarios":"Calling `spring({fps, frame, config: {damping: 0, ...}})` or `measureSpring({fps, config: {damping: 0}})`; also fires when damping is computed and underflows to 0 or a negative number.","commonSituations":"Passing `{damping: 0}` thinking it means 'no friction'; typos like `damping: -1`; parameterizing damping from a UI control that can reach zero; copying configs from examples that used a different spring library.","solutions":["Set damping to a positive number; the Remotion default is 10.","If you want a bouncy spring, increase stiffness and overshootClamping rather than zeroing damping.","Validate `config.damping > 0` (and ideally mass > 0, stiffness > 0) before calling spring/measureSpring."],"exampleFix":"// before\nspring({fps, frame, config: {damping: 0, mass: 1, stiffness: 100}});\n\n// after\nspring({fps, frame, config: {damping: 10, mass: 1, stiffness: 100}});","handlingStrategy":"validation","validationCode":"const config = {damping, mass: 1, stiffness: 100, overshootClamping: false};\nif (!(config.damping > 0)) {\n  throw new Error(`damping must be > 0, got ${config.damping}`);\n}\nconst value = spring({fps: 30, frame: 0, config});","typeGuard":"const isValidSpringConfig = (\n  c: Partial<SpringConfig>,\n): c is SpringConfig =>\n  typeof c.damping === 'number' && c.damping > 0 &&\n  typeof c.mass === 'number' && c.mass > 0 &&\n  typeof c.stiffness === 'number' && c.stiffness > 0;","tryCatchPattern":null,"preventionTips":["Use the default config ({damping: 10, mass: 1, stiffness: 100}) unless you have a reason to change it.","Bound any UI control that feeds damping to a minimum above 0 (e.g. 1).","Document the meaning of damping in your config schema so contributors do not zero it."],"tags":["spring","animation","config","validation","infinite-loop"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}