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

troika-3d-text available via a content delivery network #48

Closed
theo-armour opened this issue May 25, 2020 · 6 comments
Closed

troika-3d-text available via a content delivery network #48

theo-armour opened this issue May 25, 2020 · 6 comments

Comments

@theo-armour
Copy link

Is troika-3d-text available via a content delivery network such as jsdelivr.net?

I build very simple plain-vanilla JavaScript cookbook examples - such as this one:

https://www.ladybug.tools/spider-covid-19-viz-3d/cookbook/globe-population-cities/

I am very interested in building examples that include troika-3d-text. Is there some way this could be possible?

@lojjic
Copy link
Collaborator

lojjic commented May 25, 2020

It's published in the public npm repository so yes, a CDN like jsdelivr.net or unpkg.com that proxies npm modules should work.

@lojjic
Copy link
Collaborator

lojjic commented May 25, 2020

More specifically, for usage with globals, you'll probably want the textmesh-standalone umd file with its two dependencies:

https://cdn.jsdelivr.net/npm/troika-three-utils@0.26.0
https://cdn.jsdelivr.net/npm/troika-worker-utils@0.26.0
https://cdn.jsdelivr.net/npm/troika-3d-text@0.26.0/dist/textmesh-standalone.umd.min.js

You should then be able to access the global troika_3d_text.TextMesh
I haven't tried this personally so lemme know if it doesn't work.

@theo-armour
Copy link
Author

@lojjic

Thanks for speedy holiday reply. looking now.

@theo-armour
Copy link
Author

@lojjic

https://ta-troika-3d-text.glitch.me/

source:
https://glitch.com/edit/#!/ta-troika-3d-text?path=index.html%3A1%3A0

see line 228

error Uncaught Reference Error: TextMesh is not defined

@lojjic
Copy link
Collaborator

lojjic commented May 25, 2020

Yeah, like I wrote above if you're using globals then it's going to be at troika_3d_text.TextMesh not just TextMesh. Your glitch seems to work when you fix that and the missing argument to zoomObjectBoundingSphere.

Also keep in mind that the text layout is asynchronous, so the bounding sphere won't be accurate until after the sync completes.

@lojjic lojjic closed this as completed May 25, 2020
@theo-armour
Copy link
Author

Again. @lojjic, thank you for speedy holiday response.

My doh. Troika 3D Text rules!

Your project looks like it is going to be fun to investigate

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