motion-canvas
motion-canvas copied to clipboard
Button for creating new projects in the project selector UI
Description
Multi-project support is nice, but the only way to create a second project is to either duplicate the folder of an existing project, or manually create the files with the basic makeProject
and makeScene
implementations, and both ways need you to manually add the project to vite.config.ts
.
Proposed solution Add a new button to the Projects screen, which builds the motion canvas standard project in a new folder and automatically adds it to the vite config. The Projects screen would also appear even if there is only one project in the config. For consistency, perhaps also a button on each project in the list to remove it from the vite config
Doing this would also implicitly define a "canonical" structure for having a multi-project repository. That's just a general observation, not really a criticism about this idea.
For now, it's a hard pass from me. Two main reasons:
- This would require Vite to modify its own config file at runtime, which sounds like a hack.
- I'd like to avoid any sort of code generation on the editor side. The core idea behind MC is that it is code-driven. I've already received comments on YouTube asking for a WYSIWYG functionality which I think is pure insanity. Metafiles should be the only way for the editor to influence the animation - no modifying/generating actual source code.
That being said, I think that having a way to quickly bootstrap new projects is useful.
I have my own templates configured in WebStorm for this reason:
Maybe a CLI would be a better solution? More aligned with the spirit of programming:
mc add project | scene | component
+1 for the latter idea.
i'd make a cli but what if people structure things weirdly? say they just dont have a src/scenes folder but instead just throw all of their scenes into src. How do you generate a scene then? or better yet: how do you find and update project.ts?