Skip to content

🎥 Make videos programmatically with React

`remotion`: Don't allow non-positive values for spring()

Jonny Burger9dd7dbc4f8c7
diff --git a/packages/core/src/spring/spring-utils.ts b/packages/core/src/spring/spring-utils.ts
index 40a7c5d8ab..4673d36b9a 100644
--- a/packages/core/src/spring/spring-utils.ts
+++ b/packages/core/src/spring/spring-utils.ts
@@ -35,6 +35,12 @@ function advance({
const deltaTime = Math.min(now - lastTimestamp, 64);
+ if (config.damping <= 0) {
+ throw new Error(
+ 'Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.',
+ );
+ }
+
const c = config.damping;
const m = config.mass;
const k = config.stiffness;