Skip to content
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

Demo link broken #1330

Open
notfed opened this issue Jan 30, 2025 · 1 comment
Open

Demo link broken #1330

notfed opened this issue Jan 30, 2025 · 1 comment

Comments

@notfed
Copy link

notfed commented Jan 30, 2025

This page: https://github.com/liabru/matter-js/wiki/Getting-started#install
Links to "Demo.js" which gives a 404 error.

Also, as someone who's never used this, I just want a minimal working example. I found this page, but those aren't minimal working examples, those are JavaScript files with no corresponding html file, so as a new user I have no idea how to invoke these examples.

@ggorlen
Copy link

ggorlen commented Feb 1, 2025

Thanks, the broken link was reported in #1322 but Liabru is the only maintainer as far as I know, and tends to disappear for long periods of time, so there may not be a fix right away.

I agree on the usefulness of complete, minimal examples for beginners. As a workaround to a more permanent solution, like a "copy HTML code" button on each example, here's fairly standard HTML boilerplate you can drop most of the example code files into for starting your own project:

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/pathseg.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/decomp.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.20.0/matter.js"></script>
</head>
<body>
<script>

////////////////////////////////////
// 1. PASTE ENTIRE DEMO CODE HERE //
////////////////////////////////////

// 2. Remove any lines like: Common.setDecomp(require('poly-decomp'));
// 3. Loading assets (sprites, SVGs) will not work out of the box
// 4. Modify this code to run the example (replace airFriction with the example name):
Example.airFriction();

// Or, instead, try to autodetect the name:
// Example[Object.keys(Example).find(k => typeof Example[k] === "function")]();

</script>
</body>
</html>

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

No branches or pull requests

2 participants