Skip to content

Feat(2d): Add Camera Node#376

Open
devmuhnnad wants to merge 1 commit into
midrender:mainfrom
devmuhnnad:add-camera-node
Open

Feat(2d): Add Camera Node#376
devmuhnnad wants to merge 1 commit into
midrender:mainfrom
devmuhnnad:add-camera-node

Conversation

@devmuhnnad
Copy link
Copy Markdown

This PR adds a camera node, ported from Motion Canvas with minor tweaks to make it work in this codebase.

What I did

This pull request introduces a new Camera component to the 2D rendering library, enabling advanced scene navigation features such as zooming, centering, and following paths. The changes also update the core vector math utilities, add a usage example, and integrate the camera into the default template project. The most important changes are grouped below:

Core Math and Utility Improvements

  • Added transformAsPoint and transform methods to Vector2, supporting matrix transformations needed for camera operations.
  • Imported Matrix2D utilities as dependencies for the new vector methods.
  • Added a parentToWorld computed property to Node, simplifying matrix calculations for camera overlays.

Example and Template Updates

  • Added a new camera-example.tsx scene demonstrating basic camera usage, including panning between positions.
  • Updated the template project's entry point to use the new camera example as the default scene.

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.

1 participant