-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add manual frame rendering API for environments without requestAnimationFrame #3521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ionFrame
This adds support for manually advancing animations in environments where
requestAnimationFrame is unavailable, such as WebXR immersive sessions,
Remotion video rendering, or server-side rendering of animations.
New APIs:
- renderFrame({ timestamp, frame, fps, delta }) - Manually render a frame
- setManualTiming(enabled) - Enable/disable manual timing mode globally
- isManualTiming() - Check if manual timing is enabled
- useManualFrame({ frame, fps }) - React hook for Remotion integration
Fixes #2496
https://claude.ai/code/session_01AFhy8F8ubRRHsau2GRdYAZ
Code Review - PR #3521: Manual Frame Rendering APII've completed a thorough review of this pull request. Overall, this is a well-designed and well-tested addition that addresses a legitimate need for manual frame control in non-browser environments. Here's my detailed feedback: ✅ Strengths1. Well-Designed APIThe API is intuitive and flexible with multiple input modes:
The three-tier API ( 2. Excellent Test CoverageThe test file (
This follows the CLAUDE.md guideline of writing tests first. 3. Good Integration with Existing Systems
4. DocumentationExcellent JSDoc comments with multiple usage examples for Remotion, WebXR, and custom loops. 🐛 Issues & Concerns1. Potential Race Condition in
|
Pull Request ReviewOverviewThis PR adds a manual frame rendering API for environments without ✅ Strengths1. Strong API Design
2. Excellent Test CoverageThe test suite in
3. Documentation
🔍 Issues Found1. Potential Race Condition in
|
- Add unit tests for useManualFrame hook demonstrating Remotion-style integration - Add tests for direct renderFrame usage with frame-by-frame stepping - Add tests for scrubbing backwards through animations - Add interactive dev demo with frame slider and step buttons https://claude.ai/code/session_01AFhy8F8ubRRHsau2GRdYAZ
Pull Request Review: Manual Frame Rendering APII've completed a thorough review of PR #3521. This is a well-designed feature that adds manual frame control for environments without ✅ StrengthsArchitecture & Design
Code Quality
🔍 Issues & Recommendations1. Potential Race Condition in
|
| Category | Rating | Notes |
|---|---|---|
| Code Quality | ⭐⭐⭐⭐⭐ | Clean, well-structured, follows conventions |
| Test Coverage | ⭐⭐⭐⭐☆ | Comprehensive, but missing some edge cases |
| Documentation | ⭐⭐⭐⭐⭐ | Excellent examples and JSDoc |
| Performance | ⭐⭐⭐⭐⭐ | Minimal overhead, efficient implementation |
| Security | ⭐⭐⭐⭐⭐ | No concerns |
| Architecture | ⭐⭐⭐⭐⭐ | Excellent separation of concerns |
Overall: This is a high-quality PR that solves a real problem (Remotion/WebXR integration) with a clean, well-tested API. The issues identified are minor and mostly about edge cases and error handling.
✅ Recommended Actions Before Merge
- MUST: Add try-finally to
renderFrame(issue adding circleci config #4) - SHOULD: Add explicit return type to
processFrame(issue Add motionValue prop #3) - SHOULD: Add edge case tests (issue Adding
useViewportScroll#7) - CONSIDER: Review backward scrubbing delta behavior (issue Initial API (WIP) #1)
- CONSIDER: Document the
renderFrame({})behavior (issue Initial event setup #5) - VERIFY: Exports are available from
motion/react(issue Feature/frame #6)
Great work on this feature! 🎉
- Create motion-remotion package with remotionDriver and useRemotionFrame hook - Add MotionGlobalConfig.driver for custom animation drivers - Disable WAAPI when custom driver or useManualTiming is active - Update batcher to skip rAF scheduling with custom driver - Export Driver type and frameloopDriver from motion-dom - Remove useManualFrame from framer-motion (moved to motion-remotion) - Add waapi supports tests for driver/timing checks Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove useManualTiming from MotionGlobalConfig - Remove setManualTiming and isManualTiming functions - Update batcher, waapi, and sync-time to only check for driver - Update all tests to use driver instead of useManualTiming - Use useLayoutEffect in useRemotionFrame for proper timing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This adds support for manually advancing animations in environments where
requestAnimationFrame is unavailable, such as WebXR immersive sessions,
Remotion video rendering, or server-side rendering of animations.
New APIs:
Fixes #2496
https://claude.ai/code/session_01AFhy8F8ubRRHsau2GRdYAZ