Larawag: A NodeJS package for rendering custom 3D stellar/planetary systems in Web environments
Hey guys, I wanted to share this package I've been working on in the last few days for a bigger project. It's basically a NPM package that allows you to create your custom stellar systems and uses three.js to render them in 3D.
You can check the live example here: https://larawag.rachzy.dev/
It's mostly intended for drawing hypothetical, highly speculative visualizations of stellar systems for exoplanets (keep in mind that it's 100% Artist's Conceptions).
Larawag core is environment agnostic (which means it can run even on vanilla HTML as long as you have a Node setup), but you can also use its integrations with third-party frameworks:
• Larawag's Core: @larawag/core (https://www.npmjs.com/package/@larawag/core)
• React: @larawag/react (https://www.npmjs.com/package/@larawag/react)
• Angular: @larawag/angular (https://www.npmjs.com/package/@larawag/angular)
How to use
As I mentioned before, the usage is very straightforward:
First, download the package and its dependencies: npm install @larawag/core three@0.186
Then, import it and create your own system:
import { createStarSystem } from '@larawag/core'; const view = createStarSystem(document.getElementById('stage')!, { star: { name: 'Example K dwarf', teff: 5100, radius: 0.8, mass: 0.85 }, planets: [ { name: 'Candidate b', period: 4.2, radius: 1.5, phase: 0.6 }, { name: 'Candidate c', period: 18.5, radius: 3.6, phase: 2.9 }, ], }); view.pause(); view.setScaleMode('true'); view.destroy();
This will use the #stage element as the window for rendering your system and set the scale mode to true, and you should already see it working in your HTML page.
Contributing
There are still some things I'm willing to implement in the future, such as planet moons, eccentric/inclined orbits, and a more accurate orbital system for planets in binary systems. I left all of them in a TO-DO list at README.md
If any of you are perhaps interested in contributing to the project, I'd really appreciate it.
Source code: https://github.com/rachzy/larawag
License: MIT
— u/rachzera
Пожаловаться или запросить удаление
Запись импортирована из reddit.com. Если вы автор или правообладатель и хотите, чтобы мы её удалили, — напишите, и модератор посмотрит.