-
-
Notifications
You must be signed in to change notification settings - Fork 577
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
Bundling for browser canvas #443
Comments
This is still undocumented but you can already embed Motion Canvas animations on the web. You can run the following command to build your project:
This will produce a compiled project file in the
It contains a Custom Element that can display the animation: import '@motion-canvas/player'; // import the player somewhere on the website. <motion-canvas-player
src={`/project.js`} <!-- link to the statically hosted project file -->
/> |
@aarthificial I am assuming that the import of the player is intended for projects which are built before being shipped (e.g. vue or react)? I wanted to integrate the player in an out-of-the-box jekyll project, ready to be hosted on GitHub. I installed the player as you described, then built it with webpack: webpack build '@motion-canvas/player/dist/main.js' -o js/motion-canvas-player and then included it in the jekyll page (post jekyll template shown): <script src="/my-project/js/motion-canvas-player/main.js" type="text/javascript"></script> What is the problem? <motion-canvas-player src="/my-project/animation/test.js" auto="true"></motion-canvas-player> I get an error
What am I even asking? Am I missing something fundamental? Can I not build the player with webpack? If so, is there another way? Any help would be much appreciated. (motion-canvas and player version is 3.3.4) |
@StefanKreidel Can you make sure that your project was actually built using |
Thanks for the fast feedback! I just created a new project from scratch using I'll investigate and try to figure out what is going on. |
Theoretically, the contents of the scene shouldn't really matter. motion-canvas/packages/core/src/app/Stage.ts Lines 71 to 74 in 9030ca0
Because background is an instance of a wrong class that doesn't have the serialize method.This is the project background configured in the Video Settings |
First of all: thank you Jacob for not only responding so fast but for also investigation my issue! I really enjoy seeing someone being so dedicated to their project. Hugh compliment from me! Now, I tried a few different things, including setting the background via The workaround described in #577 is the only thing currently working for me: // import color specifically in your scene.tsx
import "@motion-canvas/core/lib/types/Color"
... |
Closing this in favor of #247 |
It would be sick if we can bind the canvas progession to a external source, i would really like to bind it to the scroll postion to use this as a type of scrollytelling tool. |
Since motion canvas primarily uses canvas, I think we could leverage it to render animation on a webpage directly in a canvas element. But I'm not sure, how to bundle / compile the source for browser.
Could anyone help me with this.
The text was updated successfully, but these errors were encountered: