{"id":13765741,"url":"https://typpo.github.io/spacekit/","last_synced_at":"2025-05-10T21:31:55.394Z","repository":{"id":35549638,"uuid":"159758625","full_name":"typpo/spacekit","owner":"typpo","description":"Javascript library for 3D space visualizations","archived":false,"fork":false,"pushed_at":"2024-03-18T20:27:32.000Z","size":66783,"stargazers_count":513,"open_issues_count":14,"forks_count":38,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-08-03T16:08:55.159Z","etag":null,"topics":["hacktoberfest","space","visualization"],"latest_commit_sha":null,"homepage":"https://typpo.github.io/spacekit/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typpo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-30T02:43:38.000Z","updated_at":"2024-07-27T18:35:10.000Z","dependencies_parsed_at":"2024-08-03T16:04:08.487Z","dependency_job_id":"5a2e6f37-dcd8-4d6a-b7b6-371db53024c4","html_url":"https://github.com/typpo/spacekit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fspacekit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fspacekit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fspacekit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fspacekit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typpo","download_url":"https://codeload.github.com/typpo/spacekit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224989474,"owners_count":17403408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","space","visualization"],"created_at":"2024-08-03T16:00:44.962Z","updated_at":"2024-11-17T01:31:22.780Z","avatar_url":"https://github.com/typpo.png","language":"JavaScript","funding_links":[],"categories":["Astronomy","Визуализация"],"sub_categories":["SDKs \u0026amp; Software Development Tools"],"readme":"# spacekit\n[![Build Status](https://travis-ci.com/typpo/spacekit.svg?branch=master)](https://travis-ci.com/typpo/spacekit)\n[![npm](https://img.shields.io/npm/v/spacekit.js)](https://www.npmjs.com/package/spacekit.js)\n\nSpacekit is a JavaScript library for creating interactive 3D space visualizations - whether of the Earth/moon system, solar system, or beyond.\n\nYou can check out an editable live example on [jsfiddle](https://jsfiddle.net/typpo/x9nv8jg0/6/), or look at a variety of live examples on [SpaceReference.org](https://www.spacereference.org/solar-system#ob=2001-einstein-1973-eb,7672-hawking-1995-uo2,2709-sagan-1982-fh).  This library generalizes work that is currently used on [Asterank](https://www.asterank.com/), [Meteor Showers](https://www.meteorshowers.org/), [Ancient Earth](https://dinosaurpictures.org/ancient-earth), [and](https://www.ianww.com/ceres/) [many](https://www.asterank.com/exoplanets) [other](https://www.ianww.com/pluto/) [things](https://www.ianww.com/moonviz/) into a single open-source 3D engine for space that is both accurate and visually stunning.\n\nSee the **[full documentation](https://typpo.github.io/spacekit/)**\n\nNote that this library is a work in progress and the API might change!\n\n[![spacekit examples](https://i.imgur.com/u48FCjJ.jpg)](https://typpo.github.io/spacekit/)\n\n# Usage\n\nInstall via npm:\n\n```\nnpm install spacekit.js\n```\n\nAnd then use `require` or `import`:\n\n```js\nconst Spacekit = require('spacekit.js');\n// or\nimport Spacekit from 'spacekit.js';\n```\n\nYou can also [download a raw build](https://github.com/typpo/spacekit/tree/master/build) or use the latest build in a script tag:\n```html\n\u003cscript src=\"https://typpo.github.io/spacekit/build/spacekit.js\"\u003e\u003c/script\u003e\n```\n\n# Terminology and components\n\n`Simulation`: the main container for your visualization.  A simulation is comprised by a `Camera` plus whatever you choose to put in it. See [documentation](https://typpo.github.io/spacekit/docs/class/src/Simulation.js~Simulation.html) for full options.\n```javascript\nconst sim = new Spacekit.Simulation(document.getElementById('my-container'), {\n // Required\n basePath: '../path/to/asset',\n // Optional\n camera: {\n   initialPosition: [0, -10, 5],\n   enableDrift: false,\n },\n debug: {\n   showAxes: false,\n   showGrid: false,\n   showStats: false,\n },\n});\n```\n\n`Skybox`: the image background of the visualization.  The \"universe\" of the visualization is contained within a large sphere, so \"skysphere\" may be a better (less conventional) way to describe it.  Some skybox assets are provided, including starry milky way background from ESA and NASA Tycho. See [documentation](https://typpo.github.io/spacekit/variable/index.html#static-variable-SkyboxPresets) for full preset options.\n```javascript\n// Use an existing skybox preset.\nconst skybox = sim.createSkybox(Spacekit.SkyboxPresets.NASA_TYCHO);\n\n// Add a skybox preset\nconst skybox = sim.createSkybox({\n  textureUrl: '../path/to/image.png'\n});\n```\n\n`Stars`: an alternative to a skybox.  Instead of showing an image, this class loads real star data and positions the stars accordingly in the simulation.  Usually this is more performant but less visually stunning.\n```javascript\n// Use an existing skybox preset.\nconst skybox = sim.createStars({minSize /* optional */: 0.75 /* default */});\n\n// Add a skybox preset\nconst skybox = sim.createSkybox({\n  textureUrl: '../path/to/image.png'\n});\n```\n\n`SpaceObject`: an object that can be added to the visualization (SpaceObjects can sometimes be referred to as simply \"Object\").  SpaceObjects can orbit, rotate, etc.  Subclasses include `RotatingObject` (has a defined spin axis), `ShapeObject` (has a 3D shapefile), and `SphereObject` (is spherical, like the Earth).\n```javascript\n// Create objects using presets. The presets include scientific ephem params and/or position.\nconst sun = viz.createObject('sun', Spacekit.SpaceObjectPresets.SUN);\nviz.createObject('mercury', Spacekit.SpaceObjectPresets.MERCURY);\nviz.createObject('venus', Spacekit.SpaceObjectPresets.VENUS);\n\n// Create a stationary object at [3, 1, -5] position.\nconst obj = viz.createObject('myobj', {\n  position: [3, 1, -5],\n};\n\n// Create an object that orbits.\n\n// Ephem is a class representing Kepler ephemerides, which defines the trajectory of astronomical objects as well\n// as artificial satellites in the sky, i.e., the position (and possibly velocity) over time.\nconst ephem = new Spacekit.Ephem({\n  epoch: 2458600.5,\n  a: 5.38533,\n  e: 0.19893,\n  i: 22.11137,\n  om: 294.42992,\n  w: 314.28890,\n  ma: 229.14238,\n}, 'deg');\n\nconst asteroid = sim.createObject('Asteroid Aci', {\n  ephem,\n});\n\n// Create a shape object\nconst obj = viz.createShape('myobj', {\n  position: [3, 1, -5],\n  shape: {\n    // Example shape file -\n    // http://astro.troja.mff.cuni.cz/projects/asteroids3D/web.php?page=db_asteroid_detail\u0026asteroid_id=1046\n    shapeUrl: '../path/to/shape.obj', // Cacus\n  },\n  rotation: {\n    lambdaDeg: 251,\n    betaDeg: -63,\n    period: 3.755067,\n    yorp: 1.9e-8,\n    phi0: 0,\n    jd0: 2443568.0,\n  },\n  debug: {\n    showAxes: true,\n  },\n});\n\n// Create a sphere object\nsim.createSphere('earth', {\n  textureUrl: './earth_66mya.jpg',\n  radius: 2 /* default to 1 */\n  debug: {\n    showAxes: true,\n  },\n});\n```\n\n`KeplerParticles`: an optimized class for creating many particles that follow Kepler orbits.  These particles don't have a specific shape or size.  Instead, they share a 2D texture.  This is useful for when you want to show many objects at once, such as the asteroid belt.\n\n# Dependencies\n\nSpacekit relies on some image and data assets that are not included in the Javascript file.\n\nBy default, these dependencies are hosted on the spacekit site (typpo.github.io/spacekit).  If you want to host these assets yourself, you can set the `Simulation`'s `basePath` parameter to a folder that contains these files:\n\n  - [Spacekit asset directory](https://github.com/typpo/spacekit/tree/master/src/assets)\n  - [Spacekit data directory](https://github.com/typpo/spacekit/tree/master/src/data)\n\nFor example:\n\n```\nconst viz = new Spacekit.Simulation({\n  basePath: 'https://mysite.com/static/spacekit',\n});\n```\n\nIf you want to contribute to this project, you will also need to install Python (2.7 or 3).\n\n# Running an Example\n\nRunning `./server.sh` will start a basic Python webserver.  Go to http://localhost:8001/examples/index.html to load a simple example.\n\nIf you're making changes to the code, run `yarn build` to update the build outputs.  `yarn build:watch` will continuously watch for your changes and update the build and also host a server on localhost:8001 (so you don't have to start the Python server separately).\n\n# Usage\n\nSee the [examples](https://github.com/typpo/spacekit/tree/master/examples) directory for full usage examples.  For now, here's some example code that will build an interactive visualization of a couple planets:\n\n```javascript\n// Create the visualization and put it in our div.\nconst viz = new Spacekit.Simulation(document.getElementById('main-container'), {\n  assetPath: '../src/assets',\n});\n\n// Create a skybox using NASA TYCHO artwork.\nconst skybox = viz.createSkybox(Spacekit.SkyboxPresets.NASA_TYCHO);\n\n// Create our first object - the sun - using a preset space object.\nconst sun = viz.createObject('sun', Spacekit.SpaceObjectPresets.SUN);\n\n// Then add some planets\nviz.createObject('mercury', Spacekit.SpaceObjectPresets.MERCURY);\nviz.createObject('venus', Spacekit.SpaceObjectPresets.VENUS);\nviz.createObject('earth', Spacekit.SpaceObjectPresets.EARTH);\nviz.createObject('mars', Spacekit.SpaceObjectPresets.MARS);\nviz.createObject('jupiter', Spacekit.SpaceObjectPresets.JUPITER);\nviz.createObject('saturn', Spacekit.SpaceObjectPresets.SATURN);\nviz.createObject('uranus', Spacekit.SpaceObjectPresets.URANUS);\nviz.createObject('neptune', Spacekit.SpaceObjectPresets.NEPTUNE);\n```\n\n![example](https://i.imgur.com/WseTJidl.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/typpo.github.io%2Fspacekit%2F","html_url":"https://awesome.ecosyste.ms/projects/typpo.github.io%2Fspacekit%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/typpo.github.io%2Fspacekit%2F/lists"}