Skip to content

Initial suite of samples #2

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zachernuk
Copy link
Collaborator

Using the teapot character, demonstrating the API as discussed so far!

Using the teapot character, demonstrating the API as discussed so far.
@zachernuk
Copy link
Collaborator Author

@mkeblx These are the samples I mentioned!

Copy link

@mkeblx mkeblx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start on some samples 🫖 👍

A few minor things

</p>

<pre>
&lt;model autoplay alt="A model of a teapot with a hidden creature">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No loop attribute present here in code sample

autorotate.html Outdated

<h2>HTML</h2>
<pre>
&lt;model id="model" alt="A model of a teapot">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these code sections I believe want to also excape the > chars.

</body>
<script type="module">
let initialTransform;
await model.ready;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some samples like here use the more ~legacy fact that HTML element with ID x shows up window.x, while others do not. Can we always explicitly reference the element via a selector?

const model = document.querySelector('model');
const {src, type} = model.dataset;
const bytes = await (await fetch(src)).bytes();
const srcString = URL.createObjectURL(new Blob([bytes], {type}));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a blob URL test case, as using createObjectURL => blob.

Blob URL:

const response = await fetch(url);
const blob = await response.blob(); // this should maintain type too
const objectURL = URL.createObjectURL(blob);

We should probably have two demo pages, one for data URL, and blob URL.

~data URL:

const response = await fetch(url);
const blob = await response.blob();
const reader = new FileReader();
reader.readAsDataURL(blob);

currenttime.html Outdated
</body>

<script>
(async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like other samples, can we use script type="module" which has top level await and remove this async wrapper?

jsorbit.html Outdated
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Model: Orbit test</title>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JS-Orbit in title, like H1

<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Model: basic test</title>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playbackrate in title

currenttime.html Outdated
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Model: basic test</title>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentTime in title like H1

boundingbox.html Outdated
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Model: basic test</title>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boundingBox in title

background.html Outdated
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No title tag in head

Replaced the `>` characters in the `pre` sections with the escaped character,
Made use of type="module" script tags and omitted the script tags in their respective `pre` sections,
Added and updated the titles,
Renamed the DataURL test to accurately reflect that it's a Blob URL test,
Made sure there is a valid query selector rather than relying on the global-namespaced references by ID.
@zachernuk zachernuk requested a review from mkeblx May 2, 2025 18:08
@zachernuk
Copy link
Collaborator Author

@mkeblx Thank you so much for catching all that! Take a look again when you can.

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.

2 participants