Skip to content

Conversation

lixiaolin94
Copy link
Contributor

Summary

This PR implements the feature request from issue #1039 to increase the
maximum limits for spring animation stiffness and velocity parameters,
enabling more realistic physics-based animations.

Changes

  • Stiffness limit: Increased from 1,000 to 10,000 (10x increase)
  • Velocity limit: Increased from ±1,000 to ±10,000 (10x increase)
  • Updated both constructor and setter methods to use new limits
  • Added comprehensive test coverage for the new limits
  • Fixed rollup configuration import syntax for better Node.js
    compatibility

Example Usage

// Now possible with increased limits
anime({
  targets: '.element',
  translateX: 250,
  easing: 'spring(1, 5000, 10, 2000)' // High stiffness and velocity
});

Test Plan

- All existing tests continue to pass
- New tests added for stiffness limits up to 10,000
- New tests added for velocity limits up to ±10,000
- Tests verify values above limits are properly clamped
- Tests confirm animations work with high parameter values
- Build process (npm run dev-types) works correctly
- Browser tests run successfully

Breaking Changes

None - this change is fully backward compatible.

Performance Impact

No performance regression expected. The change only increases upper
bounds while maintaining the same clamping behavior.

Closes #1039

lixiaolin94 and others added 2 commits June 28, 2025 22:18
- Increase stiffness limit from 1,000 to 10,000 (10x increase)
- Increase velocity limit from ±1,000 to ±10,000 (10x increase)
- Update both constructor and setter methods with new limits
- Add comprehensive tests for increased limits and clamping behavior
- Fix rollup config import syntax for better Node.js compatibility

Enables more realistic physics-based spring animations while maintaining
backward compatibility and reasonable upper bounds for performance.

Closes juliangarnier#1039
@juliangarnier juliangarnier merged commit 6a7aeed into juliangarnier:dev Aug 11, 2025
@juliangarnier juliangarnier mentioned this pull request Aug 12, 2025
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants